diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/CHANGELOG.md b/sdk/securityinsights/azure-resourcemanager-securityinsights/CHANGELOG.md index 4f49b3729636..ae50e01f8ac4 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/CHANGELOG.md +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/CHANGELOG.md @@ -1,14 +1,1270 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2025-04-25) -### Features Added +- Azure Resource Manager SecurityInsights client library for Java. This package contains Microsoft Azure SDK for SecurityInsights Management SDK. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2025-04-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.Source` was removed -### Other Changes +#### `models.Relation$DefinitionStages` was modified + +* `withExistingIncident(java.lang.String,java.lang.String,java.lang.String)` was removed in stage 1 + +#### `models.Watchlist$Update` was modified + +* `withSource(models.Source)` was removed + +#### `models.Watchlist$Definition` was modified + +* `withSource(models.Source)` was removed + +#### `models.Relation$Definition` was modified + +* `withExistingIncident(java.lang.String,java.lang.String,java.lang.String)` was removed + +#### `models.Entity` was modified + +* `models.EntityKindEnum kind()` -> `models.EntityKindEnum kind()` +* `fromJson(com.azure.json.JsonReader)` was removed +* `com.azure.core.management.SystemData systemData()` -> `com.azure.core.management.SystemData systemData()` +* `java.lang.String id()` -> `java.lang.String id()` +* `validate()` was removed +* `java.lang.String name()` -> `java.lang.String name()` +* `toJson(com.azure.json.JsonWriter)` was removed +* `java.lang.String type()` -> `java.lang.String type()` + +#### `models.Watchlist` was modified + +* `models.Source source()` -> `java.lang.String source()` + +#### `models.Watchlists` was modified + +* `deleteWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `com.azure.core.http.rest.Response deleteByIdWithResponse(java.lang.String,com.azure.core.util.Context)` -> `void deleteByIdWithResponse(java.lang.String,com.azure.core.util.Context)` + +#### `models.IncidentRelations` was modified + +* `define(java.lang.String)` was removed +* `deleteByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `getById(java.lang.String)` was removed +* `getByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was removed +* `deleteById(java.lang.String)` was removed + +### Features Added + +* `models.InsightQueryItemPropertiesReferenceTimeRange` was added + +* `models.FusionSourceSettings` was added + +* `models.SystemResource$UpdateStages` was added + +* `models.WorkspaceManagerGroupList` was added + +* `models.AwsS3CheckRequirements` was added + +* `models.ExpansionResultsMetadata` was added + +* `models.MetadataList` was added + +* `models.MdatpCheckRequirements` was added + +* `models.Metadatas` was added + +* `models.DeploymentState` was added + +* `models.ExpansionEntityQuery` was added + +* `models.GcpAuthProperties` was added + +* `models.WorkspaceManagerGroups` was added + +* `models.ConnectorDefinitionsAvailability` was added + +* `models.EnrichmentDomainWhoisContact` was added + +* `models.EntityQueries` was added + +* `models.SourceKind` was added + +* `models.ThreatIntelligenceAlertRuleTemplate` was added + +* `models.EntityQueryItemProperties` was added + +* `models.ThreatIntelligenceAlertRule` was added + +* `models.Flag` was added + +* `models.Anomalies` was added + +* `models.IoTCheckRequirements` was added + +* `models.Hunt$Update` was added + +* `models.TimelineError` was added + +* `models.EntityTimelineParameters` was added + +* `models.DeploymentFetchStatus` was added + +* `models.SystemsList` was added + +* `models.SettingList` was added + +* `models.AlertPropertyMapping` was added + +* `models.NicEntity` was added + +* `models.TiTaxiiCheckRequirements` was added + +* `models.WorkspaceManagerMember` was added + +* `models.Hunt$DefinitionStages` was added + +* `models.CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem` was added + +* `models.HuntRelation$Update` was added + +* `models.ThreatIntelligences` was added + +* `models.GitHubResourceInfo` was added + +* `models.ApiKeyAuthModel` was added + +* `models.MetadataDependencies` was added + +* `models.RestApiPollerDataConnector` was added + +* `models.ActivityEntityQueriesPropertiesQueryDefinitions` was added + +* `models.IncidentTask$DefinitionStages` was added + +* `models.RestApiPollerRequestPagingTokenConfig` was added + +* `models.ProductPackageAdditionalProperties` was added + +* `models.BookmarkEntityMappings` was added + +* `models.ResourceProviders` was added + +* `models.EntityGetInsightsResponse` was added + +* `models.RelationshipHint` was added + +* `models.TimelineAggregation` was added + +* `models.EyesOn` was added + +* `models.GcpRequestProperties` was added + +* `models.PropertyArrayConditionProperties` was added + +* `models.ConnectorDefinitionsPermissions` was added + +* `models.FusionSubTypeSeverityFilter` was added + +* `models.Error` was added + +* `models.AutomationRulePropertyArrayConditionSupportedArrayConditionType` was added + +* `models.ContentType` was added + +* `models.OfficeIrmCheckRequirements` was added + +* `models.DeviceImportance` was added + +* `models.FusionScenarioExclusionPattern` was added + +* `models.SystemResource$Update` was added + +* `models.HuntRelationList` was added + +* `models.PackageModel$DefinitionStages` was added + +* `models.Office365ProjectCheckRequirements` was added + +* `models.EntityExpandParameters` was added + +* `models.SessionAuthModel` was added + +* `models.Systems` was added + +* `models.DataConnectorAuthorizationState` was added + +* `models.PurviewAuditCheckRequirements` was added + +* `models.IndicatorObservablesItem` was added + +* `models.GetQueriesResponse` was added + +* `models.AlertProperty` was added + +* `models.ProductTemplateOperations` was added + +* `models.QuerySortBy` was added + +* `models.WorkspaceManagerAssignments` was added + +* `models.InsightsTableResultColumnsItem` was added + +* `models.UnlockUserAction` was added + +* `models.SourceControl` was added + +* `models.ContentPackages` was added + +* `models.EntitiesGetTimelines` was added + +* `models.TiTaxiiDataConnectorDataTypesTaxiiClient` was added + +* `models.ActivityEntityQueryTemplatePropertiesQueryDefinitions` was added + +* `models.MstiDataConnectorDataTypes` was added + +* `models.ConnectedEntity` was added + +* `models.ConditionProperties` was added + +* `models.RfcConnector` was added + +* `models.PermissionsCustomsItem` was added + +* `models.ProductTemplateList` was added + +* `models.DataConnectorConnectBody` was added + +* `models.RestApiPollerRequestConfig` was added + +* `models.AutomationRuleAddIncidentTaskAction` was added + +* `models.GitHubAuthModel` was added + +* `models.FusionTemplateSourceSubType` was added + +* `models.ConnectorInstructionModelBase` was added + +* `models.WorkspaceManagerMember$Definition` was added + +* `models.HuntComment$Definition` was added + +* `models.ConnectivityCriteria` was added + +* `models.RepositoryAccessKind` was added + +* `models.SourceControlList` was added + +* `models.WorkspaceManagerGroup$UpdateStages` was added + +* `models.EntityInsightItem` was added + +* `models.McasCheckRequirements` was added + +* `models.MetadataAuthor` was added + +* `models.SourceControlsOperations` was added + +* `models.CcpAuthConfig` was added + +* `models.FusionSubTypeSeverityFiltersItem` was added + +* `models.RepoList` was added + +* `models.AgentType` was added + +* `models.TemplateAdditionalProperties` was added + +* `models.CustomPermissionDetails` was added + +* `models.TriggeredAnalyticsRuleRuns` was added + +* `models.CodelessConnectorPollingResponseProperties` was added + +* `models.SystemResource$Definition` was added + +* `models.LogStatusType` was added + +* `models.RecommendationPatchProperties` was added + +* `models.AwsS3DataConnectorDataTypesLogs` was added + +* `models.EntityItemQueryKind` was added + +* `models.QueryCondition` was added + +* `models.DcrConfiguration` was added + +* `models.EntityType` was added + +* `models.DataConnectorRequirementsState` was added + +* `models.MtpDataConnectorDataTypesIncidents` was added + +* `models.TemplateModel$Definition` was added + +* `models.HuntComment` was added + +* `models.WorkspaceManagerMember$UpdateStages` was added + +* `models.BillingStatisticList` was added + +* `models.EntityTimelineResponse` was added + +* `models.AutomationRulePropertyArrayValuesCondition` was added + +* `models.AlertRuleTemplatePropertiesBase` was added + +* `models.GetInsightsErrorKind` was added + +* `models.WorkspaceManagerGroup$Definition` was added + +* `models.WorkspaceManagerAssignment$UpdateStages` was added + +* `models.EntityInsightItemQueryTimeInterval` was added + +* `models.Connective` was added + +* `models.BusinessApplicationAgentResource$Update` was added + +* `models.HuntList` was added + +* `models.TIObjectKind` was added + +* `models.TemplateModel$UpdateStages` was added + +* `models.AscCheckRequirements` was added + +* `models.ProductTemplates` was added + +* `models.HuntComment$UpdateStages` was added + +* `models.ProvisioningState` was added + +* `models.HuntComment$Update` was added + +* `models.SortingDirection` was added + +* `models.BookmarkExpandResponse` was added + +* `models.AlertRuleTemplateWithMitreProperties` was added + +* `models.CustomEntityQueryKind` was added + +* `models.Warning` was added + +* `models.ResourceProvider` was added + +* `models.AadCheckRequirements` was added + +* `models.MicrosoftPurviewInformationProtectionDataConnector` was added + +* `models.ConfigurationType` was added + +* `models.MicrosoftPurviewInformationProtectionConnectorDataTypesLogs` was added + +* `models.Indicator` was added + +* `models.MetadataModel$UpdateStages` was added + +* `models.SystemsConfigurationConnector` was added + +* `models.PackageModel` was added + +* `models.MetadataSupport` was added + +* `models.PackageModel$Update` was added + +* `models.PurviewAuditConnectorDataTypesLogs` was added + +* `models.WorkspaceManagerConfiguration$Definition` was added + +* `models.ExpansionResultAggregation` was added + +* `models.WorkspaceManagerAssignment` was added + +* `models.ProviderPermissionsScope` was added + +* `models.BookmarkOperations` was added + +* `models.AssignmentItem` was added + +* `models.MtpDataConnector` was added + +* `models.NrtAlertRule` was added + +* `models.Query` was added + +* `models.WorkspaceManagerConfiguration$Update` was added + +* `models.LogType` was added + +* `models.ActivityTimelineItem` was added + +* `models.TriggeredAnalyticsRuleRun` was added + +* `models.CustomsPermission` was added + +* `models.RecommendationPatch` was added + +* `models.CodelessUiConnectorConfigPropertiesSampleQueriesItem` was added + +* `models.RestApiPollerRequestPagingLinkHeaderConfig` was added + +* `models.Dynamics365DataConnectorDataTypes` was added + +* `models.ConnectorDataType` was added + +* `models.NoneAuthModel` was added + +* `models.WorkspaceManagerGroup$Update` was added + +* `models.Mode` was added + +* `models.MetadataSource` was added + +* `models.TemplateModel$Update` was added + +* `models.RequiredPermissions` was added + +* `models.ReportActionStatusPayload` was added + +* `models.Deployment` was added + +* `models.Hunt$Definition` was added + +* `models.MtpProvider` was added + +* `models.BillingStatisticKind` was added + +* `models.MicrosoftPurviewInformationProtectionConnectorDataTypes` was added + +* `models.ContentTemplates` was added + +* `models.AddIncidentTaskActionProperties` was added + +* `models.ReevaluateResponse` was added + +* `models.CodelessConnectorPollingPagingProperties` was added + +* `models.Recommendation` was added + +* `models.InsightQueryItem` was added + +* `models.GcpDataConnector` was added + +* `models.SentinelEntityMapping` was added + +* `models.BusinessApplicationAgentOperations` was added + +* `models.TiTaxiiDataConnector` was added + +* `models.Hunt$UpdateStages` was added + +* `models.MetadataModel$DefinitionStages` was added + +* `models.MtpDataConnectorDataTypesAlerts` was added + +* `models.TimelineResultsMetadata` was added + +* `models.MstiDataConnector` was added + +* `models.AwsCloudTrailCheckRequirements` was added + +* `models.EntityQueryTemplateList` was added + +* `models.EntityQuery` was added + +* `models.PackageModel$UpdateStages` was added + +* `models.SecurityAlertTimelineItem` was added + +* `models.WorkspaceManagerMembersList` was added + +* `models.AzureEntityResource` was added + +* `models.SapSystemsConfiguration` was added + +* `models.AwsS3DataConnector` was added + +* `models.RecommendationList` was added + +* `models.MLBehaviorAnalyticsAlertRule` was added + +* `models.PackageKind` was added + +* `models.Permissions` was added + +* `models.ProductPackageOperations` was added + +* `models.CodelessUiDataConnector` was added + +* `models.AzureDevOpsResourceInfo` was added + +* `models.CustomEntityQuery` was added + +* `models.SupportTier` was added + +* `models.EntityList` was added + +* `models.BillingStatistics` was added + +* `models.Version` was added + +* `models.LastDataReceivedDataType` was added + +* `models.WorkspaceManagerMember$Update` was added + +* `models.MetadataPatch` was added + +* `models.GetTriggeredAnalyticsRuleRuns` was added + +* `models.LockUserAction` was added + +* `models.ActivityEntityQueryTemplate` was added + +* `models.ListActionsResponse` was added + +* `models.Office365ProjectConnectorDataTypesLogs` was added + +* `models.RepositoryResourceInfo` was added + +* `models.SecretSource` was added + +* `models.ValidationError` was added + +* `models.CodelessUiConnectorConfigPropertiesGraphQueriesItem` was added + +* `models.RepoType` was added + +* `models.ProductPackageList` was added + +* `models.TemplateModel$DefinitionStages` was added + +* `models.ListActionKind` was added + +* `models.OfficePowerBIConnectorDataTypes` was added + +* `models.OutputType` was added + +* `models.ConnectivityCriterion` was added + +* `models.SettingKind` was added + +* `models.OfficePowerBICheckRequirements` was added + +* `models.WarningCode` was added + +* `models.Dynamics365CheckRequirements` was added + +* `models.GcpAuthModel` was added + +* `models.SourceControl$DefinitionStages` was added + +* `models.CodelessUiConnectorConfigProperties` was added + +* `models.BusinessApplicationAgentResource$DefinitionStages` was added + +* `models.PollingFrequency` was added + +* `models.GraphQuery` was added + +* `models.Repository` was added + +* `models.EntityQueryTemplate` was added + +* `models.WorkspaceManagerAssignment$DefinitionStages` was added + +* `models.InstructionStepsInstructionsItem` was added + +* `models.EntityEdges` was added + +* `models.EntityFieldMapping` was added + +* `models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem` was added + +* `models.FileImportList` was added + +* `models.BusinessApplicationAgentResource$Definition` was added + +* `models.MetadataModel$Definition` was added + +* `models.WorkspaceManagerConfiguration` was added + +* `models.DeleteStatus` was added + +* `models.WorkspaceManagerAssignmentList` was added + +* `models.IncidentTask$Update` was added + +* `models.AutomationRuleBooleanCondition` was added + +* `models.HttpsConfigurationType` was added + +* `models.DataConnectorsCheckRequirements` was added + +* `models.CodelessConnectorPollingConfigProperties` was added + +* `models.ActivityEntityQuery` was added + +* `models.WorkspaceManagerConfigurationList` was added + +* `models.BusinessApplicationAgents` was added + +* `models.DeploymentInfo` was added + +* `models.InsightQueryItemPropertiesTableQuery` was added + +* `models.AutomationRulePropertyArrayConditionSupportedArrayType` was added + +* `models.InsightQueryItemPropertiesDefaultTimeRange` was added + +* `models.Updates` was added + +* `models.InsightQueryItemProperties` was added + +* `models.AlertRuleOperations` was added + +* `models.IncidentTaskList` was added + +* `models.ProductTemplateAdditionalProperties` was added + +* `models.RestApiPollerRequestPagingKind` was added + +* `models.SystemsConfiguration` was added + +* `models.EntityAnalytics` was added + +* `models.ProductPackageModel` was added + +* `models.IncidentTaskStatus` was added + +* `models.CodelessUiConnectorConfigPropertiesDataTypesItem` was added + +* `models.EntityExpandResponse` was added + +* `models.IncidentTask$Definition` was added + +* `models.AatpCheckRequirements` was added + +* `models.SourceType` was added + +* `models.MLBehaviorAnalyticsAlertRuleTemplate` was added + +* `models.HuntComment$DefinitionStages` was added + +* `models.Relationship` was added + +* `models.TIObject` was added + +* `models.GetRecommendations` was added + +* `models.MicrosoftPurviewInformationProtectionCheckRequirements` was added + +* `models.CustomizableConnectorDefinition` was added + +* `models.BasicAuthModel` was added + +* `models.HttpMethodVerb` was added + +* `models.Repo` was added + +* `models.EntityGetInsightsParameters` was added + +* `models.CustomizableConnectionsConfig` was added + +* `models.TriggeredAnalyticsRuleRunOperations` was added + +* `models.SystemResource` was added + +* `models.IncidentTask$UpdateStages` was added + +* `models.EntityTimelineKind` was added + +* `models.NrtAlertRuleTemplate` was added + +* `models.AwsS3DataConnectorDataTypes` was added + +* `models.RestApiPollerRequestPagingCountBaseConfig` was added + +* `models.Hunt` was added + +* `models.ProviderName` was added + +* `models.PermissionsResourceProviderItem` was added + +* `models.PackageBaseProperties` was added + +* `models.BookmarkTimelineItem` was added + +* `models.SourceControls` was added + +* `models.ServicePrincipal` was added + +* `models.DataConnectorDefinitionArmCollectionWrapper` was added + +* `models.PullRequest` was added + +* `models.SystemResource$DefinitionStages` was added + +* `models.DataConnectorDefinitions` was added + +* `models.PackageModel$Definition` was added + +* `models.Kind` was added + +* `models.HuntRelation$DefinitionStages` was added + +* `models.OfficeConsentList` was added + +* `models.InstructionSteps` was added + +* `models.IncidentTasks` was added + +* `models.IncidentTask` was added + +* `models.IngestionMode` was added + +* `models.CodelessConnectorPollingAuthProperties` was added + +* `models.BookmarkExpandResponseValue` was added + +* `models.DataTypeDefinitions` was added + +* `models.FileImport$DefinitionStages` was added + +* `models.GetInsightsError` was added + +* `models.Log` was added + +* `models.EntityQueryKind` was added + +* `models.TemplateBaseProperties` was added + +* `models.GetInsightsResultsMetadata` was added + +* `models.Operator` was added + +* `models.MtpCheckRequirements` was added + +* `models.MetadataModel` was added + +* `models.UndoActionPayload` was added + +* `models.Gets` was added + +* `models.HuntOwner` was added + +* `models.BusinessApplicationAgentResource` was added + +* `models.EntityTimelineItem` was added + +* `models.ManualTriggerRequestBody` was added + +* `models.JobList` was added + +* `models.AnomalyTimelineItem` was added + +* `models.ThreatIntelligenceList` was added + +* `models.AgentSystem` was added + +* `models.MtpFilteredProviders` was added + +* `models.HypothesisStatus` was added + +* `models.Entities` was added + +* `models.ConnectivityType` was added + +* `models.JwtAuthModel` was added + +* `models.DataConnectorTenantId` was added + +* `models.EnrichmentDomainBody` was added + +* `models.AwsAuthModel` was added + +* `models.TemplateList` was added + +* `models.ProductTemplateModel` was added + +* `models.PermissionProviderScope` was added + +* `models.PurviewAuditDataConnector` was added + +* `models.OracleAuthModel` was added + +* `models.MetadataModel$Update` was added + +* `models.InsightQueryItemPropertiesAdditionalQuery` was added + +* `models.Job` was added + +* `models.EntityManualTriggerRequestBody` was added + +* `models.SystemConfigurationConnectorType` was added + +* `models.SourceControl$Definition` was added + +* `models.DataConnectorLicenseState` was added + +* `models.EntityQueryItem` was added + +* `models.Hunts` was added + +* `models.ThreatActor` was added + +* `models.MtpDataConnectorDataTypes` was added + +* `models.SapAgentConfiguration` was added + +* `models.BusinessApplicationAgentResource$UpdateStages` was added + +* `models.ProductPackages` was added + +* `models.ResourceProviderRequiredPermissions` was added + +* `models.SapSolutionUsageStatistic` was added + +* `models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem` was added + +* `models.CustomizableConnectorUiConfig` was added + +* `models.WorkspaceManagerConfiguration$UpdateStages` was added + +* `models.Settings` was added + +* `models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities` was added + +* `models.EntityExpandResponseValue` was added + +* `models.MetadataCategories` was added + +* `models.EntityProviders` was added + +* `models.SapAuthenticationType` was added + +* `models.HuntRelations` was added + +* `models.ConnectorDefinitionsResourceProvider` was added + +* `models.ContentTemplateOperations` was added + +* `models.EntitiesRelations` was added + +* `models.CodelessConnectorPollingRequestProperties` was added + +* `models.FileImportState` was added + +* `models.ConnectAuthKind` was added + +* `models.PurviewAuditConnectorDataTypes` was added + +* `models.EntityQueryTemplateKind` was added + +* `models.ThreatIntelligenceCount` was added + +* `models.Office365ProjectConnectorDataTypes` was added + +* `models.FileMetadata` was added + +* `models.EnrichmentIpAddressBody` was added + +* `models.FileFormat` was added + +* `models.AgentConfiguration` was added + +* `models.CcpAuthType` was added + +* `models.PackageList` was added + +* `models.CcpResponseConfig` was added + +* `models.FusionSourceSubTypeSetting` was added + +* `models.DataConnectorDefinition` was added + +* `models.EnrichmentDomainWhoisContacts` was added + +* `models.FileImport` was added + +* `models.EntityRelations` was added + +* `models.FileImportContentType` was added + +* `models.AnalyticsRuleRunTrigger` was added + +* `models.ContentPackageOperations` was added + +* `models.WarningBody` was added + +* `models.Office365ProjectDataConnector` was added + +* `models.RepositoryAccessProperties` was added + +* `models.EnrichmentDomainWhoisDetails` was added + +* `models.EnrichmentIpGeodata` was added + +* `models.TICheckRequirements` was added + +* `models.WorkspaceManagerMembers` was added + +* `models.ProductSettings` was added + +* `models.HuntComments` was added + +* `models.EntityQueryItemPropertiesDataTypesItem` was added + +* `models.AttackPattern` was added + +* `models.IoTDataConnector` was added + +* `models.WorkspaceManagerConfiguration$DefinitionStages` was added + +* `models.State` was added + +* `models.TeamInformation` was added + +* `models.QueryBasedAlertRuleTemplateProperties` was added + +* `models.OfficePowerBIConnectorDataTypesLogs` was added + +* `models.TiType` was added + +* `models.Reevaluates` was added + +* `models.WorkspaceManagerGroup` was added + +* `models.FileImports` was added + +* `models.TiTaxiiDataConnectorDataTypes` was added + +* `models.DataConnectorDefinitionKind` was added + +* `models.TemplateModel` was added + +* `models.ConditionClause` was added + +* `models.Identity` was added + +* `models.WorkspaceManagerAssignment$Update` was added + +* `models.CodelessUiConnectorConfigPropertiesInstructionStepsItem` was added + +* `models.CodelessApiPollingDataConnector` was added + +* `models.Webhook` was added + +* `models.SystemStatusType` was added + +* `models.WorkspaceManagerConfigurations` was added + +* `models.InstructionStep` was added + +* `models.RestApiPollerRequestPagingNextPageUrlConfig` was added + +* `models.DeploymentResult` was added + +* `models.OfficeConsent` was added + +* `models.BooleanConditionProperties` was added + +* `models.AvailabilityStatus` was added + +* `models.ActivityCustomEntityQuery` was added + +* `models.CountQuery` was added + +* `models.RestApiPollerRequestPagingConfig` was added + +* `models.HuntRelation` was added + +* `models.WorkspaceManagerAssignment$Definition` was added + +* `models.WorkspaceManagerAssignmentJobs` was added + +* `models.SettingType` was added + +* `models.InsightsTableResult` was added + +* `models.GraphQueries` was added + +* `models.OfficeAtpDataConnector` was added + +* `models.Status` was added + +* `models.OfficeConsents` was added + +* `models.DataConnectorsCheckRequirementsOperations` was added + +* `models.EnrichmentDomainWhois` was added + +* `models.Dynamics365DataConnector` was added + +* `models.BillingStatistic` was added + +* `models.Action` was added + +* `models.OfficePowerBIDataConnector` was added + +* `models.EnrichmentDomainWhoisRegistrarDetails` was added + +* `models.OAuthModel` was added + +* `models.BookmarkExpandParameters` was added + +* `models.IngestionType` was added + +* `models.FileImport$Definition` was added + +* `models.BookmarkRelations` was added + +* `models.JobItem` was added + +* `models.WorkspaceManagerMember$DefinitionStages` was added + +* `models.EnrichmentType` was added + +* `models.AutomationRuleBooleanConditionSupportedOperator` was added + +* `models.SampleQueries` was added + +* `models.MstiCheckRequirements` was added + +* `models.UebaDataSources` was added + +* `models.BusinessApplicationAgentsList` was added + +* `models.HuntRelation$UpdateStages` was added + +* `models.FusionTemplateSubTypeSeverityFilter` was added + +* `models.RecommendedSuggestion` was added + +* `models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem` was added + +* `models.RestApiPollerRequestPagingOffsetConfig` was added + +* `models.SapControlConnector` was added + +* `models.HuntRelation$Definition` was added + +* `models.OfficeAtpCheckRequirements` was added + +* `models.Customs` was added + +* `models.Ueba` was added + +* `models.OfficeIrmDataConnector` was added + +* `models.WorkspaceManagerGroup$DefinitionStages` was added + +* `models.GenericBlobSbsAuthModel` was added + +* `models.Availability` was added + +* `models.HuntCommentList` was added + +* `models.MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed` was added + +* `models.KeyVaultAuthenticationMode` was added + +* `models.EntityQueryTemplates` was added + +* `models.FusionTemplateSourceSetting` was added + +* `models.InstructionStepDetails` was added + +* `models.EntityQueryList` was added + +#### `models.IncidentAdditionalData` was modified + +* `techniques()` was added +* `mergedIncidentUrl()` was added +* `providerIncidentUrl()` was added +* `mergedIncidentNumber()` was added + +#### `models.ScheduledAlertRuleTemplate` was modified + +* `withSentinelEntitiesMappings(java.util.List)` was added +* `subTechniques()` was added +* `withSubTechniques(java.util.List)` was added +* `sentinelEntitiesMappings()` was added + +#### `models.FusionAlertRuleTemplate` was modified + +* `withSubTechniques(java.util.List)` was added +* `withSourceSettings(java.util.List)` was added +* `subTechniques()` was added +* `sourceSettings()` was added + +#### `models.Watchlist$Update` was modified + +* `withSource(java.lang.String)` was added +* `withProvisioningState(models.ProvisioningState)` was added +* `withSourceType(models.SourceType)` was added + +#### `models.IoTDeviceEntity` was modified + +* `sensor()` was added +* `site()` was added +* `importance()` was added +* `withImportance(models.DeviceImportance)` was added +* `zone()` was added +* `owners()` was added +* `isScanner()` was added +* `isAuthorized()` was added +* `isProgramming()` was added +* `deviceSubType()` was added +* `nicEntityIds()` was added +* `purdueLayer()` was added + +#### `models.Watchlist$Definition` was modified + +* `withSource(java.lang.String)` was added +* `withSourceType(models.SourceType)` was added +* `withProvisioningState(models.ProvisioningState)` was added + +#### `models.Bookmark$Update` was modified + +* `withEntityMappings(java.util.List)` was added +* `withTechniques(java.util.List)` was added +* `withTactics(java.util.List)` was added + +#### `models.Relation$Definition` was modified + +* `withExistingBookmark(java.lang.String,java.lang.String,java.lang.String)` was added + +#### `models.Incident$Definition` was modified + +* `withTeamInformation(models.TeamInformation)` was added + +#### `models.ScheduledAlertRuleCommonProperties` was modified + +* `sentinelEntitiesMappings()` was added +* `withSentinelEntitiesMappings(java.util.List)` was added + +#### `models.ScheduledAlertRule` was modified + +* `withSentinelEntitiesMappings(java.util.List)` was added +* `withSubTechniques(java.util.List)` was added +* `subTechniques()` was added +* `sentinelEntitiesMappings()` was added + +#### `models.Bookmark$Definition` was modified + +* `withTactics(java.util.List)` was added +* `withTechniques(java.util.List)` was added +* `withEntityMappings(java.util.List)` was added + +#### `models.AlertDetailsOverride` was modified + +* `withAlertDynamicProperties(java.util.List)` was added +* `alertDynamicProperties()` was added + +#### `models.Entity` was modified + +* `innerModel()` was added + +#### `models.Watchlist` was modified + +* `provisioningState()` was added +* `sourceType()` was added + +#### `models.Bookmark` was modified + +* `techniques()` was added +* `entityMappings()` was added +* `tactics()` was added + +#### `models.DataConnectors` was modified + +* `connectWithResponse(java.lang.String,java.lang.String,java.lang.String,models.DataConnectorConnectBody,com.azure.core.util.Context)` was added +* `disconnect(java.lang.String,java.lang.String,java.lang.String)` was added +* `connect(java.lang.String,java.lang.String,java.lang.String,models.DataConnectorConnectBody)` was added +* `disconnectWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was added + +#### `models.Incidents` was modified + +* `runPlaybook(java.lang.String,java.lang.String,java.lang.String)` was added +* `runPlaybookWithResponse(java.lang.String,java.lang.String,java.lang.String,models.ManualTriggerRequestBody,com.azure.core.util.Context)` was added + +#### `models.Incident` was modified + +* `teamInformation()` was added +* `providerName()` was added +* `providerIncidentId()` was added + +#### `SecurityInsightsManager` was modified + +* `entitiesGetTimelines()` was added +* `officeConsents()` was added +* `hunts()` was added +* `resourceProviders()` was added +* `getRecommendations()` was added +* `billingStatistics()` was added +* `updates()` was added +* `dataConnectorDefinitions()` was added +* `bookmarkOperations()` was added +* `entities()` was added +* `contentPackageOperations()` was added +* `productTemplateOperations()` was added +* `reevaluates()` was added +* `workspaceManagerAssignmentJobs()` was added +* `fileImports()` was added +* `productTemplates()` was added +* `huntRelations()` was added +* `sourceControlsOperations()` was added +* `productPackageOperations()` was added +* `systems()` was added +* `workspaceManagerConfigurations()` was added +* `contentTemplates()` was added +* `getTriggeredAnalyticsRuleRuns()` was added +* `bookmarkRelations()` was added +* `metadatas()` was added +* `entityRelations()` was added +* `entityQueries()` was added +* `productPackages()` was added +* `gets()` was added +* `productSettings()` was added +* `workspaceManagerMembers()` was added +* `businessApplicationAgentOperations()` was added +* `contentTemplateOperations()` was added +* `huntComments()` was added +* `threatIntelligences()` was added +* `workspaceManagerAssignments()` was added +* `entitiesRelations()` was added +* `alertRuleOperations()` was added +* `contentPackages()` was added +* `incidentTasks()` was added +* `businessApplicationAgents()` was added +* `dataConnectorsCheckRequirementsOperations()` was added +* `entityQueryTemplates()` was added +* `triggeredAnalyticsRuleRunOperations()` was added +* `sourceControls()` was added +* `workspaceManagerGroups()` was added + +#### `models.Watchlists` was modified + +* `delete(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was added + +#### `models.FusionAlertRule` was modified + +* `withScenarioExclusionPatterns(java.util.List)` was added +* `scenarioExclusionPatterns()` was added +* `sourceSettings()` was added +* `subTechniques()` was added +* `withSourceSettings(java.util.List)` was added + +#### `models.IncidentRelations` was modified + +* `createOrUpdate(java.lang.String,java.lang.String,java.lang.String,java.lang.String,fluent.models.RelationInner)` was added +* `createOrUpdateWithResponse(java.lang.String,java.lang.String,java.lang.String,java.lang.String,fluent.models.RelationInner,com.azure.core.util.Context)` was added + +#### `models.Incident$Update` was modified + +* `withTeamInformation(models.TeamInformation)` was added ## 1.0.0 (2025-01-03) diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/README.md b/sdk/securityinsights/azure-resourcemanager-securityinsights/README.md index 60f3f304b6e2..c4b1e9a223a7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/README.md +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/README.md @@ -2,7 +2,7 @@ Azure Resource Manager SecurityInsights client library for Java. -This package contains Microsoft Azure SDK for SecurityInsights Management SDK. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for SecurityInsights Management SDK. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2025-04-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ SecurityInsightsManager manager = SecurityInsightsManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/SAMPLE.md b/sdk/securityinsights/azure-resourcemanager-securityinsights/SAMPLE.md index bae8fc2da53d..369e6071a001 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/SAMPLE.md +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/SAMPLE.md @@ -8,6 +8,10 @@ - [Get](#actions_get) - [ListByAlertRule](#actions_listbyalertrule) +## AlertRuleOperation + +- [TriggerRuleRun](#alertruleoperation_triggerrulerun) + ## AlertRuleTemplates - [Get](#alertruletemplates_get) @@ -27,6 +31,22 @@ - [Get](#automationrules_get) - [List](#automationrules_list) +## BillingStatistics + +- [Get](#billingstatistics_get) +- [List](#billingstatistics_list) + +## BookmarkOperation + +- [Expand](#bookmarkoperation_expand) + +## BookmarkRelations + +- [CreateOrUpdate](#bookmarkrelations_createorupdate) +- [Delete](#bookmarkrelations_delete) +- [Get](#bookmarkrelations_get) +- [List](#bookmarkrelations_list) + ## Bookmarks - [CreateOrUpdate](#bookmarks_createorupdate) @@ -34,13 +54,129 @@ - [Get](#bookmarks_get) - [List](#bookmarks_list) +## BusinessApplicationAgentOperation + +- [Get](#businessapplicationagentoperation_get) + +## BusinessApplicationAgents + +- [CreateOrUpdate](#businessapplicationagents_createorupdate) +- [Delete](#businessapplicationagents_delete) +- [List](#businessapplicationagents_list) + +## ContentPackageOperation + +- [Install](#contentpackageoperation_install) +- [Uninstall](#contentpackageoperation_uninstall) + +## ContentPackages + +- [Get](#contentpackages_get) +- [List](#contentpackages_list) + +## ContentTemplateOperation + +- [Delete](#contenttemplateoperation_delete) +- [Get](#contenttemplateoperation_get) +- [Install](#contenttemplateoperation_install) + +## ContentTemplates + +- [List](#contenttemplates_list) + +## DataConnectorDefinitions + +- [CreateOrUpdate](#dataconnectordefinitions_createorupdate) +- [Delete](#dataconnectordefinitions_delete) +- [Get](#dataconnectordefinitions_get) +- [List](#dataconnectordefinitions_list) + ## DataConnectors +- [Connect](#dataconnectors_connect) - [CreateOrUpdate](#dataconnectors_createorupdate) - [Delete](#dataconnectors_delete) +- [Disconnect](#dataconnectors_disconnect) - [Get](#dataconnectors_get) - [List](#dataconnectors_list) +## DataConnectorsCheckRequirementsOperation + +- [Post](#dataconnectorscheckrequirementsoperation_post) + +## Entities + +- [Expand](#entities_expand) +- [Get](#entities_get) +- [GetInsights](#entities_getinsights) +- [List](#entities_list) +- [Queries](#entities_queries) +- [RunPlaybook](#entities_runplaybook) + +## EntitiesGetTimeline + +- [List](#entitiesgettimeline_list) + +## EntitiesRelations + +- [List](#entitiesrelations_list) + +## EntityQueries + +- [CreateOrUpdate](#entityqueries_createorupdate) +- [Delete](#entityqueries_delete) +- [Get](#entityqueries_get) +- [List](#entityqueries_list) + +## EntityQueryTemplates + +- [Get](#entityquerytemplates_get) +- [List](#entityquerytemplates_list) + +## EntityRelations + +- [GetRelation](#entityrelations_getrelation) + +## FileImports + +- [Create](#fileimports_create) +- [Delete](#fileimports_delete) +- [Get](#fileimports_get) +- [List](#fileimports_list) + +## Get + +- [SingleRecommendation](#get_singlerecommendation) + +## GetRecommendations + +- [List](#getrecommendations_list) + +## GetTriggeredAnalyticsRuleRuns + +- [List](#gettriggeredanalyticsruleruns_list) + +## HuntComments + +- [CreateOrUpdate](#huntcomments_createorupdate) +- [Delete](#huntcomments_delete) +- [Get](#huntcomments_get) +- [List](#huntcomments_list) + +## HuntRelations + +- [CreateOrUpdate](#huntrelations_createorupdate) +- [Delete](#huntrelations_delete) +- [Get](#huntrelations_get) +- [List](#huntrelations_list) + +## Hunts + +- [CreateOrUpdate](#hunts_createorupdate) +- [Delete](#hunts_delete) +- [Get](#hunts_get) +- [List](#hunts_list) + ## IncidentComments - [CreateOrUpdate](#incidentcomments_createorupdate) @@ -55,6 +191,13 @@ - [Get](#incidentrelations_get) - [List](#incidentrelations_list) +## IncidentTasks + +- [CreateOrUpdate](#incidenttasks_createorupdate) +- [Delete](#incidenttasks_delete) +- [Get](#incidenttasks_get) +- [List](#incidenttasks_list) + ## Incidents - [CreateOrUpdate](#incidents_createorupdate) @@ -64,11 +207,58 @@ - [ListAlerts](#incidents_listalerts) - [ListBookmarks](#incidents_listbookmarks) - [ListEntities](#incidents_listentities) +- [RunPlaybook](#incidents_runplaybook) + +## Metadata + +- [Create](#metadata_create) +- [Delete](#metadata_delete) +- [Get](#metadata_get) +- [List](#metadata_list) +- [Update](#metadata_update) + +## OfficeConsents + +- [Delete](#officeconsents_delete) +- [Get](#officeconsents_get) +- [List](#officeconsents_list) ## Operations - [List](#operations_list) +## ProductPackageOperation + +- [Get](#productpackageoperation_get) + +## ProductPackages + +- [List](#productpackages_list) + +## ProductSettings + +- [Delete](#productsettings_delete) +- [Get](#productsettings_get) +- [List](#productsettings_list) +- [Update](#productsettings_update) + +## ProductTemplateOperation + +- [Get](#producttemplateoperation_get) + +## ProductTemplates + +- [List](#producttemplates_list) + +## Reevaluate + +- [Recommendation](#reevaluate_recommendation) + +## ResourceProvider + +- [ListGeodataByIp](#resourceprovider_listgeodatabyip) +- [ListWhoisByDomain](#resourceprovider_listwhoisbydomain) + ## SecurityMLAnalyticsSettings - [CreateOrUpdate](#securitymlanalyticssettings_createorupdate) @@ -83,6 +273,32 @@ - [Get](#sentinelonboardingstates_get) - [List](#sentinelonboardingstates_list) +## SourceControl + +- [ListRepositories](#sourcecontrol_listrepositories) + +## SourceControlsOperation + +- [Create](#sourcecontrolsoperation_create) +- [Delete](#sourcecontrolsoperation_delete) +- [Get](#sourcecontrolsoperation_get) +- [List](#sourcecontrolsoperation_list) + +## Systems + +- [CreateOrUpdate](#systems_createorupdate) +- [Delete](#systems_delete) +- [Get](#systems_get) +- [List](#systems_list) +- [ListActions](#systems_listactions) +- [ReportActionStatus](#systems_reportactionstatus) +- [UndoAction](#systems_undoaction) + +## ThreatIntelligence + +- [Count](#threatintelligence_count) +- [Query](#threatintelligence_query) + ## ThreatIntelligenceIndicator - [AppendTags](#threatintelligenceindicator_appendtags) @@ -101,6 +317,14 @@ - [List](#threatintelligenceindicatorsoperation_list) +## TriggeredAnalyticsRuleRunOperation + +- [Get](#triggeredanalyticsrulerunoperation_get) + +## Update + +- [Recommendation](#update_recommendation) + ## WatchlistItems - [CreateOrUpdate](#watchlistitems_createorupdate) @@ -114,34 +338,62 @@ - [Delete](#watchlists_delete) - [Get](#watchlists_get) - [List](#watchlists_list) + +## WorkspaceManagerAssignmentJobs + +- [Create](#workspacemanagerassignmentjobs_create) +- [Delete](#workspacemanagerassignmentjobs_delete) +- [Get](#workspacemanagerassignmentjobs_get) +- [List](#workspacemanagerassignmentjobs_list) + +## WorkspaceManagerAssignments + +- [CreateOrUpdate](#workspacemanagerassignments_createorupdate) +- [Delete](#workspacemanagerassignments_delete) +- [Get](#workspacemanagerassignments_get) +- [List](#workspacemanagerassignments_list) + +## WorkspaceManagerConfigurations + +- [CreateOrUpdate](#workspacemanagerconfigurations_createorupdate) +- [Delete](#workspacemanagerconfigurations_delete) +- [Get](#workspacemanagerconfigurations_get) +- [List](#workspacemanagerconfigurations_list) + +## WorkspaceManagerGroups + +- [CreateOrUpdate](#workspacemanagergroups_createorupdate) +- [Delete](#workspacemanagergroups_delete) +- [Get](#workspacemanagergroups_get) +- [List](#workspacemanagergroups_list) + +## WorkspaceManagerMembers + +- [CreateOrUpdate](#workspacemanagermembers_createorupdate) +- [Delete](#workspacemanagermembers_delete) +- [Get](#workspacemanagermembers_get) +- [List](#workspacemanagermembers_list) ### Actions_CreateOrUpdate ```java /** - * Samples for Actions CreateOrUpdate. + * Samples for Hunts Get. */ -public final class ActionsCreateOrUpdateSamples { +public final class HuntsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * CreateActionOfAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntById.json */ /** - * Sample code: Creates or updates an action of alert rule. + * Sample code: Get a hunt. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createsOrUpdatesAnActionOfAlertRule( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.actions() - .define("912bec42-cb66-4c03-ac63-1761b6898c3e") - .withExistingAlertRule("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5") - .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withTriggerUri( - "https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature") - .withLogicAppResourceId( - "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts") - .create(); + public static void getAHunt(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts() + .getWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + com.azure.core.util.Context.NONE); } } ``` @@ -150,24 +402,23 @@ public final class ActionsCreateOrUpdateSamples { ```java /** - * Samples for Actions Delete. + * Samples for ProductPackageOperation Get. */ -public final class ActionsDeleteSamples { +public final class ProductPackageOperationGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * DeleteActionOfAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetProductPackageById.json */ /** - * Sample code: Delete an action of alert rule. + * Sample code: Get a package. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - deleteAnActionOfAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.actions() - .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "912bec42-cb66-4c03-ac63-1761b6898c3e", com.azure.core.util.Context.NONE); + public static void getAPackage(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productPackageOperations() + .getWithResponse("myRg", "myWorkspace", "str.azure-sentinel-solution-str", + com.azure.core.util.Context.NONE); } } ``` @@ -176,24 +427,21 @@ public final class ActionsDeleteSamples { ```java /** - * Samples for Actions Get. + * Samples for Watchlists List. */ -public final class ActionsGetSamples { +public final class WatchlistsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * GetActionOfAlertRuleById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlists.json */ /** - * Sample code: Get an action of alert rule. + * Sample code: Get all watchlists. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAnActionOfAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.actions() - .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "912bec42-cb66-4c03-ac63-1761b6898c3e", com.azure.core.util.Context.NONE); + public static void getAllWatchlists(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlists().list("myRg", "myWorkspace", null, com.azure.core.util.Context.NONE); } } ``` @@ -202,2001 +450,7403 @@ public final class ActionsGetSamples { ```java /** - * Samples for Actions ListByAlertRule. + * Samples for WorkspaceManagerConfigurations Delete. */ -public final class ActionsListByAlertRuleSamples { +public final class WorkspaceManagerConfigurationsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * GetAllActionsByAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/DeleteWorkspaceManagerConfiguration.json */ /** - * Sample code: Get all actions of alert rule. + * Sample code: Delete a workspace manager configuration. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAllActionsOfAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.actions() - .listByAlertRule("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - com.azure.core.util.Context.NONE); + public static void deleteAWorkspaceManagerConfiguration( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .deleteWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); } } ``` -### AlertRuleTemplates_Get +### AlertRuleOperation_TriggerRuleRun ```java /** - * Samples for AlertRuleTemplates Get. + * Samples for EntityQueries Delete. */ -public final class AlertRuleTemplatesGetSamples { +public final class EntityQueriesDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * alertRuleTemplates/GetAlertRuleTemplateById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/DeleteEntityQuery.json */ /** - * Sample code: Get alert rule template by Id. + * Sample code: Delete an entity query. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAlertRuleTemplateById(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRuleTemplates() - .getWithResponse("myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", + public static void deleteAnEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .deleteWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", com.azure.core.util.Context.NONE); } } ``` -### AlertRuleTemplates_List +### AlertRuleTemplates_Get ```java +import com.azure.resourcemanager.securityinsights.models.EyesOn; + /** - * Samples for AlertRuleTemplates List. + * Samples for ProductSettings Update. */ -public final class AlertRuleTemplatesListSamples { +public final class ProductSettingsUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * alertRuleTemplates/GetAlertRuleTemplates.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/UpdateEyesOnSetting.json */ /** - * Sample code: Get all alert rule templates. + * Sample code: Update EyesOn settings. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAllAlertRuleTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRuleTemplates().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + updateEyesOnSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings() + .updateWithResponse("myRg", "myWorkspace", "EyesOn", + new EyesOn().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\""), com.azure.core.util.Context.NONE); } } ``` -### AlertRules_CreateOrUpdate +### AlertRuleTemplates_List ```java -import com.azure.resourcemanager.securityinsights.models.AlertDetail; -import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.EntityMapping; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; -import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import com.azure.resourcemanager.securityinsights.models.FusionAlertRule; -import com.azure.resourcemanager.securityinsights.models.GroupingConfiguration; -import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; -import com.azure.resourcemanager.securityinsights.models.MatchingMethod; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRule; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; -import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRule; -import com.azure.resourcemanager.securityinsights.models.TriggerOperator; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentType; /** - * Samples for AlertRules CreateOrUpdate. + * Samples for ResourceProvider ListWhoisByDomain. */ -public final class AlertRulesCreateOrUpdateSamples { +public final class ResourceProviderListWhoisByDomainSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * CreateFusionAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * enrichment/GetWhoisWithWorkspaceByDomainName.json */ /** - * Sample code: Creates or updates a Fusion alert rule. + * Sample code: Get whois information for a single domain name. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - createsOrUpdatesAFusionAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules() - .createOrUpdateWithResponse("myRg", "myWorkspace", "myFirstFusionRule", - new FusionAlertRule().withEtag("3d00c3ca-0000-0100-0000-5d42d5010000") - .withAlertRuleTemplateName("f71aba3d-28fb-450b-b192-4e76a83015c8") - .withEnabled(true), - com.azure.core.util.Context.NONE); + public static void getWhoisInformationForASingleDomainName( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.resourceProviders() + .listWhoisByDomainWithResponse("myRg", "myWorkspace", EnrichmentType.MAIN, + new EnrichmentDomainBody().withDomain("microsoft.com"), com.azure.core.util.Context.NONE); } +} +``` + +### AlertRules_CreateOrUpdate +```java +/** + * Samples for WorkspaceManagerAssignmentJobs Create. + */ +public final class WorkspaceManagerAssignmentJobsCreateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * CreateMicrosoftSecurityIncidentCreationAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/CreateJob.json */ /** - * Sample code: Creates or updates a MicrosoftSecurityIncidentCreation rule. + * Sample code: Creates a job for the specified workspace manager assignment. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createsOrUpdatesAMicrosoftSecurityIncidentCreationRule( + public static void createsAJobForTheSpecifiedWorkspaceManagerAssignment( com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules() - .createOrUpdateWithResponse("myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", - new MicrosoftSecurityIncidentCreationAlertRule().withEtag("\"260097e0-0000-0d00-0000-5d6fa88f0000\"") - .withDisplayName("testing displayname") - .withEnabled(true) - .withProductFilter(MicrosoftSecurityProductName.MICROSOFT_CLOUD_APP_SECURITY), + manager.workspaceManagerAssignmentJobs() + .createWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", com.azure.core.util.Context.NONE); } +} +``` + +### AlertRules_Delete +```java +/** + * Samples for ContentTemplateOperation Delete. + */ +public final class ContentTemplateOperationDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * CreateScheduledAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/DeleteTemplate.json */ /** - * Sample code: Creates or updates a Scheduled alert rule. + * Sample code: Delete metadata. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createsOrUpdatesAScheduledAlertRule( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules() - .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - new ScheduledAlertRule().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withDescription("An example for a scheduled rule") - .withDisplayName("My scheduled rule") - .withEnabled(true) - .withSuppressionDuration(Duration.parse("PT1H")) - .withSuppressionEnabled(false) - .withTactics(Arrays.asList(AttackTactic.PERSISTENCE, AttackTactic.LATERAL_MOVEMENT)) - .withIncidentConfiguration(new IncidentConfiguration().withCreateIncident(true) - .withGroupingConfiguration(new GroupingConfiguration().withEnabled(true) - .withReopenClosedIncident(false) - .withLookbackDuration(Duration.parse("PT5H")) - .withMatchingMethod(MatchingMethod.SELECTED) - .withGroupByEntities(Arrays.asList(EntityMappingType.HOST)) - .withGroupByAlertDetails(Arrays.asList(AlertDetail.DISPLAY_NAME)) - .withGroupByCustomDetails(Arrays.asList("OperatingSystemType", "OperatingSystemName")))) - .withQuery("Heartbeat") - .withQueryFrequency(Duration.parse("PT1H")) - .withQueryPeriod(Duration.parse("P2DT1H30M")) - .withSeverity(AlertSeverity.HIGH) - .withTriggerOperator(TriggerOperator.GREATER_THAN) - .withTriggerThreshold(0) - .withEventGroupingSettings( - new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.ALERT_PER_RESULT)) - .withCustomDetails(mapOf("OperatingSystemName", "OSName", "OperatingSystemType", "OSType")) - .withEntityMappings(Arrays.asList( - new EntityMapping().withEntityType(EntityMappingType.HOST) - .withFieldMappings(Arrays - .asList(new FieldMapping().withIdentifier("FullName").withColumnName("Computer"))), - new EntityMapping().withEntityType(EntityMappingType.IP) - .withFieldMappings(Arrays - .asList(new FieldMapping().withIdentifier("Address").withColumnName("ComputerIP"))))) - .withAlertDetailsOverride( - new AlertDetailsOverride().withAlertDisplayNameFormat("Alert from {{Computer}}") - .withAlertDescriptionFormat("Suspicious activity was made by {{ComputerIP}}")), + public static void deleteMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentTemplateOperations() + .deleteWithResponse("myRg", "myWorkspace", "8365ebfe-a381-45b7-ad08-7d818070e11f", com.azure.core.util.Context.NONE); } +} +``` - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} -``` - -### AlertRules_Delete +### AlertRules_Get ```java + /** - * Samples for AlertRules Delete. + * Samples for Systems UndoAction. */ -public final class AlertRulesDeleteSamples { +public final class SystemsUndoActionSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * DeleteAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/actions/UndoAction.json */ /** - * Sample code: Delete an alert rule. + * Sample code: UndoAction. * * @param manager Entry point to SecurityInsightsManager. */ - public static void deleteAnAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules() - .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - com.azure.core.util.Context.NONE); + public static void undoAction(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .undoActionWithResponse("myRg", "myWorkspace", "247b377a-7137-4b3c-bf15-df1d3260ef1b", + "3d69632b-0b60-4af3-8720-77f01a25d34a", null, com.azure.core.util.Context.NONE); } } ``` -### AlertRules_Get +### AlertRules_List ```java /** - * Samples for AlertRules Get. + * Samples for Bookmarks Delete. */ -public final class AlertRulesGetSamples { +public final class BookmarksDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetScheduledAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/DeleteBookmark.json */ /** - * Sample code: Get a Scheduled alert rule. + * Sample code: Delete a bookmark. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAScheduledAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules() - .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + public static void deleteABookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarks() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } +} +``` + +### AutomationRules_CreateOrUpdate +```java +/** + * Samples for BookmarkRelations List. + */ +public final class BookmarkRelationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetFusionAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/GetAllBookmarkRelations.json */ /** - * Sample code: Get a Fusion alert rule. + * Sample code: Get all bookmark relations. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAFusionAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules() - .getWithResponse("myRg", "myWorkspace", "myFirstFusionRule", com.azure.core.util.Context.NONE); + public static void + getAllBookmarkRelations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .list("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", null, null, null, null, + com.azure.core.util.Context.NONE); } +} +``` + +### AutomationRules_Delete +```java +/** + * Samples for WorkspaceManagerMembers Delete. + */ +public final class WorkspaceManagerMembersDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetMicrosoftSecurityIncidentCreationAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/DeleteWorkspaceManagerMember.json */ /** - * Sample code: Get a MicrosoftSecurityIncidentCreation rule. + * Sample code: Delete a workspace manager member. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAMicrosoftSecurityIncidentCreationRule( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules() - .getWithResponse("myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", + public static void + deleteAWorkspaceManagerMember(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .deleteWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", com.azure.core.util.Context.NONE); } } ``` -### AlertRules_List +### AutomationRules_Get ```java +import java.util.UUID; + /** - * Samples for AlertRules List. + * Samples for Reevaluate Recommendation. */ -public final class AlertRulesListSamples { +public final class ReevaluateRecommendationSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetAllAlertRules.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/ReevaluateRecommendation.json */ /** - * Sample code: Get all alert rules. + * Sample code: Reevaluate a recommendation. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAllAlertRules(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.alertRules().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + public static void + reevaluateARecommendation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.reevaluates() + .recommendationWithResponse("myRg", "myWorkspace", UUID.fromString("6d4b54eb-8684-4aa3-a156-3aa37b8014bc"), + com.azure.core.util.Context.NONE); } } ``` -### AutomationRules_CreateOrUpdate +### AutomationRules_List ```java -import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic; -import java.util.List; - /** - * Samples for AutomationRules CreateOrUpdate. + * Samples for WorkspaceManagerConfigurations Get. */ -public final class AutomationRulesCreateOrUpdateSamples { +public final class WorkspaceManagerConfigurationsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * automationRules/AutomationRules_CreateOrUpdate.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/GetWorkspaceManagerConfiguration.json */ /** - * Sample code: AutomationRules_CreateOrUpdate. + * Sample code: Get a workspace manager configuration. * * @param manager Entry point to SecurityInsightsManager. */ public static void - automationRulesCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.automationRules() - .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") - .withExistingWorkspace("myRg", "myWorkspace") - .withDisplayName((String) null) - .withOrder(0) - .withTriggeringLogic((AutomationRuleTriggeringLogic) null) - .withActions((List) null) - .create(); + getAWorkspaceManagerConfiguration(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .getWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); } } ``` -### AutomationRules_Delete +### BillingStatistics_Get ```java +import com.azure.resourcemanager.securityinsights.models.CountQuery; +import com.azure.resourcemanager.securityinsights.models.TiType; + /** - * Samples for AutomationRules Delete. + * Samples for ThreatIntelligence Count. */ -public final class AutomationRulesDeleteSamples { +public final class ThreatIntelligenceCountSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * automationRules/AutomationRules_Delete.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/PostThreatIntelligenceCount.json */ /** - * Sample code: AutomationRules_Delete. + * Sample code: Get TI object count. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - automationRulesDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.automationRules() - .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - com.azure.core.util.Context.NONE); + public static void getTIObjectCount(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligences() + .countWithResponse("myRg", "myWorkspace", TiType.MAIN, new CountQuery(), com.azure.core.util.Context.NONE); } } ``` -### AutomationRules_Get +### BillingStatistics_List ```java /** - * Samples for AutomationRules Get. + * Samples for ProductPackages List. */ -public final class AutomationRulesGetSamples { +public final class ProductPackagesListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * automationRules/AutomationRules_Get.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetProductPackages.json */ /** - * Sample code: AutomationRules_Get. + * Sample code: Get all available packages. * * @param manager Entry point to SecurityInsightsManager. */ - public static void automationRulesGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.automationRules() - .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - com.azure.core.util.Context.NONE); + public static void + getAllAvailablePackages(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productPackages() + .list("myRg", "myWorkspace", null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### AutomationRules_List +### BookmarkOperation_Expand ```java +import com.azure.resourcemanager.securityinsights.models.IncidentTaskStatus; + /** - * Samples for AutomationRules List. + * Samples for IncidentTasks CreateOrUpdate. */ -public final class AutomationRulesListSamples { +public final class IncidentTasksCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * automationRules/AutomationRules_List.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_CreateOrUpdate.json */ /** - * Sample code: AutomationRules_List. + * Sample code: IncidentTasks_CreateOrUpdate. * * @param manager Entry point to SecurityInsightsManager. */ - public static void automationRulesList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.automationRules().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + public static void + incidentTasksCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") + .withExistingIncident("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withTitle("Task title") + .withStatus(IncidentTaskStatus.NEW) + .withDescription("Task description") + .create(); } } ``` -### Bookmarks_CreateOrUpdate +### BookmarkRelations_CreateOrUpdate ```java -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.time.OffsetDateTime; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorModel; import java.util.Arrays; -import java.util.UUID; /** - * Samples for Bookmarks CreateOrUpdate. + * Samples for ThreatIntelligenceIndicator Create. */ -public final class BookmarksCreateOrUpdateSamples { +public final class ThreatIntelligenceIndicatorCreateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * CreateBookmark.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/UpdateThreatIntelligence.json */ /** - * Sample code: Creates or updates a bookmark. + * Sample code: Update a threat Intelligence indicator. * * @param manager Entry point to SecurityInsightsManager. */ public static void - createsOrUpdatesABookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.bookmarks() - .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") - .withExistingWorkspace("myRg", "myWorkspace") - .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withCreated(OffsetDateTime.parse("2019-01-01T13:15:30Z")) - .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) - .withDisplayName("My bookmark") - .withLabels(Arrays.asList("Tag1", "Tag2")) - .withNotes("Found a suspicious activity") - .withQuery("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)") - .withQueryResult("Security Event query result") - .withUpdated(OffsetDateTime.parse("2019-01-01T13:15:30Z")) - .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) - .create(); + updateAThreatIntelligenceIndicator(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicators() + .createWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + new ThreatIntelligenceIndicatorModel().withThreatIntelligenceTags(Arrays.asList("new schema")) + .withSource("Azure Sentinel") + .withDisplayName("new schema") + .withDescription("debugging indicators") + .withPattern("[url:value = 'https://www.contoso.com']") + .withPatternType("url") + .withKillChainPhases(Arrays.asList()) + .withCreatedByRef("contoso@contoso.com") + .withExternalReferences(Arrays.asList()) + .withGranularMarkings(Arrays.asList()) + .withLabels(Arrays.asList()) + .withRevoked(false) + .withConfidence(78) + .withThreatTypes(Arrays.asList("compromised")) + .withValidFrom("2020-04-15T17:44:00.114052Z") + .withValidUntil("") + .withModified(""), + com.azure.core.util.Context.NONE); } } ``` -### Bookmarks_Delete +### BookmarkRelations_Delete ```java /** - * Samples for Bookmarks Delete. + * Samples for WorkspaceManagerGroups Get. */ -public final class BookmarksDeleteSamples { +public final class WorkspaceManagerGroupsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * DeleteBookmark.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/GetWorkspaceManagerGroup.json */ /** - * Sample code: Delete a bookmark. + * Sample code: Get a workspace manager group. * * @param manager Entry point to SecurityInsightsManager. */ - public static void deleteABookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.bookmarks() - .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + public static void + getAWorkspaceManagerGroup(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .getWithResponse("myRg", "myWorkspace", "37207a7a-3b8a-438f-a559-c7df400e1b96", com.azure.core.util.Context.NONE); } } ``` -### Bookmarks_Get +### BookmarkRelations_Get ```java /** - * Samples for Bookmarks Get. + * Samples for Watchlists Delete. */ -public final class BookmarksGetSamples { +public final class WatchlistsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * GetBookmarkById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/DeleteWatchlist.json */ /** - * Sample code: Get a bookmark. + * Sample code: Delete a watchlist. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getABookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.bookmarks() - .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - com.azure.core.util.Context.NONE); + public static void deleteAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlists().delete("myRg", "myWorkspace", "highValueAsset", com.azure.core.util.Context.NONE); } } ``` -### Bookmarks_List +### BookmarkRelations_List ```java /** - * Samples for Bookmarks List. + * Samples for EntitiesRelations List. */ -public final class BookmarksListSamples { +public final class EntitiesRelationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * GetBookmarks.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/relations/GetAllEntityRelations.json */ /** - * Sample code: Get all bookmarks. + * Sample code: Get all relations of an entity. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAllBookmarks(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.bookmarks().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + public static void + getAllRelationsOfAnEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entitiesRelations() + .list("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` -### DataConnectors_CreateOrUpdate +### Bookmarks_CreateOrUpdate ```java -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnector; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesExchange; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesSharePoint; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesTeams; -import com.azure.resourcemanager.securityinsights.models.TIDataConnector; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypesIndicators; -import java.time.OffsetDateTime; +import com.azure.resourcemanager.securityinsights.models.IngestionType; +import com.azure.resourcemanager.securityinsights.models.Log; +import com.azure.resourcemanager.securityinsights.models.LogStatusType; +import com.azure.resourcemanager.securityinsights.models.LogType; +import com.azure.resourcemanager.securityinsights.models.RfcConnector; +import com.azure.resourcemanager.securityinsights.models.SapAuthenticationType; +import com.azure.resourcemanager.securityinsights.models.SapSystemsConfiguration; +import com.azure.resourcemanager.securityinsights.models.SystemStatusType; +import java.util.Arrays; /** - * Samples for DataConnectors CreateOrUpdate. + * Samples for Systems CreateOrUpdate. */ -public final class DataConnectorsCreateOrUpdateSamples { +public final class SystemsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/CreateOfficeDataConnetor.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_CreateOrUpdate.json */ /** - * Sample code: Creates or updates an Office365 data connector. + * Sample code: Systems_CreateOrUpdate. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createsOrUpdatesAnOffice365DataConnector( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - new OfficeDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8") - .withDataTypes(new OfficeDataConnectorDataTypes() - .withExchange(new OfficeDataConnectorDataTypesExchange().withState(DataTypeState.ENABLED)) - .withSharePoint(new OfficeDataConnectorDataTypesSharePoint().withState(DataTypeState.ENABLED)) - .withTeams(new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.ENABLED))), - com.azure.core.util.Context.NONE); + public static void + systemsCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .define("3d69632b-0b60-4af3-8720-77f01a25d34a") + .withExistingBusinessApplicationAgent("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a") + .withConfiguration(new SapSystemsConfiguration().withAzureResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace") + .withConnector(new RfcConnector().withAbapServerHost("1.1.1.1") + .withSystemNumber("001") + .withSystemId("A4H") + .withClient("001") + .withAuthenticationType(SapAuthenticationType.USERNAME_PASSWORD)) + .withLogs(Arrays.asList( + new Log().withType(LogType.ABAP_AUDIT_LOG) + .withIngestionType(IngestionType.INCREMENTAL) + .withStatus(LogStatusType.ENABLED) + .withScheduleInterval(60) + .withBulkSize(100) + .withFilters(Arrays.asList("filter1", "filter2")), + new Log().withType(LogType.USR01) + .withIngestionType(IngestionType.INCREMENTAL) + .withStatus(LogStatusType.ENABLED) + .withScheduleInterval(60) + .withBulkSize(100) + .withFilters(Arrays.asList("filter1", "filter2"))))) + .withDisplayName("A4H_System") + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withStatus(SystemStatusType.RUNNING) + .create(); } +} +``` +### Bookmarks_Delete + +```java +/** + * Samples for WatchlistItems Get. + */ +public final class WatchlistItemsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/CreateThreatIntelligenceDataConnector.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlistItemById.json */ /** - * Sample code: Creates or updates an Threat Intelligence Platform data connector. + * Sample code: Get a watchlist item. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createsOrUpdatesAnThreatIntelligencePlatformDataConnector( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - new TIDataConnector().withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b") - .withTipLookbackPeriod(OffsetDateTime.parse("2020-01-01T13:00:30.123Z")) - .withDataTypes(new TIDataConnectorDataTypes() - .withIndicators(new TIDataConnectorDataTypesIndicators().withState(DataTypeState.ENABLED))), + public static void getAWatchlistItem(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlistItems() + .getWithResponse("myRg", "myWorkspace", "highValueAsset", "3f8901fe-63d9-4875-9ad5-9fb3b8105797", com.azure.core.util.Context.NONE); } } ``` -### DataConnectors_Delete +### Bookmarks_Get ```java /** - * Samples for DataConnectors Delete. + * Samples for WorkspaceManagerMembers List. */ -public final class DataConnectorsDeleteSamples { +public final class WorkspaceManagerMembersListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/DeleteOfficeDataConnetor.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/GetAllWorkspaceManagerMembers.json */ /** - * Sample code: Delete an Office365 data connector. + * Sample code: Get all workspace manager members. * * @param manager Entry point to SecurityInsightsManager. */ public static void - deleteAnOffice365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - com.azure.core.util.Context.NONE); + getAllWorkspaceManagerMembers(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); } } ``` -### DataConnectors_Get +### Bookmarks_List ```java /** - * Samples for DataConnectors Get. + * Samples for IncidentComments CreateOrUpdate. */ -public final class DataConnectorsGetSamples { +public final class IncidentCommentsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetAzureSecurityCenterById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_CreateOrUpdate.json */ /** - * Sample code: Get a ASC data connector. + * Sample code: IncidentComments_CreateOrUpdate. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAASCDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", - com.azure.core.util.Context.NONE); + incidentCommentsCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentComments() + .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") + .withExistingIncident("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withMessage("Some message") + .create(); } +} +``` - /* - * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetOfficeDataConnetorById.json - */ - /** - * Sample code: Get an Office365 data connector. - * - * @param manager Entry point to SecurityInsightsManager. - */ - public static void - getAnOffice365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - com.azure.core.util.Context.NONE); - } +### BusinessApplicationAgentOperation_Get +```java +/** + * Samples for AlertRuleTemplates List. + */ +public final class AlertRuleTemplatesListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetMicrosoftCloudAppSecurityById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRuleTemplates/GetAlertRuleTemplates.json */ /** - * Sample code: Get a MCAS data connector. + * Sample code: Get all alert rule templates. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAMCASDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "b96d014d-b5c2-4a01-9aba-a8058f629d42", - com.azure.core.util.Context.NONE); + getAllAlertRuleTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRuleTemplates().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); } +} +``` - /* - * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetAmazonWebServicesCloudTrailById.json - */ - /** - * Sample code: Get an AwsCloudTrail data connector. - * - * @param manager Entry point to SecurityInsightsManager. - */ - public static void - getAnAwsCloudTrailDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", - com.azure.core.util.Context.NONE); - } +### BusinessApplicationAgents_CreateOrUpdate +```java +/** + * Samples for HuntRelations Delete. + */ +public final class HuntRelationsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetAzureAdvancedThreatProtectionById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/DeleteHuntRelation.json */ /** - * Sample code: Get an AATP data connector. + * Sample code: Delete a hunt relation. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAnAATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "07e42cb3-e658-4e90-801c-efa0f29d3d44", - com.azure.core.util.Context.NONE); + public static void deleteAHuntRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .deleteWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c535096", com.azure.core.util.Context.NONE); } +} +``` - /* - * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json - */ - /** - * Sample code: Get a MDATP data connector. - * - * @param manager Entry point to SecurityInsightsManager. - */ - public static void - getAMDATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "06b3ccb8-1384-4bcc-aec7-852f6d57161b", - com.azure.core.util.Context.NONE); - } +### BusinessApplicationAgents_Delete +```java +/** + * Samples for Incidents Get. + */ +public final class IncidentsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetThreatIntelligenceById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_Get.json */ /** - * Sample code: Get a TI data connector. + * Sample code: Incidents_Get. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getATIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + public static void incidentsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } +} +``` + +### BusinessApplicationAgents_List +```java +/** + * Samples for Incidents Delete. + */ +public final class IncidentsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetAzureActiveDirectoryById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_Delete.json */ /** - * Sample code: Get an AAD data connector. + * Sample code: Incidents_Delete. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAnAADDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d", + public static void incidentsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } } ``` -### DataConnectors_List +### ContentPackageOperation_Install ```java /** - * Samples for DataConnectors List. + * Samples for ProductSettings Delete. */ -public final class DataConnectorsListSamples { +public final class ProductSettingsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetDataConnectors.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/DeleteEyesOnSetting.json */ /** - * Sample code: Get all data connectors. + * Sample code: Delete EyesOn settings. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAllDataConnectors(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.dataConnectors().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + deleteEyesOnSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings().deleteWithResponse("myRg", "myWorkspace", "EyesOn", com.azure.core.util.Context.NONE); } } ``` -### IncidentComments_CreateOrUpdate +### ContentPackageOperation_Uninstall ```java +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + /** - * Samples for IncidentComments CreateOrUpdate. + * Samples for EntityQueryTemplates List. */ -public final class IncidentCommentsCreateOrUpdateSamples { +public final class EntityQueryTemplatesListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/CreateIncidentComment.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueryTemplates/GetEntityQueryTemplates.json */ /** - * Sample code: Creates or updates an incident comment. + * Sample code: Get all entity query templates. * * @param manager Entry point to SecurityInsightsManager. */ public static void - createsOrUpdatesAnIncidentComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentComments() - .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") - .withExistingIncident("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5") - .withMessage("Some message") - .create(); + getAllEntityQueryTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueryTemplates() + .list("myRg", "myWorkspace", EntityQueryTemplateKind.ACTIVITY, com.azure.core.util.Context.NONE); } } ``` -### IncidentComments_Delete +### ContentPackages_Get ```java /** - * Samples for IncidentComments Delete. + * Samples for IncidentTasks List. */ -public final class IncidentCommentsDeleteSamples { +public final class IncidentTasksListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/DeleteIncidentComment.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_List.json */ /** - * Sample code: Delete the incident comment. + * Sample code: IncidentTasks_List. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - deleteTheIncidentComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentComments() - .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + public static void incidentTasksList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .list("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } } ``` -### IncidentComments_Get +### ContentPackages_List ```java /** - * Samples for IncidentComments Get. + * Samples for SecurityMLAnalyticsSettings Get. */ -public final class IncidentCommentsGetSamples { +public final class SecurityMLAnalyticsSettingsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/GetIncidentCommentById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json */ /** - * Sample code: Get an incident comment. + * Sample code: Get a Anomaly Security ML Analytics Settings. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAnIncidentComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentComments() - .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + public static void getAAnomalySecurityMLAnalyticsSettings( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.securityMLAnalyticsSettings() + .getWithResponse("myRg", "myWorkspace", "myFirstAnomalySettings", com.azure.core.util.Context.NONE); } } ``` -### IncidentComments_List +### ContentTemplateOperation_Delete ```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.Availability; +import com.azure.resourcemanager.securityinsights.models.AvailabilityStatus; +import com.azure.resourcemanager.securityinsights.models.CodelessApiPollingDataConnector; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingAuthProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingConfigProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingPagingProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingRequestProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingResponseProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesDataTypesItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesGraphQueriesItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesInstructionStepsItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesSampleQueriesItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiDataConnector; +import com.azure.resourcemanager.securityinsights.models.ConnectivityType; +import com.azure.resourcemanager.securityinsights.models.DataTypeState; +import com.azure.resourcemanager.securityinsights.models.DcrConfiguration; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnector; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities; +import com.azure.resourcemanager.securityinsights.models.GcpAuthProperties; +import com.azure.resourcemanager.securityinsights.models.GcpDataConnector; +import com.azure.resourcemanager.securityinsights.models.GcpRequestProperties; +import com.azure.resourcemanager.securityinsights.models.InstructionStepsInstructionsItem; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionDataConnector; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnector; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnector; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnectorDataTypesAlerts; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnectorDataTypesIncidents; +import com.azure.resourcemanager.securityinsights.models.MtpFilteredProviders; +import com.azure.resourcemanager.securityinsights.models.MtpProvider; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectDataConnector; +import com.azure.resourcemanager.securityinsights.models.OfficeDataConnector; +import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesExchange; +import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesSharePoint; +import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesTeams; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIDataConnector; +import com.azure.resourcemanager.securityinsights.models.PermissionProviderScope; +import com.azure.resourcemanager.securityinsights.models.Permissions; +import com.azure.resourcemanager.securityinsights.models.PermissionsCustomsItem; +import com.azure.resourcemanager.securityinsights.models.PermissionsResourceProviderItem; +import com.azure.resourcemanager.securityinsights.models.PollingFrequency; +import com.azure.resourcemanager.securityinsights.models.ProviderName; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditDataConnector; +import com.azure.resourcemanager.securityinsights.models.RequiredPermissions; +import com.azure.resourcemanager.securityinsights.models.SettingType; +import com.azure.resourcemanager.securityinsights.models.TIDataConnector; +import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypesIndicators; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnector; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnectorDataTypesTaxiiClient; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + /** - * Samples for IncidentComments List. + * Samples for DataConnectors CreateOrUpdate. */ -public final class IncidentCommentsListSamples { +public final class DataConnectorsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/GetAllIncidentComments.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateMicrosoftThreatProtectionDataConnetor.json */ /** - * Sample code: Get all incident comments. + * Sample code: Creates or updates a MicrosoftThreatProtection data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAllIncidentComments(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentComments() - .list("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", null, null, null, null, + public static void createsOrUpdatesAMicrosoftThreatProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new MtpDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new MtpDataConnectorDataTypes() + .withIncidents(new MtpDataConnectorDataTypesIncidents().withState(DataTypeState.DISABLED)) + .withAlerts(new MtpDataConnectorDataTypesAlerts().withState(DataTypeState.ENABLED))) + .withFilteredProviders(new MtpFilteredProviders() + .withAlerts(Arrays.asList(MtpProvider.MICROSOFT_DEFENDER_FOR_CLOUD_APPS))) + .withTenantId("178265c4-3136-4ff6-8ed1-b5b62b4cb5f5"), com.azure.core.util.Context.NONE); } -} -``` - -### IncidentRelations_CreateOrUpdate -```java -/** - * Samples for IncidentRelations CreateOrUpdate. - */ -public final class IncidentRelationsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/CreateIncidentRelation.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreatePurviewAuditDataConnector.json */ /** - * Sample code: Creates or updates an incident relation. + * Sample code: Creates or updates a PurviewAudit data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - createsOrUpdatesAnIncidentRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentRelations() - .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") - .withExistingIncident("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812") - .withRelatedResourceId( - "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096") - .create(); + public static void createsOrUpdatesAPurviewAuditDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new PurviewAuditDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withConnectorDefinitionName("PowerAutomate") + .withSourceType("MicrosoftFlow") + .withDcrConfig(new DcrConfiguration().withDataCollectionEndpoint( + "https://microsoft-sentinel-datacollectionendpoint-123m.westeurope-1.ingest.monitor.azure.com") + .withDataCollectionRuleImmutableId("dcr-de21b053bd5a44beb99a256c9db85023") + .withStreamName("OFFICEPOWERAUTOMATE_RESTAPI")) + .withDataTypes(new PurviewAuditConnectorDataTypes() + .withLogs(new PurviewAuditConnectorDataTypesLogs().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); } -} -``` - -### IncidentRelations_Delete -```java -/** - * Samples for IncidentRelations Delete. - */ -public final class IncidentRelationsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/DeleteIncidentRelation.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateDynamics365DataConnetor.json */ /** - * Sample code: Delete the incident relation. + * Sample code: Creates or updates a Dynamics365 data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - deleteTheIncidentRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentRelations() - .deleteWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + public static void createsOrUpdatesADynamics365DataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "c2541efb-c9a6-47fe-9501-87d1017d1512", + new Dynamics365DataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new Dynamics365DataConnectorDataTypes() + .withDynamics365CdsActivities(new Dynamics365DataConnectorDataTypesDynamics365CdsActivities() + .withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); } -} -``` - -### IncidentRelations_Get -```java -/** - * Samples for IncidentRelations Get. - */ -public final class IncidentRelationsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/GetIncidentRelationByName.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateGenericUI.json */ /** - * Sample code: Get an incident relation. + * Sample code: Creates or updates a GenericUI data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAnIncidentRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentRelations() - .getWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + public static void createsOrUpdatesAGenericUIDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new CodelessUiDataConnector().withConnectorUiConfig(new CodelessUiConnectorConfigProperties() + .withTitle("Qualys Vulnerability Management (CCP DEMO)") + .withPublisher("Qualys") + .withDescriptionMarkdown( + "The [Qualys Vulnerability Management (VM)](https://www.qualys.com/apps/vulnerability-management/) data connector provides the capability to ingest vulnerability host detection data into Azure Sentinel through the Qualys API. The connector provides visibility into host detection data from vulerability scans. This connector provides Azure Sentinel the capability to view dashboards, create custom alerts, and improve investigation ") + .withGraphQueriesTableName("QualysHostDetection_CL") + .withGraphQueries(Arrays.asList( + new CodelessUiConnectorConfigPropertiesGraphQueriesItem().withMetricName("Total data received") + .withLegend("{{graphQueriesTableName}}") + .withBaseQuery("{{graphQueriesTableName}}"))) + .withSampleQueries(Arrays.asList(new CodelessUiConnectorConfigPropertiesSampleQueriesItem() + .withDescription("Top 10 Vulerabilities detected") + .withQuery( + "{{graphQueriesTableName}}\n | mv-expand todynamic(Detections_s)\n | extend Vulnerability = tostring(Detections_s.Results)\n | summarize count() by Vulnerability\n | top 10 by count_"))) + .withDataTypes(Arrays.asList(new CodelessUiConnectorConfigPropertiesDataTypesItem() + .withName("{{graphQueriesTableName}}") + .withLastDataReceivedQuery( + "{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"))) + .withConnectivityCriteria( + Arrays.asList(new CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem() + .withType(ConnectivityType.IS_CONNECTED_QUERY) + .withValue(Arrays.asList( + "{{graphQueriesTableName}}\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)")))) + .withAvailability(new Availability().withStatus(AvailabilityStatus.ONE).withIsPreview(true)) + .withPermissions(new Permissions() + .withResourceProvider(Arrays.asList(new PermissionsResourceProviderItem() + .withProvider(ProviderName.MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES) + .withPermissionsDisplayText("read and write permissions on the workspace are required.") + .withProviderDisplayName("Workspace") + .withScope(PermissionProviderScope.WORKSPACE) + .withRequiredPermissions(new RequiredPermissions() + .withWrite(true) + .withRead(true) + .withDelete(true)), + new PermissionsResourceProviderItem() + .withProvider(ProviderName.MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES_SHARED_KEYS) + .withPermissionsDisplayText( + "read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key).") + .withProviderDisplayName("Keys") + .withScope(PermissionProviderScope.WORKSPACE) + .withRequiredPermissions(new RequiredPermissions().withAction(true)))) + .withCustoms(Arrays.asList(new PermissionsCustomsItem() + .withName("Microsoft.Web/sites permissions") + .withDescription( + "Read and write permissions to Azure Functions to create a Function App is required. [See the documentation to learn more about Azure Functions](https://docs.microsoft.com/azure/azure-functions/)."), + new PermissionsCustomsItem().withName("Qualys API Key") + .withDescription( + "A Qualys VM API username and password is required. [See the documentation to learn more about Qualys VM API](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf).")))) + .withInstructionSteps(Arrays.asList(new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("") + .withDescription( + ">**NOTE:** This connector uses Azure Functions to connect to Qualys VM to pull its logs into Azure Sentinel. This might result in additional data ingestion costs. Check the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/) for details."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + ">**(Optional Step)** Securely store workspace and API authorization key(s) or token(s) in Azure Key Vault. Azure Key Vault provides a secure mechanism to store and retrieve key values. [Follow these instructions](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) to use Azure Key Vault with an Azure Function App."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**STEP 1 - Configuration steps for the Qualys VM API**\n\n1. Log into the Qualys Vulnerability Management console with an administrator account, select the **Users** tab and the **Users** subtab. \n2. Click on the **New** drop-down menu and select **Users..**\n3. Create a username and password for the API account. \n4. In the **User Roles** tab, ensure the account role is set to **Manager** and access is allowed to **GUI** and **API**\n4. Log out of the administrator account and log into the console with the new API credentials for validation, then log out of the API account. \n5. Log back into the console using an administrator account and modify the API accounts User Roles, removing access to **GUI**. \n6. Save all changes."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**STEP 2 - Choose ONE from the following two deployment options to deploy the connector and the associated Azure Function**\n\n>**IMPORTANT:** Before deploying the Qualys VM connector, have the Workspace ID and Workspace Primary Key (can be copied from the following), as well as the Qualys VM API Authorization Key(s), readily available.") + .withInstructions(Arrays.asList( + new InstructionStepsInstructionsItem() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"fillWith\":[\"WorkspaceId\"],\"label\":\"Workspace ID\"}", + Object.class, SerializerEncoding.JSON)) + .withType(SettingType.COPYABLE_LABEL), + new InstructionStepsInstructionsItem() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"fillWith\":[\"PrimaryKey\"],\"label\":\"Primary Key\"}", + Object.class, SerializerEncoding.JSON)) + .withType(SettingType.COPYABLE_LABEL))), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("Option 1 - Azure Resource Manager (ARM) Template") + .withDescription( + "Use this method for automated deployment of the Qualys VM connector using an ARM Tempate.\n\n1. Click the **Deploy to Azure** button below. \n\n\t[![Deploy To Azure](https://aka.ms/deploytoazurebutton)](https://aka.ms/sentinelqualysvmazuredeploy)\n2. Select the preferred **Subscription**, **Resource Group** and **Location**. \n3. Enter the **Workspace ID**, **Workspace Key**, **API Username**, **API Password** , update the **URI**, and any additional URI **Filter Parameters** (each filter should be separated by an \"&\" symbol, no spaces.) \n> - Enter the URI that corresponds to your region. The complete list of API Server URLs can be [found here](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf#G4.735348) -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format. \n - The default **Time Interval** is set to pull the last five (5) minutes of data. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly (in the function.json file, post deployment) to prevent overlapping data ingestion. \n> - Note: If using Azure Key Vault secrets for any of the values above, use the`@Microsoft.KeyVault(SecretUri={Security Identifier})`schema in place of the string values. Refer to [Key Vault references documentation](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) for further details. \n4. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n5. Click **Purchase** to deploy."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("Option 2 - Manual Deployment of Azure Functions") + .withDescription( + "Use the following step-by-step instructions to deploy the Quayls VM connector manually with Azure Functions."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**1. Create a Function App**\n\n1. From the Azure Portal, navigate to [Function App](https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.Web%2Fsites/kind/functionapp), and select **+ Add**.\n2. In the **Basics** tab, ensure Runtime stack is set to **Powershell Core**. \n3. In the **Hosting** tab, ensure the **Consumption (Serverless)** plan type is selected.\n4. Make other preferrable configuration changes, if needed, then click **Create**."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**2. Import Function App Code**\n\n1. In the newly created Function App, select **Functions** on the left pane and click **+ New Function**.\n2. Select **Timer Trigger**.\n3. Enter a unique Function **Name** and leave the default cron schedule of every 5 minutes, then click **Create**.\n5. Click on **Code + Test** on the left pane. \n6. Copy the [Function App Code](https://aka.ms/sentinelqualysvmazurefunctioncode) and paste into the Function App `run.ps1` editor.\n7. Click **Save**."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**3. Configure the Function App**\n\n1. In the Function App, select the Function App Name and select **Configuration**.\n2. In the **Application settings** tab, select **+ New application setting**.\n3. Add each of the following seven (7) application settings individually, with their respective string values (case-sensitive): \n\t\tapiUsername\n\t\tapiPassword\n\t\tworkspaceID\n\t\tworkspaceKey\n\t\turi\n\t\tfilterParameters\n\t\ttimeInterval\n> - Enter the URI that corresponds to your region. The complete list of API Server URLs can be [found here](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf#G4.735348). The `uri` value must follow the following schema: `https:///api/2.0/fo/asset/host/vm/detection/?action=list&vm_processed_after=` -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format.\n> - Add any additional filter parameters, for the `filterParameters` variable, that need to be appended to the URI. Each parameter should be seperated by an \"&\" symbol and should not include any spaces.\n> - Set the `timeInterval` (in minutes) to the value of `5` to correspond to the Timer Trigger of every `5` minutes. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly to prevent overlapping data ingestion.\n> - Note: If using Azure Key Vault, use the`@Microsoft.KeyVault(SecretUri={Security Identifier})`schema in place of the string values. Refer to [Key Vault references documentation](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) for further details.\n4. Once all application settings have been entered, click **Save**."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**4. Configure the host.json**.\n\nDue to the potentially large amount of Qualys host detection data being ingested, it can cause the execution time to surpass the default Function App timeout of five (5) minutes. Increase the default timeout duration to the maximum of ten (10) minutes, under the Consumption Plan, to allow more time for the Function App to execute.\n\n1. In the Function App, select the Function App Name and select the **App Service Editor** blade.\n2. Click **Go** to open the editor, then select the **host.json** file under the **wwwroot** directory.\n3. Add the line `\"functionTimeout\": \"00:10:00\",` above the `managedDependancy` line \n4. Ensure **SAVED** appears on the top right corner of the editor, then exit the editor.\n\n> NOTE: If a longer timeout duration is required, consider upgrading to an [App Service Plan](https://docs.microsoft.com/azure/azure-functions/functions-scale#timeout)")))), + com.azure.core.util.Context.NONE); } -} -``` - -### IncidentRelations_List -```java -/** - * Samples for IncidentRelations List. - */ -public final class IncidentRelationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/GetAllIncidentRelations.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateOffice365ProjectDataConnetor.json */ /** - * Sample code: Get all incident relations. + * Sample code: Creates or updates an Office365 Project data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAllIncidentRelations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidentRelations() - .list("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", null, null, null, null, + public static void createsOrUpdatesAnOffice365ProjectDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new Office365ProjectDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new Office365ProjectConnectorDataTypes() + .withLogs(new Office365ProjectConnectorDataTypesLogs().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), com.azure.core.util.Context.NONE); } -} -``` - -### Incidents_CreateOrUpdate - -```java -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import java.time.OffsetDateTime; -import java.util.UUID; -/** - * Samples for Incidents CreateOrUpdate. - */ -public final class IncidentsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * CreateIncident.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateGoogleCloudPlatform.json */ /** - * Sample code: Creates or updates an incident. + * Sample code: Creates or updates a GCP data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - createsOrUpdatesAnIncident(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidents() - .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") - .withExistingWorkspace("myRg", "myWorkspace") - .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withClassification(IncidentClassification.FALSE_POSITIVE) - .withClassificationComment("Not a malicious activity") - .withClassificationReason(IncidentClassificationReason.INCORRECT_ALERT_LOGIC) - .withDescription("This is a demo incident") - .withFirstActivityTimeUtc(OffsetDateTime.parse("2019-01-01T13:00:30Z")) - .withLastActivityTimeUtc(OffsetDateTime.parse("2019-01-01T13:05:30Z")) - .withOwner(new IncidentOwnerInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) - .withSeverity(IncidentSeverity.HIGH) - .withStatus(IncidentStatus.CLOSED) - .withTitle("My incident") - .create(); + createsOrUpdatesAGCPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + new GcpDataConnector().withConnectorDefinitionName("GcpConnector") + .withAuth(new GcpAuthProperties() + .withServiceAccountEmail("sentinel-service-account@project-id.iam.gserviceaccount.com") + .withProjectNumber("123456789012") + .withWorkloadIdentityProviderId("sentinel-identity-provider")) + .withRequest(new GcpRequestProperties().withProjectId("project-id") + .withSubscriptionNames(Arrays.asList("sentinel-subscription"))) + .withDcrConfig(new DcrConfiguration().withDataCollectionEndpoint( + "https://microsoft-sentinel-datacollectionendpoint-123m.westeurope-1.ingest.monitor.azure.com") + .withDataCollectionRuleImmutableId("dcr-de21b053bd5a44beb99a256c9db85023") + .withStreamName("SENTINEL_GCP_AUDIT_LOGS")), + com.azure.core.util.Context.NONE); } -} -``` - -### Incidents_Delete -```java -/** - * Samples for Incidents Delete. - */ -public final class IncidentsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * DeleteIncident.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateMicrosoftThreatIntelligenceDataConnector.json */ /** - * Sample code: Delete an incident. + * Sample code: Creates or updates a Microsoft Threat Intelligence data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void deleteAnIncident(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidents() - .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + public static void createsOrUpdatesAMicrosoftThreatIntelligenceDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + new MstiDataConnector() + .withDataTypes(new MstiDataConnectorDataTypes().withMicrosoftEmergingThreatFeed( + new MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed().withState(DataTypeState.ENABLED) + .withLookbackPeriod("1970-01-01T00:00:00.000Z"))) + .withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), com.azure.core.util.Context.NONE); } -} -``` -### Incidents_Get - -```java -/** - * Samples for Incidents Get. - */ -public final class IncidentsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetIncidentById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateMicrosoftPurviewInformationProtectionDataConnetor.json */ /** - * Sample code: Get an incident. + * Sample code: Creates or updates an MicrosoftPurviewInformationProtection data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAnIncident(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidents() - .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + public static void createsOrUpdatesAnMicrosoftPurviewInformationProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new MicrosoftPurviewInformationProtectionDataConnector() + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new MicrosoftPurviewInformationProtectionConnectorDataTypes() + .withLogs(new MicrosoftPurviewInformationProtectionConnectorDataTypesLogs() + .withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), com.azure.core.util.Context.NONE); } -} -``` - -### Incidents_List -```java -/** - * Samples for Incidents List. - */ -public final class IncidentsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetIncidents.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateOfficeDataConnetor.json */ /** - * Sample code: Get all incidents. + * Sample code: Creates or updates an Office365 data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAllIncidents(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidents() - .list("myRg", "myWorkspace", null, "properties/createdTimeUtc desc", 1, null, + public static void createsOrUpdatesAnOffice365DataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new OfficeDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new OfficeDataConnectorDataTypes() + .withExchange(new OfficeDataConnectorDataTypesExchange().withState(DataTypeState.ENABLED)) + .withSharePoint(new OfficeDataConnectorDataTypesSharePoint().withState(DataTypeState.ENABLED)) + .withTeams(new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), com.azure.core.util.Context.NONE); } -} -``` - -### Incidents_ListAlerts -```java -/** - * Samples for Incidents ListAlerts. - */ -public final class IncidentsListAlertsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetAllIncidentAlerts.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateOfficePowerBIDataConnector.json */ /** - * Sample code: Get all incident alerts. + * Sample code: Creates or updates an Office PowerBI data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAllIncidentAlerts(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidents() - .listAlertsWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + public static void createsOrUpdatesAnOfficePowerBIDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new OfficePowerBIDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new OfficePowerBIConnectorDataTypes() + .withLogs(new OfficePowerBIConnectorDataTypesLogs().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), com.azure.core.util.Context.NONE); } -} -``` - -### Incidents_ListBookmarks -```java -/** - * Samples for Incidents ListBookmarks. - */ -public final class IncidentsListBookmarksSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetAllIncidentBookmarks.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateThreatIntelligenceTaxiiDataConnector.json */ /** - * Sample code: Get all incident bookmarks. + * Sample code: Creates or updates a Threat Intelligence Taxii data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAllIncidentBookmarks(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidents() - .listBookmarksWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + public static void createsOrUpdatesAThreatIntelligenceTaxiiDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new TiTaxiiDataConnector().withEtag("d12423f6-a60b-4ca5-88c0-feb1a182d0f0") + .withWorkspaceId("dd124572-4962-4495-9bd2-9dade12314b4") + .withFriendlyName("testTaxii") + .withTaxiiServer("https://limo.anomali.com/api/v1/taxii2/feeds") + .withCollectionId("135") + .withUsername("--") + .withPassword("fakeTokenPlaceholder") + .withTaxiiLookbackPeriod(OffsetDateTime.parse("2020-01-01T13:00:30.123Z")) + .withPollingFrequency(PollingFrequency.ONCE_ADAY) + .withDataTypes(new TiTaxiiDataConnectorDataTypes().withTaxiiClient( + new TiTaxiiDataConnectorDataTypesTaxiiClient().withState(DataTypeState.ENABLED))) + .withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), com.azure.core.util.Context.NONE); } -} -``` - -### Incidents_ListEntities -```java -/** - * Samples for Incidents ListEntities. - */ -public final class IncidentsListEntitiesSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetAllIncidentEntities.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateThreatIntelligenceDataConnector.json */ /** - * Sample code: Gets all incident related entities. + * Sample code: Creates or updates an Threat Intelligence Platform data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getsAllIncidentRelatedEntities(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.incidents() - .listEntitiesWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + public static void createsOrUpdatesAnThreatIntelligencePlatformDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new TIDataConnector().withTipLookbackPeriod(OffsetDateTime.parse("2020-01-01T13:00:30.123Z")) + .withDataTypes(new TIDataConnectorDataTypes() + .withIndicators(new TIDataConnectorDataTypesIndicators().withState(DataTypeState.ENABLED))) + .withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), com.azure.core.util.Context.NONE); } -} -``` - -### Operations_List -```java -/** - * Samples for Operations List. - */ -public final class OperationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/operations/ - * ListOperations.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateAPIPolling.json */ /** - * Sample code: Get all operations. + * Sample code: Creates or updates a APIPolling data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAllOperations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); + public static void createsOrUpdatesAAPIPollingDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new CodelessApiPollingDataConnector().withConnectorUiConfig(new CodelessUiConnectorConfigProperties() + .withTitle("GitHub Enterprise Audit Log") + .withPublisher("GitHub") + .withDescriptionMarkdown( + "The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process.") + .withGraphQueriesTableName("GitHubAuditLogPolling_CL") + .withGraphQueries(Arrays.asList(new CodelessUiConnectorConfigPropertiesGraphQueriesItem() + .withMetricName("Total events received") + .withLegend("GitHub audit log events") + .withBaseQuery("{{graphQueriesTableName}}"))) + .withSampleQueries(Arrays + .asList(new CodelessUiConnectorConfigPropertiesSampleQueriesItem().withDescription("All logs") + .withQuery("{{graphQueriesTableName}}\n | take 10 "))) + .withDataTypes(Arrays.asList(new CodelessUiConnectorConfigPropertiesDataTypesItem() + .withName("{{graphQueriesTableName}}") + .withLastDataReceivedQuery( + "{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"))) + .withConnectivityCriteria( + Arrays.asList(new CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem() + .withType(ConnectivityType.fromString("SentinelKindsV2")) + .withValue(Arrays.asList()))) + .withAvailability(new Availability().withStatus(AvailabilityStatus.ONE).withIsPreview(true)) + .withPermissions( + new Permissions() + .withResourceProvider(Arrays.asList(new PermissionsResourceProviderItem() + .withProvider(ProviderName.MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES) + .withPermissionsDisplayText("read and write permissions are required.") + .withProviderDisplayName("Workspace") + .withScope(PermissionProviderScope.WORKSPACE) + .withRequiredPermissions(new RequiredPermissions() + .withWrite(true) + .withRead(true) + .withDelete(true)))) + .withCustoms(Arrays.asList(new PermissionsCustomsItem() + .withName("GitHub API personal token Key") + .withDescription( + "You need access to GitHub personal token, the key should have 'admin:org' scope")))) + .withInstructionSteps(Arrays.asList(new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("Connect GitHub Enterprise Audit Log to Azure Sentinel") + .withDescription( + "Enable GitHub audit Logs. \n Follow [this](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create or find your personal key") + .withInstructions(Arrays.asList(new InstructionStepsInstructionsItem() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"enable\":\"true\",\"userRequestPlaceHoldersInput\":[{\"displayText\":\"Organization Name\",\"placeHolderName\":\"{{placeHolder1}}\",\"placeHolderValue\":\"\",\"requestObjectKey\":\"apiEndpoint\"}]}", + Object.class, SerializerEncoding.JSON)) + .withType(SettingType.fromString("APIKey"))))))) + .withPollingConfig(new CodelessConnectorPollingConfigProperties() + .withAuth(new CodelessConnectorPollingAuthProperties().withAuthType("APIKey") + .withApiKeyName("fakeTokenPlaceholder") + .withApiKeyIdentifier("fakeTokenPlaceholder")) + .withRequest(new CodelessConnectorPollingRequestProperties() + .withApiEndpoint("https://api.github.com/organizations/{{placeHolder1}}/audit-log") + .withRateLimitQps(50) + .withQueryWindowInMin(15) + .withHttpMethod("Get") + .withQueryTimeFormat("yyyy-MM-ddTHH:mm:ssZ") + .withRetryCount(2) + .withTimeoutInSeconds(60) + .withHeaders(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"Accept\":\"application/json\",\"User-Agent\":\"Scuba\"}", Object.class, + SerializerEncoding.JSON)) + .withQueryParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"phrase\":\"created:{_QueryWindowStartTime}..{_QueryWindowEndTime}\"}", + Object.class, SerializerEncoding.JSON))) + .withPaging(new CodelessConnectorPollingPagingProperties().withPagingType("LinkHeader") + .withPageSizeParaName("per_page")) + .withResponse( + new CodelessConnectorPollingResponseProperties().withEventsJsonPaths(Arrays.asList("$")))), + com.azure.core.util.Context.NONE); } } ``` -### SecurityMLAnalyticsSettings_CreateOrUpdate +### ContentTemplateOperation_Get ```java -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.securityinsights.models.AnomalySecurityMLAnalyticsSettings; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettingsDataSource; -import com.azure.resourcemanager.securityinsights.models.SettingsStatus; -import java.io.IOException; -import java.time.Duration; -import java.util.Arrays; -import java.util.UUID; - /** - * Samples for SecurityMLAnalyticsSettings CreateOrUpdate. + * Samples for Incidents List. */ -public final class SecurityMLAnalyticsSettingsCreateOrUpdateSamples { +public final class IncidentsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * securityMLAnalyticsSettings/CreateAnomalySecurityMLAnalyticsSetting.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_List.json */ /** - * Sample code: Creates or updates a Anomaly Security ML Analytics Settings. + * Sample code: Incidents_List. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createsOrUpdatesAAnomalySecurityMLAnalyticsSettings( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { - manager.securityMLAnalyticsSettings() - .createOrUpdateWithResponse("myRg", "myWorkspace", "f209187f-1d17-4431-94af-c141bf5f23db", - new AnomalySecurityMLAnalyticsSettings().withEtag("\"260090e2-0000-0d00-0000-5d6fb8670000\"") - .withDescription( - "When account logs from a source region that has rarely been logged in from during the last 14 days, an anomaly is triggered.") - .withDisplayName("Login from unusual region") - .withEnabled(true) - .withRequiredDataConnectors( - Arrays.asList(new SecurityMLAnalyticsSettingsDataSource().withConnectorId("AWS") - .withDataTypes(Arrays.asList("AWSCloudTrail")))) - .withTactics(Arrays.asList(AttackTactic.EXFILTRATION, AttackTactic.COMMAND_AND_CONTROL)) - .withTechniques(Arrays.asList("T1037", "T1021")) - .withAnomalyVersion("1.0.5") - .withCustomizableObservations(SerializerFactory.createDefaultManagementSerializerAdapter() - .deserialize( - "{\"multiSelectObservations\":null,\"prioritizeExcludeObservations\":null,\"singleSelectObservations\":[{\"name\":\"Device vendor\",\"description\":\"Select device vendor of network connection logs from CommonSecurityLog\",\"rerun\":\"RerunAlways\",\"sequenceNumber\":1,\"supportedValues\":[\"Palo Alto Networks\",\"Fortinet\",\"Check Point\"],\"supportedValuesKql\":null,\"value\":[\"Palo Alto Networks\"],\"valuesKql\":null}],\"singleValueObservations\":null,\"thresholdObservations\":[{\"name\":\"Daily data transfer threshold in MB\",\"description\":\"Suppress anomalies when daily data transfered (in MB) per hour is less than the chosen value\",\"maximum\":\"100\",\"minimum\":\"1\",\"rerun\":\"RerunAlways\",\"sequenceNumber\":1,\"value\":\"25\"},{\"name\":\"Number of standard deviations\",\"description\":\"Triggers anomalies when number of standard deviations is greater than the chosen value\",\"maximum\":\"10\",\"minimum\":\"2\",\"rerun\":\"RerunAlways\",\"sequenceNumber\":2,\"value\":\"3\"}]}", - Object.class, SerializerEncoding.JSON)) - .withFrequency(Duration.parse("PT1H")) - .withSettingsStatus(SettingsStatus.PRODUCTION) - .withIsDefaultSettings(true) - .withAnomalySettingsVersion(0) - .withSettingsDefinitionId(UUID.fromString("f209187f-1d17-4431-94af-c141bf5f23db")), + public static void incidentsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .list("myRg", "myWorkspace", null, "properties/createdTimeUtc desc", 1, null, com.azure.core.util.Context.NONE); } } ``` -### SecurityMLAnalyticsSettings_Delete +### ContentTemplateOperation_Install ```java /** - * Samples for SecurityMLAnalyticsSettings Delete. + * Samples for DataConnectors Delete. */ -public final class SecurityMLAnalyticsSettingsDeleteSamples { +public final class DataConnectorsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteOffice365ProjectDataConnetor.json */ /** - * Sample code: Delete a Security ML Analytics Settings. + * Sample code: Delete an Office365 Project data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - deleteASecurityMLAnalyticsSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.securityMLAnalyticsSettings() - .deleteWithResponse("myRg", "myWorkspace", "f209187f-1d17-4431-94af-c141bf5f23db", + public static void deleteAnOffice365ProjectDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } -} -``` - -### SecurityMLAnalyticsSettings_Get -```java -/** - * Samples for SecurityMLAnalyticsSettings Get. - */ -public final class SecurityMLAnalyticsSettingsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteMicrosoftPurviewInformationProtectionDataConnetor.json */ /** - * Sample code: Get a Anomaly Security ML Analytics Settings. + * Sample code: Delete an MicrosoftPurviewInformationProtection data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAAnomalySecurityMLAnalyticsSettings( + public static void deleteAnMicrosoftPurviewInformationProtectionDataConnector( com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.securityMLAnalyticsSettings() - .getWithResponse("myRg", "myWorkspace", "myFirstAnomalySettings", com.azure.core.util.Context.NONE); + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); } -} -``` - -### SecurityMLAnalyticsSettings_List -```java -/** - * Samples for SecurityMLAnalyticsSettings List. - */ -public final class SecurityMLAnalyticsSettingsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteGoogleCloudPlatform.json */ /** - * Sample code: Get all Security ML Analytics Settings. + * Sample code: Delete a GCP data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAllSecurityMLAnalyticsSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.securityMLAnalyticsSettings().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + deleteAGCPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + com.azure.core.util.Context.NONE); } -} -``` - -### SentinelOnboardingStates_Create -```java -/** - * Samples for SentinelOnboardingStates Create. - */ -public final class SentinelOnboardingStatesCreateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * onboardingStates/CreateSentinelOnboardingState.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteGenericUI.json */ /** - * Sample code: Create Sentinel onboarding state. + * Sample code: Delete a GenericUI data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - createSentinelOnboardingState(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.sentinelOnboardingStates() - .define("default") - .withExistingWorkspace("myRg", "myWorkspace") - .withCustomerManagedKey(false) - .create(); + deleteAGenericUIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); } -} + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteOfficeDataConnetor.json + */ + /** + * Sample code: Delete an Office365 data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAnOffice365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeletePurviewAuditDataConnector.json + */ + /** + * Sample code: Delete a PurviewAudit data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAPurviewAuditDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteOfficePowerBIDataConnetor.json + */ + /** + * Sample code: Delete an Office PowerBI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAnOfficePowerBIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteAPIPolling.json + */ + /** + * Sample code: Delete a APIPolling data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAAPIPollingDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteMicrosoftThreatIntelligenceDataConnector.json + */ + /** + * Sample code: Delete an MicrosoftThreatIntelligence data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAnMicrosoftThreatIntelligenceDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } +} ``` -### SentinelOnboardingStates_Delete +### ContentTemplates_List ```java /** - * Samples for SentinelOnboardingStates Delete. + * Samples for Actions Delete. */ -public final class SentinelOnboardingStatesDeleteSamples { +public final class ActionsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * onboardingStates/DeleteSentinelOnboardingState.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/DeleteActionOfAlertRule.json */ /** - * Sample code: Delete Sentinel onboarding state. + * Sample code: Delete an action of alert rule. * * @param manager Entry point to SecurityInsightsManager. */ public static void - deleteSentinelOnboardingState(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.sentinelOnboardingStates() - .deleteWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); + deleteAnActionOfAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.actions() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "912bec42-cb66-4c03-ac63-1761b6898c3e", com.azure.core.util.Context.NONE); } } ``` -### SentinelOnboardingStates_Get +### DataConnectorDefinitions_CreateOrUpdate ```java /** - * Samples for SentinelOnboardingStates Get. + * Samples for IncidentComments List. */ -public final class SentinelOnboardingStatesGetSamples { +public final class IncidentCommentsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * onboardingStates/GetSentinelOnboardingState.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_List.json */ /** - * Sample code: Get Sentinel onboarding state. + * Sample code: IncidentComments_List. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getSentinelOnboardingState(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.sentinelOnboardingStates() - .getWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); + incidentCommentsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentComments() + .list("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` -### SentinelOnboardingStates_List +### DataConnectorDefinitions_Delete ```java +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandParameters; +import java.time.OffsetDateTime; +import java.util.UUID; + /** - * Samples for SentinelOnboardingStates List. + * Samples for BookmarkOperation Expand. */ -public final class SentinelOnboardingStatesListSamples { +public final class BookmarkOperationExpandSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * onboardingStates/GetAllSentinelOnboardingStates.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/expand/PostExpandBookmark.json */ /** - * Sample code: Get all Sentinel onboarding states. + * Sample code: Expand an bookmark. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAllSentinelOnboardingStates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.sentinelOnboardingStates().listWithResponse("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + public static void expandAnBookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkOperations() + .expandWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new BookmarkExpandParameters().withEndTime(OffsetDateTime.parse("2020-01-24T17:21:00.000Z")) + .withExpansionId(UUID.fromString("27f76e63-c41b-480f-bb18-12ad2e011d49")) + .withStartTime(OffsetDateTime.parse("2019-12-25T17:21:00.000Z")), + com.azure.core.util.Context.NONE); } } ``` -### ThreatIntelligenceIndicator_AppendTags +### DataConnectorDefinitions_Get ```java -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceAppendTags; -import java.util.Arrays; - /** - * Samples for ThreatIntelligenceIndicator AppendTags. + * Samples for HuntRelations List. */ -public final class ThreatIntelligenceIndicatorAppendTagsSamples { +public final class HuntRelationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/AppendTagsThreatIntelligence.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntRelations.json */ /** - * Sample code: Append tags to a threat intelligence indicator. + * Sample code: Get all hunt relations. * * @param manager Entry point to SecurityInsightsManager. */ - public static void appendTagsToAThreatIntelligenceIndicator( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicators() - .appendTagsWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - new ThreatIntelligenceAppendTags().withThreatIntelligenceTags(Arrays.asList("tag1", "tag2")), + public static void getAllHuntRelations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .list("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### ThreatIntelligenceIndicator_Create +### DataConnectorDefinitions_List ```java -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorModel; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.BookmarkEntityMappings; +import com.azure.resourcemanager.securityinsights.models.EntityFieldMapping; +import com.azure.resourcemanager.securityinsights.models.UserInfo; +import java.time.OffsetDateTime; import java.util.Arrays; +import java.util.UUID; /** - * Samples for ThreatIntelligenceIndicator Create. + * Samples for Bookmarks CreateOrUpdate. */ -public final class ThreatIntelligenceIndicatorCreateSamples { +public final class BookmarksCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/UpdateThreatIntelligence.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/CreateBookmark.json */ /** - * Sample code: Update a threat Intelligence indicator. + * Sample code: Creates or updates a bookmark. * * @param manager Entry point to SecurityInsightsManager. */ public static void - updateAThreatIntelligenceIndicator(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicators() - .createWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - new ThreatIntelligenceIndicatorModel().withThreatIntelligenceTags(Arrays.asList("new schema")) - .withSource("Azure Sentinel") - .withDisplayName("new schema") - .withDescription("debugging indicators") - .withPattern("[url:value = 'https://www.contoso.com']") - .withPatternType("url") - .withKillChainPhases(Arrays.asList()) - .withCreatedByRef("contoso@contoso.com") - .withExternalReferences(Arrays.asList()) - .withGranularMarkings(Arrays.asList()) - .withLabels(Arrays.asList()) - .withRevoked(false) - .withConfidence(78) - .withThreatTypes(Arrays.asList("compromised")) - .withValidFrom("2020-04-15T17:44:00.114052Z") - .withValidUntil("") - .withModified(""), - com.azure.core.util.Context.NONE); + createsOrUpdatesABookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarks() + .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withExistingWorkspace("myRg", "myWorkspace") + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withCreated(OffsetDateTime.parse("2021-09-01T13:15:30Z")) + .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) + .withDisplayName("My bookmark") + .withLabels(Arrays.asList("Tag1", "Tag2")) + .withNotes("Found a suspicious activity") + .withQuery("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)") + .withQueryResult("Security Event query result") + .withUpdated(OffsetDateTime.parse("2021-09-01T13:15:30Z")) + .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) + .withEntityMappings(Arrays.asList(new BookmarkEntityMappings().withEntityType("Account") + .withFieldMappings(Arrays + .asList(new EntityFieldMapping().withIdentifier("Fullname").withValue("johndoe@microsoft.com"))))) + .withTactics(Arrays.asList(AttackTactic.EXECUTION)) + .withTechniques(Arrays.asList("T1609")) + .create(); } } ``` -### ThreatIntelligenceIndicator_CreateIndicator +### DataConnectors_Connect ```java -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorModel; -import java.util.Arrays; +/** + * Samples for Bookmarks List. + */ +public final class BookmarksListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/GetBookmarks.json + */ + /** + * Sample code: Get all bookmarks. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllBookmarks(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarks().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### DataConnectors_CreateOrUpdate +```java /** - * Samples for ThreatIntelligenceIndicator CreateIndicator. + * Samples for BookmarkRelations CreateOrUpdate. */ -public final class ThreatIntelligenceIndicatorCreateIndicatorSamples { +public final class BookmarkRelationsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/CreateThreatIntelligence.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/CreateBookmarkRelation.json */ /** - * Sample code: Create a new Threat Intelligence. + * Sample code: Creates or updates a bookmark relation. * * @param manager Entry point to SecurityInsightsManager. */ public static void - createANewThreatIntelligence(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicators() - .createIndicatorWithResponse("myRg", "myWorkspace", - new ThreatIntelligenceIndicatorModel().withThreatIntelligenceTags(Arrays.asList("new schema")) - .withSource("Azure Sentinel") - .withDisplayName("new schema") - .withDescription("debugging indicators") - .withPattern("[url:value = 'https://www.contoso.com']") - .withPatternType("url") - .withKillChainPhases(Arrays.asList()) - .withCreatedByRef("contoso@contoso.com") - .withExternalReferences(Arrays.asList()) - .withGranularMarkings(Arrays.asList()) - .withLabels(Arrays.asList()) - .withRevoked(false) - .withConfidence(78) - .withThreatTypes(Arrays.asList("compromised")) - .withValidFrom("2020-04-15T17:44:00.114052Z") - .withValidUntil("") - .withModified(""), - com.azure.core.util.Context.NONE); + createsOrUpdatesABookmarkRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") + .withExistingBookmark("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096") + .withRelatedResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812") + .create(); } } ``` -### ThreatIntelligenceIndicator_Delete +### DataConnectors_Delete ```java /** - * Samples for ThreatIntelligenceIndicator Delete. + * Samples for FileImports Delete. */ -public final class ThreatIntelligenceIndicatorDeleteSamples { +public final class FileImportsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/DeleteThreatIntelligence.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/DeleteFileImport.json */ /** - * Sample code: Delete a threat intelligence indicator. + * Sample code: Delete a file import. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - deleteAThreatIntelligenceIndicator(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicators() - .deleteWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - com.azure.core.util.Context.NONE); + public static void deleteAFileImport(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .delete("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } } ``` -### ThreatIntelligenceIndicator_Get +### DataConnectors_Disconnect ```java /** - * Samples for ThreatIntelligenceIndicator Get. + * Samples for Systems ListActions. */ -public final class ThreatIntelligenceIndicatorGetSamples { +public final class SystemsListActionsSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/actions/ListActions.json + */ + /** + * Sample code: ListActions. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void listActions(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .listActions("myRg", "myWorkspace", "247b377a-7137-4b3c-bf15-df1d3260ef1b", + "3d69632b-0b60-4af3-8720-77f01a25d34a", com.azure.core.util.Context.NONE); + } +} +``` + +### DataConnectors_Get + +```java +/** + * Samples for WorkspaceManagerGroups Delete. + */ +public final class WorkspaceManagerGroupsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/DeleteWorkspaceManagerGroup.json + */ + /** + * Sample code: Delete a workspace manager group. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWorkspaceManagerGroup(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .deleteWithResponse("myRg", "myWorkspace", "37207a7a-3b8a-438f-a559-c7df400e1b96", + com.azure.core.util.Context.NONE); + } +} +``` + +### DataConnectors_List + +```java +/** + * Samples for DataConnectorDefinitions Get. + */ +public final class DataConnectorDefinitionsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/GetCustomizableDataConnectorDefinitionById.json + */ + /** + * Sample code: Get customize data connector definition. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getCustomizeDataConnectorDefinition( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorDefinitions() + .getWithResponse("myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", + com.azure.core.util.Context.NONE); + } +} +``` + +### DataConnectorsCheckRequirementsOperation_Post + +```java +/** + * Samples for HuntRelations Get. + */ +public final class HuntRelationsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntRelationById.json + */ + /** + * Sample code: Get a hunt relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAHuntRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .getWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c535096", com.azure.core.util.Context.NONE); + } +} +``` + +### Entities_Expand + +```java +/** + * Samples for WorkspaceManagerAssignmentJobs Delete. + */ +public final class WorkspaceManagerAssignmentJobsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/DeleteJob.json + */ + /** + * Sample code: Delete a workspace manager job. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWorkspaceManagerJob(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignmentJobs() + .deleteWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + "cfbe1338-8276-4d5d-8b96-931117f9fa0e", com.azure.core.util.Context.NONE); + } +} +``` + +### Entities_Get + +```java +/** + * Samples for BusinessApplicationAgents List. + */ +public final class BusinessApplicationAgentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgents_List.json + */ + /** + * Sample code: BusinessApplicationAgents_List. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + businessApplicationAgentsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgents().list("myRg", "myWorkspace", null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Entities_GetInsights + +```java +/** + * Samples for WorkspaceManagerMembers Get. + */ +public final class WorkspaceManagerMembersGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/GetWorkspaceManagerMember.json + */ + /** + * Sample code: Get a workspace manager member. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerMember(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .getWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + com.azure.core.util.Context.NONE); + } +} +``` + +### Entities_List + +```java +/** + * Samples for BillingStatistics Get. + */ +public final class BillingStatisticsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * billingStatistics/GetBillingStatistic.json + */ + /** + * Sample code: Get a billing statistic. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getABillingStatistic(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.billingStatistics() + .getWithResponse("myRg", "myWorkspace", "sapSolutionUsage", com.azure.core.util.Context.NONE); + } +} +``` + +### Entities_Queries + +```java +/** + * Samples for IncidentTasks Get. + */ +public final class IncidentTasksGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_Get.json + */ + /** + * Sample code: IncidentTasks_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void incidentTasksGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### Entities_RunPlaybook + +```java +/** + * Samples for SourceControlsOperation Get. + */ +public final class SourceControlsOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/GetSourceControlById.json + */ + /** + * Sample code: Get a source control. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getASourceControl(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations() + .getWithResponse("myRg", "myWorkspace", "789e0c1f-4a3d-43ad-809c-e713b677b04a", + com.azure.core.util.Context.NONE); + } +} +``` + +### EntitiesGetTimeline_List + +```java +/** + * Samples for Metadata List. + */ +public final class MetadataListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/GetAllMetadata.json + */ + /** + * Sample code: Get all metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/GetAllMetadataOData.json + */ + /** + * Sample code: Get all metadata with OData filter/orderby/skip/top. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllMetadataWithODataFilterOrderbySkipTop( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### EntitiesRelations_List + +```java +/** + * Samples for AutomationRules List. + */ +public final class AutomationRulesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * automationRules/AutomationRules_List.json + */ + /** + * Sample code: AutomationRules_List. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void automationRulesList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.automationRules().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### EntityQueries_CreateOrUpdate + +```java +/** + * Samples for IncidentTasks Delete. + */ +public final class IncidentTasksDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_Delete.json + */ + /** + * Sample code: IncidentTasks_Delete. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void incidentTasksDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### EntityQueries_Delete + +```java +/** + * Samples for EntityQueries Get. + */ +public final class EntityQueriesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/GetActivityEntityQueryById.json + */ + /** + * Sample code: Get an Activity entity query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnActivityEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .getWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/GetExpansionEntityQueryById.json + */ + /** + * Sample code: Get an Expansion entity query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnExpansionEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .getWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + com.azure.core.util.Context.NONE); + } +} +``` + +### EntityQueries_Get + +```java +/** + * Samples for GetTriggeredAnalyticsRuleRuns List. + */ +public final class GetTriggeredAnalyticsRuleRunsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * triggeredAnalyticsRuleRuns/triggeredAnalyticsRuleRuns_Get.json + */ + /** + * Sample code: triggeredAnalyticsRuleRuns_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + triggeredAnalyticsRuleRunsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.getTriggeredAnalyticsRuleRuns().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### EntityQueries_List + +```java +/** + * Samples for OfficeConsents Delete. + */ +public final class OfficeConsentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * officeConsents/DeleteOfficeConsents.json + */ + /** + * Sample code: Delete an office consent. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAnOfficeConsent(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.officeConsents() + .deleteWithResponse("myRg", "myWorkspace", "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", + com.azure.core.util.Context.NONE); + } +} +``` + +### EntityQueryTemplates_Get + +```java +import com.azure.resourcemanager.securityinsights.models.RecommendationPatch; +import com.azure.resourcemanager.securityinsights.models.RecommendationPatchProperties; +import com.azure.resourcemanager.securityinsights.models.State; +import java.util.UUID; + +/** + * Samples for Update Recommendation. + */ +public final class UpdateRecommendationSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/PatchRecommendation.json + */ + /** + * Sample code: Creates a recommendation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsARecommendation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.updates() + .recommendationWithResponse("myRg", "myWorkspace", UUID.fromString("6d4b54eb-8684-4aa3-a156-3aa37b8014bc"), + new RecommendationPatch().withProperties(new RecommendationPatchProperties().withState(State.ACTIVE)), + com.azure.core.util.Context.NONE); + } +} +``` + +### EntityQueryTemplates_List + +```java +/** + * Samples for Actions ListByAlertRule. + */ +public final class ActionsListByAlertRuleSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/GetAllActionsByAlertRule.json + */ + /** + * Sample code: Get all actions of alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllActionsOfAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.actions() + .listByAlertRule("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} +``` + +### EntityRelations_GetRelation + +```java + +/** + * Samples for Entities RunPlaybook. + */ +public final class EntitiesRunPlaybookSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * manualTrigger/Entities_RunPlaybook.json + */ + /** + * Sample code: Entities_RunPlaybook. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void entitiesRunPlaybook(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .runPlaybookWithResponse("myRg", "myWorkspace", "72e01a22-5cd2-4139-a149-9f2736ff2ar2", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### FileImports_Create + +```java +/** + * Samples for SentinelOnboardingStates Create. + */ +public final class SentinelOnboardingStatesCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * onboardingStates/CreateSentinelOnboardingState.json + */ + /** + * Sample code: Create Sentinel onboarding state. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createSentinelOnboardingState(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sentinelOnboardingStates() + .define("default") + .withExistingWorkspace("myRg", "myWorkspace") + .withCustomerManagedKey(false) + .create(); + } +} +``` + +### FileImports_Delete + +```java +/** + * Samples for WorkspaceManagerMembers CreateOrUpdate. + */ +public final class WorkspaceManagerMembersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/CreateOrUpdateWorkspaceManagerMember.json + */ + /** + * Sample code: Create or Update a workspace manager member. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createOrUpdateAWorkspaceManagerMember( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .define("afbd324f-6c48-459c-8710-8d1e1cd03812") + .withExistingWorkspace("myRg", "myWorkspace") + .withTargetWorkspaceResourceId( + "/subscriptions/7aef9d48-814f-45ad-b644-b0343316e174/resourceGroups/otherRg/providers/Microsoft.OperationalInsights/workspaces/Example_Workspace") + .withTargetWorkspaceTenantId("f676d436-8d16-42db-81b7-ab578e110ccd") + .create(); + } +} +``` + +### FileImports_Get + +```java +/** + * Samples for Hunts List. + */ +public final class HuntsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHunts.json + */ + /** + * Sample code: Get all hunts. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllHunts(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts().list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### FileImports_List + +```java +/** + * Samples for AutomationRules Delete. + */ +public final class AutomationRulesDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * automationRules/AutomationRules_Delete.json + */ + /** + * Sample code: AutomationRules_Delete. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + automationRulesDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.automationRules() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} +``` + +### Get_SingleRecommendation + +```java +/** + * Samples for FileImports Get. + */ +public final class FileImportsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/GetFileImportById.json + */ + /** + * Sample code: Get a file import. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAFileImport(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} +``` + +### GetRecommendations_List + +```java +import com.azure.resourcemanager.securityinsights.models.Mode; + +/** + * Samples for WorkspaceManagerConfigurations CreateOrUpdate. + */ +public final class WorkspaceManagerConfigurationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/CreateOrUpdateWorkspaceManagerConfiguration.json + */ + /** + * Sample code: Create or Update a workspace manager Configuration. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createOrUpdateAWorkspaceManagerConfiguration( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .define("default") + .withExistingWorkspace("myRg", "myWorkspace") + .withMode(Mode.ENABLED) + .create(); + } +} +``` + +### GetTriggeredAnalyticsRuleRuns_List + +```java +import com.azure.resourcemanager.securityinsights.models.EntityGetInsightsParameters; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; + +/** + * Samples for Entities GetInsights. + */ +public final class EntitiesGetInsightsSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/insights/PostGetInsights.json + */ + /** + * Sample code: Entity Insight. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void entityInsight(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getInsightsWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + new EntityGetInsightsParameters().withStartTime(OffsetDateTime.parse("2021-09-01T00:00:00.000Z")) + .withEndTime(OffsetDateTime.parse("2021-10-01T00:00:00.000Z")) + .withAddDefaultExtendedTimeRange(false) + .withInsightQueryIds(Arrays.asList(UUID.fromString("cae8d0aa-aa45-4d53-8d88-17dd64ffd4e4"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### HuntComments_CreateOrUpdate + +```java +/** + * Samples for Systems Delete. + */ +public final class SystemsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_Delete.json + */ + /** + * Sample code: Systems_Delete. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void systemsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .deleteWithResponse("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a", + "3d69632b-0b60-4af3-8720-77f01a25d34a", com.azure.core.util.Context.NONE); + } +} +``` + +### HuntComments_Delete + +```java +/** + * Samples for ContentTemplateOperation Get. + */ +public final class ContentTemplateOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetTemplateById.json + */ + /** + * Sample code: Get a template. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getATemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentTemplateOperations() + .getWithResponse("myRg", "myWorkspace", "8365ebfe-a381-45b7-ad08-7d818070e11f", + com.azure.core.util.Context.NONE); + } +} +``` + +### HuntComments_Get + +```java +/** + * Samples for ThreatIntelligenceIndicator Get. + */ +public final class ThreatIntelligenceIndicatorGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/GetThreatIntelligenceById.json + */ + /** + * Sample code: View a threat intelligence indicator by name. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void viewAThreatIntelligenceIndicatorByName( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicators() + .getWithResponse("myRg", "myWorkspace", "e16ef847-962e-d7b6-9c8b-a33e4bd30e47", + com.azure.core.util.Context.NONE); + } +} +``` + +### HuntComments_List + +```java +/** + * Samples for Incidents ListEntities. + */ +public final class IncidentsListEntitiesSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentEntities/Incidents_ListEntities.json + */ + /** + * Sample code: Incidents_ListEntities. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + incidentsListEntities(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .listEntitiesWithResponse("myRg", "myWorkspace", "69a30280-6a4c-4aa7-9af0-5d63f335d600", + com.azure.core.util.Context.NONE); + } +} +``` + +### HuntRelations_CreateOrUpdate + +```java +import com.azure.resourcemanager.securityinsights.models.IncidentClassification; +import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; +import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; +import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; +import com.azure.resourcemanager.securityinsights.models.IncidentStatus; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** + * Samples for Incidents CreateOrUpdate. + */ +public final class IncidentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_CreateOrUpdate.json + */ + /** + * Sample code: Incidents_CreateOrUpdate. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + incidentsCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withExistingWorkspace("myRg", "myWorkspace") + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withTitle("My incident") + .withDescription("This is a demo incident") + .withSeverity(IncidentSeverity.HIGH) + .withStatus(IncidentStatus.CLOSED) + .withClassification(IncidentClassification.FALSE_POSITIVE) + .withClassificationReason(IncidentClassificationReason.INACCURATE_DATA) + .withClassificationComment("Not a malicious activity") + .withOwner(new IncidentOwnerInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) + .withFirstActivityTimeUtc(OffsetDateTime.parse("2019-01-01T13:00:30Z")) + .withLastActivityTimeUtc(OffsetDateTime.parse("2019-01-01T13:05:30Z")) + .create(); + } +} +``` + +### HuntRelations_Delete + +```java +/** + * Samples for SourceControlsOperation List. + */ +public final class SourceControlsOperationListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/GetSourceControls.json + */ + /** + * Sample code: Get all source controls. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllSourceControls(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### HuntRelations_Get + +```java +/** + * Samples for DataConnectorDefinitions List. + */ +public final class DataConnectorDefinitionsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/GetDataConnectorDefinitions.json + */ + /** + * Sample code: Get all data connector definitions. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllDataConnectorDefinitions(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorDefinitions().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### HuntRelations_List + +```java +/** + * Samples for SecurityMLAnalyticsSettings List. + */ +public final class SecurityMLAnalyticsSettingsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json + */ + /** + * Sample code: Get all Security ML Analytics Settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllSecurityMLAnalyticsSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.securityMLAnalyticsSettings().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Hunts_CreateOrUpdate + +```java +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceAppendTags; +import java.util.Arrays; + +/** + * Samples for ThreatIntelligenceIndicator AppendTags. + */ +public final class ThreatIntelligenceIndicatorAppendTagsSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/AppendTagsThreatIntelligence.json + */ + /** + * Sample code: Append tags to a threat intelligence indicator. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void appendTagsToAThreatIntelligenceIndicator( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicators() + .appendTagsWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + new ThreatIntelligenceAppendTags().withThreatIntelligenceTags(Arrays.asList("tag1", "tag2")), + com.azure.core.util.Context.NONE); + } +} +``` + +### Hunts_Delete + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * operations/ListOperations.json + */ + /** + * Sample code: Get all operations. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllOperations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Hunts_Get + +```java +/** + * Samples for ThreatIntelligenceIndicator Delete. + */ +public final class ThreatIntelligenceIndicatorDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/DeleteThreatIntelligence.json + */ + /** + * Sample code: Delete a threat intelligence indicator. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAThreatIntelligenceIndicator(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicators() + .deleteWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + com.azure.core.util.Context.NONE); + } +} +``` + +### Hunts_List + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; + +/** + * Samples for WatchlistItems CreateOrUpdate. + */ +public final class WatchlistItemsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/CreateWatchlistItem.json + */ + /** + * Sample code: Creates or updates a watchlist item. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAWatchlistItem( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.watchlistItems() + .define("82ba292c-dc97-4dfc-969d-d4dd9e666842") + .withExistingWatchlist("myRg", "myWorkspace", "highValueAsset") + .withEtag("0300bf09-0000-0000-0000-5c37296e0000") + .withItemsKeyValue(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"Business tier\":\"10.0.2.0/24\",\"Data tier\":\"10.0.2.0/24\",\"Gateway subnet\":\"10.0.255.224/27\",\"Private DMZ in\":\"10.0.0.0/27\",\"Public DMZ out\":\"10.0.0.96/27\",\"Web Tier\":\"10.0.1.0/24\"}", + Object.class, SerializerEncoding.JSON)) + .create(); + } +} +``` + +### IncidentComments_CreateOrUpdate + +```java +import com.azure.resourcemanager.securityinsights.models.AgentConfiguration; + +/** + * Samples for BusinessApplicationAgents CreateOrUpdate. + */ +public final class BusinessApplicationAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgents_CreateOrUpdate.json + */ + /** + * Sample code: BusinessApplicationAgents_CreateOrUpdate. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void businessApplicationAgentsCreateOrUpdate( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgents() + .define("3d69632b-0b60-4af3-8720-77f01a25d34a") + .withExistingWorkspace("myRg", "myWorkspace") + .withConfiguration((AgentConfiguration) null) + .withDisplayName((String) null) + .create(); + } +} +``` + +### IncidentComments_Delete + +```java +/** + * Samples for HuntComments CreateOrUpdate. + */ +public final class HuntCommentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/CreateHuntComment.json + */ + /** + * Sample code: Creates or updates a hunt comment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAHuntComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .define("2216d0e1-91e3-4902-89fd-d2df8c535096") + .withExistingHunt("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f") + .withMessage("This is a test comment.") + .create(); + } +} +``` + +### IncidentComments_Get + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.ConnectAuthKind; +import com.azure.resourcemanager.securityinsights.models.DataConnectorConnectBody; +import java.io.IOException; +import java.util.Arrays; + +/** + * Samples for DataConnectors Connect. + */ +public final class DataConnectorsConnectSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/ConnectAPIPollingV2Logs.json + */ + /** + * Sample code: Connect an APIPolling V2 logs data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void connectAnAPIPollingV2LogsDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .connectWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new DataConnectorConnectBody().withKind(ConnectAuthKind.APIKEY) + .withApiKey("fakeTokenPlaceholder") + .withDataCollectionEndpoint("https://test.eastus.ingest.monitor.azure.com") + .withDataCollectionRuleImmutableId("dcr-34adsj9o7d6f9de204478b9cgb43b631") + .withOutputStream("Custom-MyTableRawData") + .withRequestConfigUserInputValues(Arrays.asList(SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"displayText\":\"Organization Name\",\"placeHolderName\":\"{{placeHolder1}}\",\"placeHolderValue\":\"somePlaceHolderValue\",\"requestObjectKey\":\"apiEndpoint\"}", + Object.class, SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/ConnectAPIPolling.json + */ + /** + * Sample code: Connect an APIPolling data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void connectAnAPIPollingDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .connectWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new DataConnectorConnectBody().withKind(ConnectAuthKind.APIKEY) + .withApiKey("fakeTokenPlaceholder") + .withRequestConfigUserInputValues(Arrays.asList(SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"displayText\":\"Organization Name\",\"placeHolderName\":\"{{placeHolder1}}\",\"placeHolderValue\":\"somePlaceHolderValue\",\"requestObjectKey\":\"apiEndpoint\"}", + Object.class, SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentComments_List + +```java +/** + * Samples for SentinelOnboardingStates Get. + */ +public final class SentinelOnboardingStatesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * onboardingStates/GetSentinelOnboardingState.json + */ + /** + * Sample code: Get Sentinel onboarding state. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getSentinelOnboardingState(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sentinelOnboardingStates() + .getWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentRelations_CreateOrUpdate + +```java +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; + +/** + * Samples for SourceControl ListRepositories. + */ +public final class SourceControlListRepositoriesSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * repositories/GetRepositories.json + */ + /** + * Sample code: Get repository list. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getRepositoryList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControls() + .listRepositories("myRg", "myWorkspace", + new RepositoryAccessProperties().withKind(RepositoryAccessKind.OAUTH) + .withCode("fakeTokenPlaceholder") + .withState("state") + .withClientId("54b3c2c0-1f48-4a1c-af9f-6399c3240b73"), + com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentRelations_Delete + +```java +/** + * Samples for Entities List. + */ +public final class EntitiesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetEntities.json + */ + /** + * Sample code: Get all entities. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllEntities(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentRelations_Get + +```java +/** + * Samples for ThreatIntelligenceIndicatorMetrics List. + */ +public final class ThreatIntelligenceIndicatorMetricsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/CollectThreatIntelligenceMetrics.json + */ + /** + * Sample code: Get threat intelligence indicators metrics. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getThreatIntelligenceIndicatorsMetrics( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicatorMetrics() + .listWithResponse("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentRelations_List + +```java +/** + * Samples for WorkspaceManagerAssignments List. + */ +public final class WorkspaceManagerAssignmentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetAllWorkspaceManagerAssignments.json + */ + /** + * Sample code: Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllWorkspaceManagerAssignmentsForTheSentinelWorkspaceManager( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentTasks_CreateOrUpdate + +```java +import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction; +import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic; +import java.util.List; + +/** + * Samples for AutomationRules CreateOrUpdate. + */ +public final class AutomationRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * automationRules/AutomationRules_CreateOrUpdate.json + */ + /** + * Sample code: AutomationRules_CreateOrUpdate. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + automationRulesCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.automationRules() + .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withExistingWorkspace("myRg", "myWorkspace") + .withDisplayName((String) null) + .withOrder(0) + .withTriggeringLogic((AutomationRuleTriggeringLogic) null) + .withActions((List) null) + .create(); + } +} +``` + +### IncidentTasks_Delete + +```java +/** + * Samples for BusinessApplicationAgentOperation Get. + */ +public final class BusinessApplicationAgentOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgent_Get.json + */ + /** + * Sample code: BusinessApplicationAgent_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + businessApplicationAgentGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgentOperations() + .getWithResponse("myRg", "myWorkspace", "3d69632b-0b60-4af3-8720-77f01a25d34a", + com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentTasks_Get + +```java + +/** + * Samples for Incidents RunPlaybook. + */ +public final class IncidentsRunPlaybookSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * manualTrigger/Incidents_RunPlaybook.json + */ + /** + * Sample code: Incidents_RunPlaybook. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + incidentsRunPlaybook(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .runPlaybookWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ar4", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### IncidentTasks_List + +```java +/** + * Samples for AlertRules Get. + */ +public final class AlertRulesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetScheduledAlertRule.json + */ + /** + * Sample code: Get a Scheduled alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAScheduledAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetNrtAlertRule.json + */ + /** + * Sample code: Get an Nrt alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnNrtAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetFusionAlertRule.json + */ + /** + * Sample code: Get a Fusion alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAFusionAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .getWithResponse("myRg", "myWorkspace", "myFirstFusionRule", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetMicrosoftSecurityIncidentCreationAlertRule.json + */ + /** + * Sample code: Get a MicrosoftSecurityIncidentCreation rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMicrosoftSecurityIncidentCreationRule( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .getWithResponse("myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", + com.azure.core.util.Context.NONE); + } +} +``` + +### Incidents_CreateOrUpdate + +```java +import java.util.Arrays; + +/** + * Samples for HuntRelations CreateOrUpdate. + */ +public final class HuntRelationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/CreateHuntRelation.json + */ + /** + * Sample code: Creates or updates a hunt relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAHuntRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .define("2216d0e1-91e3-4902-89fd-d2df8c535096") + .withExistingHunt("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f") + .withRelatedResourceId( + "/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/mms-eus/providers/Microsoft.OperationalInsights/workspaces/avdvirint/providers/Microsoft.SecurityInsights/Bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096") + .withLabels(Arrays.asList("Test Label")) + .create(); + } +} +``` + +### Incidents_Delete + +```java +/** + * Samples for AutomationRules Get. + */ +public final class AutomationRulesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * automationRules/AutomationRules_Get.json + */ + /** + * Sample code: AutomationRules_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void automationRulesGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.automationRules() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} +``` + +### Incidents_Get + +```java +/** + * Samples for Incidents ListBookmarks. + */ +public final class IncidentsListBookmarksSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentBookmarks/Incidents_ListBookmarks.json + */ + /** + * Sample code: Incidents_ListBookmarks. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + incidentsListBookmarks(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .listBookmarksWithResponse("myRg", "myWorkspace", "69a30280-6a4c-4aa7-9af0-5d63f335d600", + com.azure.core.util.Context.NONE); + } +} +``` + +### Incidents_List + +```java +/** + * Samples for AlertRules List. + */ +public final class AlertRulesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetAllAlertRules.json + */ + /** + * Sample code: Get all alert rules. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllAlertRules(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Incidents_ListAlerts + +```java +/** + * Samples for WorkspaceManagerAssignmentJobs Get. + */ +public final class WorkspaceManagerAssignmentJobsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetJob.json + */ + /** + * Sample code: Get a workspace manager job. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerJob(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignmentJobs() + .getWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + "cfbe1338-8276-4d5d-8b96-931117f9fa0e", com.azure.core.util.Context.NONE); + } +} +``` + +### Incidents_ListBookmarks + +```java +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorModel; +import java.util.Arrays; + +/** + * Samples for ThreatIntelligenceIndicator ReplaceTags. + */ +public final class ThreatIntelligenceIndicatorReplaceTagsSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/ReplaceTagsThreatIntelligence.json + */ + /** + * Sample code: Replace tags to a Threat Intelligence. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + replaceTagsToAThreatIntelligence(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicators() + .replaceTagsWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", + new ThreatIntelligenceIndicatorModel().withEtag("\"0000262c-0000-0800-0000-5e9767060000\"") + .withThreatIntelligenceTags(Arrays.asList("patching tags")), + com.azure.core.util.Context.NONE); + } +} +``` + +### Incidents_ListEntities + +```java +import java.util.Arrays; + +/** + * Samples for WorkspaceManagerGroups CreateOrUpdate. + */ +public final class WorkspaceManagerGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/CreateOrUpdateWorkspaceManagerGroup.json + */ + /** + * Sample code: Creates or updates a workspace manager group. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAWorkspaceManagerGroup( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .define("37207a7a-3b8a-438f-a559-c7df400e1b96") + .withExistingWorkspace("myRg", "myWorkspace") + .withDescription("Group of all financial and banking institutions") + .withDisplayName("Banks") + .withMemberResourceNames( + Arrays.asList("afbd324f-6c48-459c-8710-8d1e1cd03812", "f5fa104e-c0e3-4747-9182-d342dc048a9e")) + .create(); + } +} +``` + +### Incidents_RunPlaybook + +```java +/** + * Samples for Bookmarks Get. + */ +public final class BookmarksGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/GetBookmarkById.json + */ + /** + * Sample code: Get a bookmark. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getABookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarks() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} +``` + +### Metadata_Create + +```java +/** + * Samples for Systems Get. + */ +public final class SystemsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_Get.json + */ + /** + * Sample code: Systems_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void systemsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .getWithResponse("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a", + "3d69632b-0b60-4af3-8720-77f01a25d34a", com.azure.core.util.Context.NONE); + } +} +``` + +### Metadata_Delete + +```java +/** + * Samples for DataConnectors List. + */ +public final class DataConnectorsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetDataConnectors.json + */ + /** + * Sample code: Get all data connectors. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllDataConnectors(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Metadata_Get + +```java +import java.util.UUID; + +/** + * Samples for Get SingleRecommendation. + */ +public final class GetSingleRecommendationSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/GetRecommendation.json + */ + /** + * Sample code: Get a recommendation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getARecommendation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.gets() + .singleRecommendationWithResponse("myRg", "myWorkspace", + UUID.fromString("6d4b54eb-8684-4aa3-a156-3aa37b8014bc"), com.azure.core.util.Context.NONE); + } +} +``` + +### Metadata_List + +```java +/** + * Samples for Watchlists Get. + */ +public final class WatchlistsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlistByAlias.json + */ + /** + * Sample code: Get a watchlist. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlists().getWithResponse("myRg", "myWorkspace", "highValueAsset", com.azure.core.util.Context.NONE); + } +} +``` + +### Metadata_Update + +```java +/** + * Samples for Actions CreateOrUpdate. + */ +public final class ActionsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/CreateActionOfAlertRule.json + */ + /** + * Sample code: Creates or updates an action of alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAnActionOfAlertRule( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.actions() + .define("912bec42-cb66-4c03-ac63-1761b6898c3e") + .withExistingAlertRule("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withTriggerUri( + "https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature") + .withLogicAppResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts") + .create(); + } +} +``` + +### OfficeConsents_Delete + +```java +/** + * Samples for SecurityMLAnalyticsSettings Delete. + */ +public final class SecurityMLAnalyticsSettingsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json + */ + /** + * Sample code: Delete a Security ML Analytics Settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteASecurityMLAnalyticsSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.securityMLAnalyticsSettings() + .deleteWithResponse("myRg", "myWorkspace", "f209187f-1d17-4431-94af-c141bf5f23db", + com.azure.core.util.Context.NONE); + } +} +``` + +### OfficeConsents_Get + +```java +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; + +/** + * Samples for SourceControlsOperation Delete. + */ +public final class SourceControlsOperationDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/DeleteSourceControl.json + */ + /** + * Sample code: Delete a source control. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteASourceControl(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations() + .deleteWithResponse("myRg", "myWorkspace", "789e0c1f-4a3d-43ad-809c-e713b677b04a", + new RepositoryAccessProperties().withKind(RepositoryAccessKind.OAUTH) + .withCode("fakeTokenPlaceholder") + .withState("state") + .withClientId("54b3c2c0-1f48-4a1c-af9f-6399c3240b73"), + com.azure.core.util.Context.NONE); + } +} +``` + +### OfficeConsents_List + +```java +/** + * Samples for SentinelOnboardingStates List. + */ +public final class SentinelOnboardingStatesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * onboardingStates/GetAllSentinelOnboardingStates.json + */ + /** + * Sample code: Get all Sentinel onboarding states. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllSentinelOnboardingStates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sentinelOnboardingStates().listWithResponse("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.resourcemanager.securityinsights.models.EntityTimelineParameters; +import java.time.OffsetDateTime; + +/** + * Samples for EntitiesGetTimeline List. + */ +public final class EntitiesGetTimelineListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/timeline/PostTimelineEntity.json + */ + /** + * Sample code: Entity timeline. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void entityTimeline(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entitiesGetTimelines() + .listWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + new EntityTimelineParameters().withStartTime(OffsetDateTime.parse("2021-09-01T00:00:00.000Z")) + .withEndTime(OffsetDateTime.parse("2021-10-01T00:00:00.000Z")) + .withNumberOfBucket(4), + com.azure.core.util.Context.NONE); + } +} +``` + +### ProductPackageOperation_Get + +```java +import com.azure.resourcemanager.securityinsights.models.SourceType; + +/** + * Samples for Watchlists CreateOrUpdate. + */ +public final class WatchlistsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/CreateWatchlistAndWatchlistItems.json + */ + /** + * Sample code: Creates or updates a watchlist and bulk creates watchlist items. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAWatchlistAndBulkCreatesWatchlistItems( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlists() + .define("highValueAsset") + .withExistingWorkspace("myRg", "myWorkspace") + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDisplayName("High Value Assets Watchlist") + .withProvider("Microsoft") + .withSource("watchlist.csv") + .withSourceType(SourceType.LOCAL) + .withDescription("Watchlist from CSV content") + .withNumberOfLinesToSkip(1) + .withRawContent("This line will be skipped\nheader1,header2\nvalue1,value2") + .withItemsSearchKey("header1") + .withContentType("text/csv") + .create(); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/CreateWatchlist.json + */ + /** + * Sample code: Creates or updates a watchlist. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlists() + .define("highValueAsset") + .withExistingWorkspace("myRg", "myWorkspace") + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDisplayName("High Value Assets Watchlist") + .withProvider("Microsoft") + .withSource("watchlist.csv") + .withSourceType(SourceType.LOCAL) + .withDescription("Watchlist from CSV content") + .withItemsSearchKey("header1") + .create(); + } +} +``` + +### ProductPackages_List + +```java +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; + +/** + * Samples for IncidentRelations CreateOrUpdate. + */ +public final class IncidentRelationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/CreateIncidentRelation.json + */ + /** + * Sample code: Creates or updates an incident relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAnIncidentRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentRelations() + .createOrUpdateWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + new RelationInner().withRelatedResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ProductSettings_Delete + +```java +/** + * Samples for TriggeredAnalyticsRuleRunOperation Get. + */ +public final class TriggeredAnalyticsRuleRunOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * triggeredAnalyticsRuleRuns/triggeredAnalyticsRuleRun_Get.json + */ + /** + * Sample code: triggeredAnalyticsRuleRun_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + triggeredAnalyticsRuleRunGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.triggeredAnalyticsRuleRunOperations() + .getWithResponse("myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", + com.azure.core.util.Context.NONE); + } +} +``` + +### ProductSettings_Get + +```java +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.Operator; +import com.azure.resourcemanager.securityinsights.models.SourceKind; +import com.azure.resourcemanager.securityinsights.models.SupportTier; +import java.time.LocalDate; +import java.util.Arrays; + +/** + * Samples for Metadata Create. + */ +public final class MetadataCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/PutMetadata.json + */ + /** + * Sample code: Create/update full metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createUpdateFullMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas() + .define("metadataName") + .withExistingWorkspace("myRg", "myWorkspace") + .withContentId("c00ee137-7475-47c8-9cce-ec6f0f1bedd0") + .withParentId( + "/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName") + .withVersion("1.0.0.0") + .withKind("AnalyticsRule") + .withSource(new MetadataSource().withKind(SourceKind.SOLUTION) + .withName("Contoso Solution 1.0") + .withSourceId("b688a130-76f4-4a07-bf57-762222a3cadf")) + .withAuthor(new MetadataAuthor().withName("User Name").withEmail("email@microsoft.com")) + .withSupport(new MetadataSupport().withTier(SupportTier.PARTNER) + .withName("Microsoft") + .withEmail("support@microsoft.com") + .withLink("https://support.microsoft.com/")) + .withDependencies(new MetadataDependencies().withOperator(Operator.fromString("AND")) + .withCriteria(Arrays.asList( + new MetadataDependencies().withOperator(Operator.fromString("OR")) + .withCriteria(Arrays.asList( + new MetadataDependencies().withContentId("045d06d0-ee72-4794-aba4-cf5646e4c756") + .withKind(Kind.DATA_CONNECTOR) + .withName("Microsoft Defender for Endpoint"), + new MetadataDependencies().withContentId("dbfcb2cc-d782-40ef-8d94-fe7af58a6f2d") + .withKind(Kind.DATA_CONNECTOR), + new MetadataDependencies().withContentId("de4dca9b-eb37-47d6-a56f-b8b06b261593") + .withKind(Kind.DATA_CONNECTOR) + .withVersion("2.0"))), + new MetadataDependencies().withContentId("31ee11cc-9989-4de8-b176-5e0ef5c4dbab") + .withKind(Kind.PLAYBOOK) + .withVersion("1.0"), + new MetadataDependencies().withContentId("21ba424a-9438-4444-953a-7059539a7a1b") + .withKind(Kind.PARSER)))) + .withCategories( + new MetadataCategories().withDomains(Arrays.asList("Application", "Security – Insider Threat")) + .withVerticals(Arrays.asList("Healthcare"))) + .withProviders(Arrays.asList("Amazon", "Microsoft")) + .withFirstPublishDate(LocalDate.parse("2021-05-18")) + .withLastPublishDate(LocalDate.parse("2021-05-18")) + .withCustomVersion("1.0") + .withContentSchemaVersion("2.0") + .withThreatAnalysisTactics(Arrays.asList("reconnaissance", "commandandcontrol")) + .withThreatAnalysisTechniques(Arrays.asList("T1548", "T1548.001")) + .withPreviewImages(Arrays.asList("firstImage.png", "secondImage.jpeg")) + .withPreviewImagesDark(Arrays.asList("firstImageDark.png", "secondImageDark.jpeg")) + .create(); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/PutMetadataMinimal.json + */ + /** + * Sample code: Create/update minimal metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createUpdateMinimalMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas() + .define("metadataName") + .withExistingWorkspace("myRg", "myWorkspace") + .withContentId("c00ee137-7475-47c8-9cce-ec6f0f1bedd0") + .withParentId( + "/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName") + .withKind("AnalyticsRule") + .create(); + } +} +``` + +### ProductSettings_List + +```java +/** + * Samples for WorkspaceManagerAssignments Get. + */ +public final class WorkspaceManagerAssignmentsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetWorkspaceManagerAssignment.json + */ + /** + * Sample code: Get a workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerAssignment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .getWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + com.azure.core.util.Context.NONE); + } +} +``` + +### ProductSettings_Update + +```java +/** + * Samples for HuntComments List. + */ +public final class HuntCommentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntComments.json + */ + /** + * Sample code: Get all hunt comments. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllHuntComments(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .list("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", null, null, null, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### ProductTemplateOperation_Get + +```java +import com.azure.resourcemanager.securityinsights.models.EnrichmentIpAddressBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentType; + +/** + * Samples for ResourceProvider ListGeodataByIp. + */ +public final class ResourceProviderListGeodataByIpSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * enrichment/GetGeodataWithWorkspaceByIp.json + */ + /** + * Sample code: Get geodata for a single IP address. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getGeodataForASingleIPAddress(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.resourceProviders() + .listGeodataByIpWithResponse("myRg", "myWorkspace", EnrichmentType.MAIN, + new EnrichmentIpAddressBody().withIpAddress("1.2.3.4"), com.azure.core.util.Context.NONE); + } +} +``` + +### ProductTemplates_List + +```java +import com.azure.resourcemanager.securityinsights.models.PackageKind; + +/** + * Samples for ContentPackageOperation Install. + */ +public final class ContentPackageOperationInstallSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/InstallPackage.json + */ + /** + * Sample code: Install a package to the workspace. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + installAPackageToTheWorkspace(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackageOperations() + .define("str.azure-sentinel-solution-str") + .withExistingWorkspace("myRg", "myWorkspace") + .withContentId("str.azure-sentinel-solution-str") + .withContentProductId("str.azure-sentinel-solution-str-sl-igl6jawr4gwmu") + .withContentKind(PackageKind.SOLUTION) + .withVersion("2.0.0") + .withDisplayName("str") + .create(); + } +} +``` + +### Reevaluate_Recommendation + +```java +/** + * Samples for AlertRules Delete. + */ +public final class AlertRulesDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/DeleteAlertRule.json + */ + /** + * Sample code: Delete an alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAnAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_ListGeodataByIp + +```java +/** + * Samples for IncidentRelations Get. + */ +public final class IncidentRelationsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/GetIncidentRelationByName.json + */ + /** + * Sample code: Get an incident relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnIncidentRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentRelations() + .getWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_ListWhoisByDomain + +```java +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorModel; +import java.util.Arrays; + +/** + * Samples for ThreatIntelligenceIndicator CreateIndicator. + */ +public final class ThreatIntelligenceIndicatorCreateIndicatorSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/CreateThreatIntelligence.json + */ + /** + * Sample code: Create a new Threat Intelligence. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createANewThreatIntelligence(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicators() + .createIndicatorWithResponse("myRg", "myWorkspace", + new ThreatIntelligenceIndicatorModel().withThreatIntelligenceTags(Arrays.asList("new schema")) + .withSource("Azure Sentinel") + .withDisplayName("new schema") + .withDescription("debugging indicators") + .withPattern("[url:value = 'https://www.contoso.com']") + .withPatternType("url") + .withKillChainPhases(Arrays.asList()) + .withCreatedByRef("contoso@contoso.com") + .withExternalReferences(Arrays.asList()) + .withGranularMarkings(Arrays.asList()) + .withLabels(Arrays.asList()) + .withRevoked(false) + .withConfidence(78) + .withThreatTypes(Arrays.asList("compromised")) + .withValidFrom("2021-09-15T17:44:00.114052Z") + .withValidUntil("") + .withModified(""), + com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityMLAnalyticsSettings_CreateOrUpdate + +```java +/** + * Samples for ContentPackages Get. + */ +public final class ContentPackagesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetPackageById.json + */ + /** + * Sample code: Get installed packages by id. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getInstalledPackagesById(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackages() + .getWithResponse("myRg", "myWorkspace", "str.azure-sentinel-solution-str", + com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityMLAnalyticsSettings_Delete + +```java +import com.azure.resourcemanager.securityinsights.models.AadCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.AscCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.Dynamics365CheckRequirements; +import com.azure.resourcemanager.securityinsights.models.IoTCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.McasCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.MstiCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.MtpCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.OfficeAtpCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.OfficeIrmCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBICheckRequirements; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.TICheckRequirements; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiCheckRequirements; + +/** + * Samples for DataConnectorsCheckRequirementsOperation Post. + */ +public final class DataConnectorsCheckRequirementsOperationPostSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOfficeATP.json + */ + /** + * Sample code: Check requirements for OfficeATP. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForOfficeATP(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new OfficeAtpCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOffice365Project.json + */ + /** + * Sample code: Check requirements for Office365Project. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForOffice365Project( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new Office365ProjectCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureActiveDirectoryNoAuthorization.json + */ + /** + * Sample code: Check requirements for AADIP (Azure Active Directory Identity Protection) - no authorization. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForAADIPAzureActiveDirectoryIdentityProtectionNoAuthorization( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AadCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftCloudAppSecurity.json + */ + /** + * Sample code: Check requirements for Mcas. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForMcas(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new McasCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsIoT.json + */ + /** + * Sample code: Check requirements for IoT. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForIoT(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new IoTCheckRequirements().withSubscriptionId("c0688291-89d7-4bed-87a2-a7b1bff43f4c"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMdatp.json + */ + /** + * Sample code: Check requirements for Mdatp. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForMdatp(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new McasCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureSecurityCenter.json + */ + /** + * Sample code: Check requirements for ASC. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForASC(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AscCheckRequirements().withSubscriptionId("c0688291-89d7-4bed-87a2-a7b1bff43f4c"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftPurviewInformationProtection.json + */ + /** + * Sample code: Check requirements for MicrosoftPurviewInformationProtection. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForMicrosoftPurviewInformationProtection( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", new MicrosoftPurviewInformationProtectionCheckRequirements() + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftThreatProtection.json + */ + /** + * Sample code: Check requirements for MicrosoftThreatProtection. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForMicrosoftThreatProtection( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new MtpCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsThreatIntelligenceTaxii.json + */ + /** + * Sample code: Check requirements for TI Taxii. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForTITaxii(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new TiTaxiiCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOfficeIRM.json + */ + /** + * Sample code: Check requirements for OfficeIRM. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForOfficeIRM(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new OfficeIrmCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftThreatIntelligence.json + */ + /** + * Sample code: Check requirements for MicrosoftThreatIntelligence. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForMicrosoftThreatIntelligence( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new MstiCheckRequirements().withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsPurviewAudit.json + */ + /** + * Sample code: Check requirements for PurviewAudit. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForPurviewAudit(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new PurviewAuditCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureActiveDirectory.json + */ + /** + * Sample code: Check requirements for AADIP (Azure Active Directory Identity Protection). + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForAADIPAzureActiveDirectoryIdentityProtection( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AadCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOfficePowerBI.json + */ + /** + * Sample code: Check requirements for OfficePowerBI. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForOfficePowerBI(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new OfficePowerBICheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsDynamics365.json + */ + /** + * Sample code: Check requirements for Dynamics365. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForDynamics365(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new Dynamics365CheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureActiveDirectoryNoLicense.json + */ + /** + * Sample code: Check requirements for AADIP (Azure Active Directory Identity Protection) - no license. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForAADIPAzureActiveDirectoryIdentityProtectionNoLicense( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AadCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsThreatIntelligence.json + */ + /** + * Sample code: Check requirements for TI. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForTI(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new TICheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityMLAnalyticsSettings_Get + +```java + +/** + * Samples for Systems ReportActionStatus. + */ +public final class SystemsReportActionStatusSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/actions/ReportActionStatus.json + */ + /** + * Sample code: ReportActionStatus. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void reportActionStatus(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .reportActionStatusWithResponse("myRg", "myWorkspace", "247b377a-7137-4b3c-bf15-df1d3260ef1b", + "3d69632b-0b60-4af3-8720-77f01a25d34a", null, com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityMLAnalyticsSettings_List + +```java +/** + * Samples for EntityQueryTemplates Get. + */ +public final class EntityQueryTemplatesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueryTemplates/GetActivityEntityQueryTemplateById.json + */ + /** + * Sample code: Get an Activity entity query template. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnActivityEntityQueryTemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueryTemplates() + .getWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + com.azure.core.util.Context.NONE); + } +} +``` + +### SentinelOnboardingStates_Create + +```java +/** + * Samples for Metadata Get. + */ +public final class MetadataGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/GetMetadata.json + */ + /** + * Sample code: Get single metadata by name. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getSingleMetadataByName(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().getWithResponse("myRg", "myWorkspace", "metadataName", com.azure.core.util.Context.NONE); + } +} +``` + +### SentinelOnboardingStates_Delete + +```java +/** + * Samples for WorkspaceManagerConfigurations List. + */ +public final class WorkspaceManagerConfigurationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/GetAllWorkspaceManagerConfigurations.json + */ + /** + * Sample code: Get all workspace manager configurations for a Sentinel workspace. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllWorkspaceManagerConfigurationsForASentinelWorkspace( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### SentinelOnboardingStates_Get + +```java +import com.azure.resourcemanager.securityinsights.models.EntityItemQueryKind; + +/** + * Samples for Entities Queries. + */ +public final class EntitiesQueriesSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetQueries.json + */ + /** + * Sample code: Get Entity Query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .queries("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", EntityItemQueryKind.INSIGHT, + com.azure.core.util.Context.NONE); + } +} +``` + +### SentinelOnboardingStates_List + +```java +/** + * Samples for IncidentComments Get. + */ +public final class IncidentCommentsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_Get.json + */ + /** + * Sample code: IncidentComments_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void incidentCommentsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentComments() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### SourceControl_ListRepositories + +```java +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataModel; + +/** + * Samples for Metadata Update. + */ +public final class MetadataUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/PatchMetadata.json + */ + /** + * Sample code: Update metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void updateMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + MetadataModel resource = manager.metadatas() + .getWithResponse("myRg", "myWorkspace", "metadataName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withAuthor(new MetadataAuthor().withName("User Name").withEmail("email@microsoft.com")) + .apply(); + } +} +``` + +### SourceControlsOperation_Create + +```java +/** + * Samples for OfficeConsents Get. + */ +public final class OfficeConsentsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * officeConsents/GetOfficeConsentsById.json + */ + /** + * Sample code: Get an office consent. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnOfficeConsent(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.officeConsents() + .getWithResponse("myRg", "myWorkspace", "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", + com.azure.core.util.Context.NONE); + } +} +``` + +### SourceControlsOperation_Delete + +```java +/** + * Samples for WorkspaceManagerGroups List. + */ +public final class WorkspaceManagerGroupsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/GetAllWorkspaceManagerGroups.json + */ + /** + * Sample code: Get all workspace manager groups in the Sentinel workspace manager. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllWorkspaceManagerGroupsInTheSentinelWorkspaceManager( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### SourceControlsOperation_Get + +```java +/** + * Samples for BookmarkRelations Get. + */ +public final class BookmarkRelationsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/GetBookmarkRelationByName.json + */ + /** + * Sample code: Get a bookmark relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getABookmarkRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .getWithResponse("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### SourceControlsOperation_List + +```java +/** + * Samples for ContentPackageOperation Uninstall. + */ +public final class ContentPackageOperationUninstallSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/UninstallPackage.json + */ + /** + * Sample code: Uninstall a package from the workspace. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + uninstallAPackageFromTheWorkspace(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackageOperations() + .uninstallWithResponse("myRg", "myWorkspace", "str.azure-sentinel-solution-str", + com.azure.core.util.Context.NONE); + } +} +``` + +### Systems_CreateOrUpdate + +```java +/** + * Samples for Actions Get. + */ +public final class ActionsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/GetActionOfAlertRuleById.json + */ + /** + * Sample code: Get an action of alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnActionOfAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.actions() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "912bec42-cb66-4c03-ac63-1761b6898c3e", com.azure.core.util.Context.NONE); + } +} +``` + +### Systems_Delete + +```java +/** + * Samples for Hunts Delete. + */ +public final class HuntsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/DeleteHunt.json + */ + /** + * Sample code: Delete a hunt. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAHunt(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts() + .deleteWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + com.azure.core.util.Context.NONE); + } +} +``` + +### Systems_Get + +```java +/** + * Samples for ProductSettings Get. + */ +public final class ProductSettingsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/GetEyesOnSetting.json + */ + /** + * Sample code: Get EyesOn settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getEyesOnSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings().getWithResponse("myRg", "myWorkspace", "EyesOn", com.azure.core.util.Context.NONE); + } +} +``` + +### Systems_List + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.AnomalySecurityMLAnalyticsSettings; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettingsDataSource; +import com.azure.resourcemanager.securityinsights.models.SettingsStatus; +import java.io.IOException; +import java.time.Duration; +import java.util.Arrays; +import java.util.UUID; + +/** + * Samples for SecurityMLAnalyticsSettings CreateOrUpdate. + */ +public final class SecurityMLAnalyticsSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * securityMLAnalyticsSettings/CreateAnomalySecurityMLAnalyticsSetting.json + */ + /** + * Sample code: Creates or updates a Anomaly Security ML Analytics Settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAAnomalySecurityMLAnalyticsSettings( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.securityMLAnalyticsSettings() + .createOrUpdateWithResponse("myRg", "myWorkspace", "f209187f-1d17-4431-94af-c141bf5f23db", + new AnomalySecurityMLAnalyticsSettings().withEtag("\"260090e2-0000-0d00-0000-5d6fb8670000\"") + .withDescription( + "When account logs from a source region that has rarely been logged in from during the last 14 days, an anomaly is triggered.") + .withDisplayName("Login from unusual region") + .withEnabled(true) + .withRequiredDataConnectors( + Arrays.asList(new SecurityMLAnalyticsSettingsDataSource().withConnectorId("AWS") + .withDataTypes(Arrays.asList("AWSCloudTrail")))) + .withTactics(Arrays.asList(AttackTactic.EXFILTRATION, AttackTactic.COMMAND_AND_CONTROL)) + .withTechniques(Arrays.asList("T1037", "T1021")) + .withAnomalyVersion("1.0.5") + .withCustomizableObservations(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"multiSelectObservations\":null,\"prioritizeExcludeObservations\":null,\"singleSelectObservations\":[{\"name\":\"Device vendor\",\"description\":\"Select device vendor of network connection logs from CommonSecurityLog\",\"rerun\":\"RerunAlways\",\"sequenceNumber\":1,\"supportedValues\":[\"Palo Alto Networks\",\"Fortinet\",\"Check Point\"],\"supportedValuesKql\":null,\"value\":[\"Palo Alto Networks\"],\"valuesKql\":null}],\"singleValueObservations\":null,\"thresholdObservations\":[{\"name\":\"Daily data transfer threshold in MB\",\"description\":\"Suppress anomalies when daily data transfered (in MB) per hour is less than the chosen value\",\"maximum\":\"100\",\"minimum\":\"1\",\"rerun\":\"RerunAlways\",\"sequenceNumber\":1,\"value\":\"25\"},{\"name\":\"Number of standard deviations\",\"description\":\"Triggers anomalies when number of standard deviations is greater than the chosen value\",\"maximum\":\"10\",\"minimum\":\"2\",\"rerun\":\"RerunAlways\",\"sequenceNumber\":2,\"value\":\"3\"}]}", + Object.class, SerializerEncoding.JSON)) + .withFrequency(Duration.parse("PT1H")) + .withSettingsStatus(SettingsStatus.PRODUCTION) + .withIsDefaultSettings(true) + .withAnomalySettingsVersion(0) + .withSettingsDefinitionId(UUID.fromString("f209187f-1d17-4431-94af-c141bf5f23db")), + com.azure.core.util.Context.NONE); + } +} +``` + +### Systems_ListActions + +```java +/** + * Samples for ProductSettings List. + */ +public final class ProductSettingsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/GetAllSettings.json + */ + /** + * Sample code: Get all settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Systems_ReportActionStatus + +```java +/** + * Samples for IncidentRelations Delete. + */ +public final class IncidentRelationsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/DeleteIncidentRelation.json + */ + /** + * Sample code: Delete the incident relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteTheIncidentRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentRelations() + .deleteWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### Systems_UndoAction + +```java +/** + * Samples for ProductTemplates List. + */ +public final class ProductTemplatesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetProductTemplates.json + */ + /** + * Sample code: Get all installed templates. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllInstalledTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productTemplates() + .list("myRg", "myWorkspace", null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligence_Count + +```java +/** + * Samples for BusinessApplicationAgents Delete. + */ +public final class BusinessApplicationAgentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgents_Delete.json + */ + /** + * Sample code: BusinessApplicationAgents_Delete. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + businessApplicationAgentsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgents() + .deleteWithResponse("myRg", "myWorkspace", "3d69632b-0b60-4af3-8720-77f01a25d34a", + com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligence_Query + +```java +import com.azure.resourcemanager.securityinsights.models.FileFormat; +import com.azure.resourcemanager.securityinsights.models.FileImportContentType; +import com.azure.resourcemanager.securityinsights.models.FileMetadata; +import com.azure.resourcemanager.securityinsights.models.IngestionMode; + +/** + * Samples for FileImports Create. + */ +public final class FileImportsCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/CreateFileImport.json + */ + /** + * Sample code: Create a file import. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createAFileImport(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withExistingWorkspace("myRg", "myWorkspace") + .withIngestionMode(IngestionMode.INGEST_ANY_VALID_RECORDS) + .withContentType(FileImportContentType.STIX_INDICATOR) + .withImportFile( + new FileMetadata().withFileFormat(FileFormat.JSON).withFileName("myFile.json").withFileSize(4653)) + .withSource("mySource") + .create(); + } +} +``` + +### ThreatIntelligenceIndicator_AppendTags + +```java +/** + * Samples for AlertRuleTemplates Get. + */ +public final class AlertRuleTemplatesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRuleTemplates/GetAlertRuleTemplateById.json + */ + /** + * Sample code: Get alert rule template by Id. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAlertRuleTemplateById(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRuleTemplates() + .getWithResponse("myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", + com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicator_Create + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.ConnectivityCriterion; +import com.azure.resourcemanager.securityinsights.models.ConnectorDataType; +import com.azure.resourcemanager.securityinsights.models.ConnectorDefinitionsAvailability; +import com.azure.resourcemanager.securityinsights.models.ConnectorDefinitionsPermissions; +import com.azure.resourcemanager.securityinsights.models.ConnectorDefinitionsResourceProvider; +import com.azure.resourcemanager.securityinsights.models.CustomPermissionDetails; +import com.azure.resourcemanager.securityinsights.models.CustomizableConnectorDefinition; +import com.azure.resourcemanager.securityinsights.models.CustomizableConnectorUiConfig; +import com.azure.resourcemanager.securityinsights.models.GraphQuery; +import com.azure.resourcemanager.securityinsights.models.InstructionStep; +import com.azure.resourcemanager.securityinsights.models.InstructionStepDetails; +import com.azure.resourcemanager.securityinsights.models.ProviderPermissionsScope; +import com.azure.resourcemanager.securityinsights.models.ResourceProviderRequiredPermissions; +import java.io.IOException; +import java.util.Arrays; + +/** + * Samples for DataConnectorDefinitions CreateOrUpdate. + */ +public final class DataConnectorDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/CreateCustomizableDataConnectorDefinition.json + */ + /** + * Sample code: Create data connector definition. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createDataConnectorDefinition( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectorDefinitions() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new CustomizableConnectorDefinition().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withConnectorUiConfig(new CustomizableConnectorUiConfig().withTitle("GitHub Enterprise Audit Log") + .withPublisher("GitHub") + .withDescriptionMarkdown( + "The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process.") + .withGraphQueries(Arrays.asList(new GraphQuery().withMetricName("Total events received") + .withLegend("GitHub audit log events") + .withBaseQuery("GitHubAuditLogPolling_CL"))) + .withDataTypes(Arrays.asList(new ConnectorDataType().withName("GitHubAuditLogPolling_CL") + .withLastDataReceivedQuery( + "GitHubAuditLogPolling_CL \n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"))) + .withConnectivityCriteria(Arrays.asList(new ConnectivityCriterion().withType("IsConnectedQuery") + .withValue(Arrays.asList( + "GitHubAuditLogPolling_CL \n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)")))) + .withAvailability(new ConnectorDefinitionsAvailability().withStatus(1).withIsPreview(false)) + .withPermissions(new ConnectorDefinitionsPermissions() + .withResourceProvider(Arrays.asList(new ConnectorDefinitionsResourceProvider() + .withProvider("Microsoft.OperationalInsights/workspaces") + .withPermissionsDisplayText("read and write permissions are required.") + .withProviderDisplayName("Workspace") + .withScope(ProviderPermissionsScope.WORKSPACE) + .withRequiredPermissions(new ResourceProviderRequiredPermissions().withRead(false) + .withWrite(true) + .withDelete(false) + .withAction(false)))) + .withCustoms(Arrays.asList(new CustomPermissionDetails() + .withName("GitHub API personal token Key") + .withDescription( + "You need access to GitHub personal token, the key should have 'admin:org' scope")))) + .withInstructionSteps(Arrays.asList(new InstructionStep() + .withTitle("Connect GitHub Enterprise Audit Log to Azure Sentinel") + .withDescription( + "Enable GitHub audit Logs. \n Follow [this](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create or find your personal key") + .withInstructions(Arrays.asList(new InstructionStepDetails() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"clientIdLabel\":\"Client ID\",\"clientSecretLabel\":\"Client Secret\",\"connectButtonLabel\":\"Connect\",\"disconnectButtonLabel\":\"Disconnect\"}", + Object.class, SerializerEncoding.JSON)) + .withType("OAuthForm")))))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicator_CreateIndicator + +```java +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + +/** + * Samples for EntityQueries List. + */ +public final class EntityQueriesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/GetEntityQueries.json + */ + /** + * Sample code: Get all entity queries. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllEntityQueries(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .list("myRg", "myWorkspace", EntityQueryTemplateKind.EXPANSION, com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicator_Delete + +```java +/** + * Samples for HuntComments Get. + */ +public final class HuntCommentsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntCommentById.json + */ + /** + * Sample code: Get a hunt comment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAHuntComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .getWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c535096", com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicator_Get + +```java +/** + * Samples for WatchlistItems Delete. + */ +public final class WatchlistItemsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/DeleteWatchlistItem.json + */ + /** + * Sample code: Delete a watchlist Item. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWatchlistItem(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlistItems() + .deleteWithResponse("myRg", "myWorkspace", "highValueAsset", "4008512e-1d30-48b2-9ee2-d3612ed9d3ea", + com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicator_QueryIndicators + +```java +/** + * Samples for OfficeConsents List. + */ +public final class OfficeConsentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * officeConsents/GetOfficeConsents.json + */ + /** + * Sample code: Get all office consents. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllOfficeConsents(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.officeConsents().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicator_ReplaceTags + +```java +/** + * Samples for BookmarkRelations Delete. + */ +public final class BookmarkRelationsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/DeleteBookmarkRelation.json + */ + /** + * Sample code: Delete the bookmark relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteTheBookmarkRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .deleteWithResponse("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicatorMetrics_List + +```java +/** + * Samples for ThreatIntelligenceIndicatorsOperation List. + */ +public final class ThreatIntelligenceIndicatorsOperationListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/GetThreatIntelligence.json + */ + /** + * Sample code: Get all threat intelligence indicators. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllThreatIntelligenceIndicators(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicatorsOperations() + .list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### ThreatIntelligenceIndicatorsOperation_List + +```java +/** + * Samples for ContentPackages List. + */ +public final class ContentPackagesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetPackages.json + */ + /** + * Sample code: Get all available packages. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllAvailablePackages(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackages() + .list("myRg", "myWorkspace", null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### TriggeredAnalyticsRuleRunOperation_Get + +```java +/** + * Samples for Metadata Delete. + */ +public final class MetadataDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/DeleteMetadata.json + */ + /** + * Sample code: Delete metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().deleteWithResponse("myRg", "myWorkspace", "metadataName", com.azure.core.util.Context.NONE); + } +} +``` + +### Update_Recommendation + +```java +import com.azure.resourcemanager.securityinsights.models.AnalyticsRuleRunTrigger; +import java.time.OffsetDateTime; + +/** + * Samples for AlertRuleOperation TriggerRuleRun. + */ +public final class AlertRuleOperationTriggerRuleRunSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * triggeredAnalyticsRuleRuns/triggerRuleRun_Post.json + */ + /** + * Sample code: triggerRuleRun_Post. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void triggerRuleRunPost(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRuleOperations() + .triggerRuleRun("myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", + new AnalyticsRuleRunTrigger().withExecutionTimeUtc(OffsetDateTime.parse("2022-12-22T15:37:03.074Z")), + com.azure.core.util.Context.NONE); + } +} +``` + +### WatchlistItems_CreateOrUpdate + +```java +/** + * Samples for DataConnectorDefinitions Delete. + */ +public final class DataConnectorDefinitionsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/DeleteDataConnectorDefinitionById.json + */ + /** + * Sample code: Delete data connector definition. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteDataConnectorDefinition(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorDefinitions() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} +``` + +### WatchlistItems_Delete + +```java +/** + * Samples for FileImports List. + */ +public final class FileImportsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/GetFileImports.json + */ + /** + * Sample code: Get all file imports. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllFileImports(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .list("myRg", "myWorkspace", null, "properties/createdTimeUtc desc", 1, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### WatchlistItems_Get + +```java +/** + * Samples for DataConnectors Disconnect. + */ +public final class DataConnectorsDisconnectSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DisconnectAPIPolling.json + */ + /** + * Sample code: Disconnect an APIPolling data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void disconnectAnAPIPollingDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .disconnectWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); + } +} +``` + +### WatchlistItems_List + +```java +/** + * Samples for Incidents ListAlerts. + */ +public final class IncidentsListAlertsSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentAlerts/Incidents_ListAlerts.json + */ + /** + * Sample code: Incidents_ListAlerts. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void incidentsListAlerts(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .listAlertsWithResponse("myRg", "myWorkspace", "69a30280-6a4c-4aa7-9af0-5d63f335d600", + com.azure.core.util.Context.NONE); + } +} +``` + +### Watchlists_CreateOrUpdate + +```java +/** + * Samples for HuntComments Delete. + */ +public final class HuntCommentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/DeleteHuntComment.json + */ + /** + * Sample code: Delete a hunt comment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAHuntComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .deleteWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c123456", com.azure.core.util.Context.NONE); + } +} +``` + +### Watchlists_Delete + +```java +/** + * Samples for Entities Get. + */ +public final class EntitiesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetSubmissionMailEntityById.json + */ + /** + * Sample code: Get a submissionMail entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getASubmissionMailEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetDnsEntityById.json + */ + /** + * Sample code: Get a dns entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getADnsEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "f4e74920-f2c0-4412-a45f-66d94fdf01f8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetFileHashEntityById.json + */ + /** + * Sample code: Get a file hash entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAFileHashEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "ea359fa6-c1e5-f878-e105-6344f3e399a1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetIoTDeviceEntityById.json + */ + /** + * Sample code: Get an IoT device entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnIoTDeviceEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetRegistryKeyEntityById.json + */ + /** + * Sample code: Get a registry key entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getARegistryKeyEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMailboxEntityById.json + */ + /** + * Sample code: Get a mailbox entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMailboxEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMalwareEntityById.json + */ + /** + * Sample code: Get a malware entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMalwareEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "af378b21-b4aa-4fe7-bc70-13f8621a322f", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetSecurityAlertEntityById.json + */ + /** + * Sample code: Get a security alert entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getASecurityAlertEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "4aa486e0-6f85-41af-99ea-7acdce7be6c8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetIpEntityById.json + */ + /** + * Sample code: Get an ip entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnIpEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetAccountEntityById.json + */ + /** + * Sample code: Get an account entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnAccountEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetCloudApplicationEntityById.json + */ + /** + * Sample code: Get a cloud application entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getACloudApplicationEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetFileEntityById.json + */ + /** + * Sample code: Get a file entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAFileEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "af378b21-b4aa-4fe7-bc70-13f8621a322f", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetRegistryValueEntityById.json + */ + /** + * Sample code: Get a registry value entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getARegistryValueEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "dc44bd11-b348-4d76-ad29-37bf7aa41356", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetUrlEntityById.json + */ + /** + * Sample code: Get a url entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAUrlEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMailClusterEntityById.json + */ + /** + * Sample code: Get a mailCluster entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAMailClusterEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetSecurityGroupEntityById.json + */ + /** + * Sample code: Get a security group entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getASecurityGroupEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMailMessageEntityById.json + */ + /** + * Sample code: Get a mailMessage entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAMailMessageEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetAzureResourceEntityById.json + */ + /** + * Sample code: Get an azure resource entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnAzureResourceEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetHostEntityById.json + */ + /** + * Sample code: Get a host entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAHostEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetProcessEntityById.json + */ + /** + * Sample code: Get a process entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAProcessEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "7264685c-038c-42c6-948c-38e14ef1fb98", + com.azure.core.util.Context.NONE); + } +} +``` + +### Watchlists_Get + +```java +/** + * Samples for Systems List. + */ +public final class SystemsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_List.json + */ + /** + * Sample code: Systems_List. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void systemsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .list("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a", null, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Watchlists_List + +```java +/** + * Samples for WorkspaceManagerAssignments Delete. + */ +public final class WorkspaceManagerAssignmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/DeleteWorkspaceManagerAssignment.json + */ + /** + * Sample code: Delete a workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWorkspaceManagerAssignment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .deleteWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerAssignmentJobs_Create + +```java +import com.azure.resourcemanager.securityinsights.models.AlertDetail; +import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; +import com.azure.resourcemanager.securityinsights.models.AlertProperty; +import com.azure.resourcemanager.securityinsights.models.AlertPropertyMapping; +import com.azure.resourcemanager.securityinsights.models.AlertSeverity; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.EntityMapping; +import com.azure.resourcemanager.securityinsights.models.EntityMappingType; +import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; +import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; +import com.azure.resourcemanager.securityinsights.models.FieldMapping; +import com.azure.resourcemanager.securityinsights.models.FusionAlertRule; +import com.azure.resourcemanager.securityinsights.models.FusionSourceSettings; +import com.azure.resourcemanager.securityinsights.models.FusionSourceSubTypeSetting; +import com.azure.resourcemanager.securityinsights.models.FusionSubTypeSeverityFilter; +import com.azure.resourcemanager.securityinsights.models.FusionSubTypeSeverityFiltersItem; +import com.azure.resourcemanager.securityinsights.models.GroupingConfiguration; +import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; +import com.azure.resourcemanager.securityinsights.models.MatchingMethod; +import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRule; +import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; +import com.azure.resourcemanager.securityinsights.models.NrtAlertRule; +import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRule; +import com.azure.resourcemanager.securityinsights.models.SentinelEntityMapping; +import com.azure.resourcemanager.securityinsights.models.TriggerOperator; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AlertRules CreateOrUpdate. + */ +public final class AlertRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateFusionAlertRule.json + */ + /** + * Sample code: Creates or updates a Fusion alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAFusionAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .createOrUpdateWithResponse("myRg", "myWorkspace", "myFirstFusionRule", + new FusionAlertRule().withEtag("3d00c3ca-0000-0100-0000-5d42d5010000") + .withAlertRuleTemplateName("f71aba3d-28fb-450b-b192-4e76a83015c8") + .withEnabled(true) + .withSourceSettings(Arrays.asList( + new FusionSourceSettings().withEnabled(true).withSourceName("Anomalies"), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Alert providers") + .withSourceSubTypes(Arrays.asList( + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Active Directory Identity Protection") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender for IoT") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft 365 Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Cloud App Security") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Endpoint") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Identity") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Office 365") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Sentinel scheduled analytics rules") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))))), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Raw logs from other sources") + .withSourceSubTypes(Arrays.asList(new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Palo Alto Networks") + .withSeverityFilters(new FusionSubTypeSeverityFilter()))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateMicrosoftSecurityIncidentCreationAlertRule.json + */ + /** + * Sample code: Creates or updates a MicrosoftSecurityIncidentCreation rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAMicrosoftSecurityIncidentCreationRule( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .createOrUpdateWithResponse("myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", + new MicrosoftSecurityIncidentCreationAlertRule().withEtag("\"260097e0-0000-0d00-0000-5d6fa88f0000\"") + .withDisplayName("testing displayname") + .withEnabled(true) + .withProductFilter(MicrosoftSecurityProductName.MICROSOFT_CLOUD_APP_SECURITY), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateScheduledAlertRule.json + */ + /** + * Sample code: Creates or updates a Scheduled alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAScheduledAlertRule( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new ScheduledAlertRule().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDescription("An example for a scheduled rule") + .withDisplayName("My scheduled rule") + .withEnabled(true) + .withSuppressionDuration(Duration.parse("PT1H")) + .withSuppressionEnabled(false) + .withTactics(Arrays.asList(AttackTactic.PERSISTENCE, AttackTactic.LATERAL_MOVEMENT)) + .withTechniques(Arrays.asList("T1037", "T1021")) + .withIncidentConfiguration(new IncidentConfiguration().withCreateIncident(true) + .withGroupingConfiguration(new GroupingConfiguration().withEnabled(true) + .withReopenClosedIncident(false) + .withLookbackDuration(Duration.parse("PT5H")) + .withMatchingMethod(MatchingMethod.SELECTED) + .withGroupByEntities(Arrays.asList(EntityMappingType.HOST)) + .withGroupByAlertDetails(Arrays.asList(AlertDetail.DISPLAY_NAME)) + .withGroupByCustomDetails(Arrays.asList("OperatingSystemType", "OperatingSystemName")))) + .withQuery("Heartbeat") + .withQueryFrequency(Duration.parse("PT1H")) + .withQueryPeriod(Duration.parse("P2DT1H30M")) + .withSeverity(AlertSeverity.HIGH) + .withTriggerOperator(TriggerOperator.GREATER_THAN) + .withTriggerThreshold(0) + .withEventGroupingSettings( + new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.ALERT_PER_RESULT)) + .withCustomDetails(mapOf("OperatingSystemName", "OSName", "OperatingSystemType", "OSType")) + .withEntityMappings(Arrays.asList( + new EntityMapping().withEntityType(EntityMappingType.HOST) + .withFieldMappings(Arrays + .asList(new FieldMapping().withIdentifier("FullName").withColumnName("Computer"))), + new EntityMapping().withEntityType(EntityMappingType.IP) + .withFieldMappings(Arrays + .asList(new FieldMapping().withIdentifier("Address").withColumnName("ComputerIP"))))) + .withAlertDetailsOverride(new AlertDetailsOverride() + .withAlertDisplayNameFormat("Alert from {{Computer}}") + .withAlertDescriptionFormat("Suspicious activity was made by {{ComputerIP}}") + .withAlertDynamicProperties(Arrays.asList( + new AlertPropertyMapping().withAlertProperty(AlertProperty.PRODUCT_COMPONENT_NAME) + .withValue("ProductComponentNameCustomColumn"), + new AlertPropertyMapping().withAlertProperty(AlertProperty.PRODUCT_NAME) + .withValue("ProductNameCustomColumn"), + new AlertPropertyMapping().withAlertProperty(AlertProperty.ALERT_LINK).withValue("Link")))) + .withSentinelEntitiesMappings( + Arrays.asList(new SentinelEntityMapping().withColumnName("Entities"))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateFusionAlertRuleWithFusionScenarioExclusion.json + */ + /** + * Sample code: Creates or updates a Fusion alert rule with scenario exclusion pattern. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAFusionAlertRuleWithScenarioExclusionPattern( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .createOrUpdateWithResponse("myRg", "myWorkspace", "myFirstFusionRule", + new FusionAlertRule().withEtag("3d00c3ca-0000-0100-0000-5d42d5010000") + .withAlertRuleTemplateName("f71aba3d-28fb-450b-b192-4e76a83015c8") + .withEnabled(true) + .withSourceSettings(Arrays.asList( + new FusionSourceSettings().withEnabled(true).withSourceName("Anomalies"), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Alert providers") + .withSourceSubTypes(Arrays.asList( + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Active Directory Identity Protection") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender for IoT") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft 365 Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Cloud App Security") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Endpoint") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Identity") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Office 365") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Sentinel scheduled analytics rules") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))))), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Raw logs from other sources") + .withSourceSubTypes(Arrays.asList(new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Palo Alto Networks") + .withSeverityFilters(new FusionSubTypeSeverityFilter()))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateNrtAlertRule.json + */ + /** + * Sample code: Creates or updates a Nrt alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesANrtAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new NrtAlertRule().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDescription("") + .withQuery( + "ProtectionStatus | extend HostCustomEntity = Computer | extend IPCustomEntity = ComputerIP_Hidden") + .withTactics(Arrays.asList(AttackTactic.PERSISTENCE, AttackTactic.LATERAL_MOVEMENT)) + .withTechniques(Arrays.asList("T1037", "T1021")) + .withDisplayName("Rule2") + .withEnabled(true) + .withSuppressionDuration(Duration.parse("PT1H")) + .withSuppressionEnabled(false) + .withSeverity(AlertSeverity.HIGH) + .withIncidentConfiguration(new IncidentConfiguration().withCreateIncident(true) + .withGroupingConfiguration(new GroupingConfiguration().withEnabled(true) + .withReopenClosedIncident(false) + .withLookbackDuration(Duration.parse("PT5H")) + .withMatchingMethod(MatchingMethod.SELECTED) + .withGroupByEntities(Arrays.asList(EntityMappingType.HOST, EntityMappingType.ACCOUNT)))) + .withEventGroupingSettings( + new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.ALERT_PER_RESULT)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### WorkspaceManagerAssignmentJobs_Delete + +```java +/** + * Samples for WorkspaceManagerAssignmentJobs List. + */ +public final class WorkspaceManagerAssignmentJobsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetAllJobs.json + */ + /** + * Sample code: Get all jobs for the specified Sentinel workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllJobsForTheSpecifiedSentinelWorkspaceManagerAssignment( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignmentJobs() + .list("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", null, null, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerAssignmentJobs_Get + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.SourceKind; +import com.azure.resourcemanager.securityinsights.models.SupportTier; +import java.io.IOException; + +/** + * Samples for ContentTemplateOperation Install. + */ +public final class ContentTemplateOperationInstallSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/InstallTemplate.json + */ + /** + * Sample code: Get a template. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getATemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) + throws IOException { + manager.contentTemplateOperations() + .define("str.azure-sentinel-solution-str") + .withExistingWorkspace("myRg", "myWorkspace") + .withMainTemplate(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"$schema\":\"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\"contentVersion\":\"1.0.1\",\"resources\":[{\"name\":\"8365ebfe-a381-45b7-ad08-7d818070e11f\",\"type\":\"Microsoft.SecurityInsights/AlertRuleTemplates\",\"apiVersion\":\"2022-04-01-preview\",\"kind\":\"Scheduled\",\"location\":\"[parameters('workspace-location')]\",\"properties\":{\"description\":\"Creates an incident when a large number of Critical/High severity CrowdStrike Falcon sensor detections is triggered by a single user\",\"displayName\":\"Critical or High Severity Detections by User\",\"enabled\":false,\"query\":\"...\",\"queryFrequency\":\"PT1H\",\"queryPeriod\":\"PT1H\",\"severity\":\"High\",\"status\":\"Available\",\"suppressionDuration\":\"PT1H\",\"suppressionEnabled\":false,\"triggerOperator\":\"GreaterThan\",\"triggerThreshold\":0}},{\"name\":\"[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split([resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', 8365ebfe-a381-45b7-ad08-7d818070e11f)],'/'))))]\",\"type\":\"Microsoft.OperationalInsights/workspaces/providers/metadata\",\"apiVersion\":\"2022-01-01-preview\",\"properties\":{\"description\":\"CrowdStrike Falcon Endpoint Protection Analytics Rule 1\",\"author\":{\"name\":\"Microsoft\",\"email\":\"support@microsoft.com\"},\"contentId\":\"4465ebde-b381-45f7-ad08-7d818070a11c\",\"kind\":\"AnalyticsRule\",\"parentId\":\"[resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', 8365ebfe-a381-45b7-ad08-7d818070e11f)]\",\"source\":{\"name\":\"str\",\"kind\":\"Solution\",\"sourceId\":\"str.azure-sentinel-solution-str\"},\"support\":{\"name\":\"Microsoft Corporation\",\"email\":\"support@microsoft.com\",\"link\":\"https://support.microsoft.com/\",\"tier\":\"Microsoft\"},\"version\":\"1.0.0\"}}]}", + Object.class, SerializerEncoding.JSON)) + .withContentId("8365ebfe-a381-45b7-ad08-7d818070e11f") + .withContentProductId("str.azure-sentinel-solution-str-ar-cbfe4fndz66bi") + .withPackageVersion("1.0.0") + .withVersion("1.0.1") + .withDisplayName("API Protection workbook template") + .withContentKind(Kind.ANALYTICS_RULE) + .withSource(new MetadataSource().withKind(SourceKind.SOLUTION) + .withName("str") + .withSourceId("str.azure-sentinel-solution-str")) + .withAuthor(new MetadataAuthor().withName("Microsoft").withEmail("support@microsoft.com")) + .withSupport(new MetadataSupport().withTier(SupportTier.MICROSOFT) + .withName("Microsoft Corporation") + .withEmail("support@microsoft.com") + .withLink("https://support.microsoft.com/")) + .withPackageId("str.azure-sentinel-solution-str") + .withPackageKind(PackageKind.SOLUTION) + .withPackageName("str") + .create(); + } +} +``` + +### WorkspaceManagerAssignmentJobs_List + +```java +/** + * Samples for ContentTemplates List. + */ +public final class ContentTemplatesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetTemplates.json + */ + /** + * Sample code: Get all installed templates. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllInstalledTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentTemplates() + .list("myRg", "myWorkspace", null, null, null, null, null, null, null, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerAssignments_CreateOrUpdate + +```java +import com.azure.resourcemanager.securityinsights.fluent.models.RepositoryAccess; +import com.azure.resourcemanager.securityinsights.models.ContentType; +import com.azure.resourcemanager.securityinsights.models.RepoType; +import com.azure.resourcemanager.securityinsights.models.Repository; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import java.util.Arrays; + +/** + * Samples for SourceControlsOperation Create. + */ +public final class SourceControlsOperationCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/CreateSourceControl.json + */ + /** + * Sample code: Creates or updates a source control. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesASourceControl(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations() + .define("789e0c1f-4a3d-43ad-809c-e713b677b04a") + .withExistingWorkspace("myRg", "myWorkspace") + .withDisplayName("My Source Control") + .withRepoType(RepoType.GITHUB) + .withContentTypes(Arrays.asList(ContentType.ANALYTICS_RULE, ContentType.WORKBOOK)) + .withRepository(new Repository().withUrl("https://github.com/user/repo") + .withBranch("master") + .withDisplayUrl("https://github.com/user/repo")) + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDescription("This is a source control") + .withRepositoryAccess(new RepositoryAccess().withKind(RepositoryAccessKind.OAUTH) + .withCode("fakeTokenPlaceholder") + .withState("state") + .withClientId("54b3c2c0-1f48-4a1c-af9f-6399c3240b73")) + .create(); + } +} +``` + +### WorkspaceManagerAssignments_Delete + +```java +import com.azure.resourcemanager.securityinsights.models.ActivityCustomEntityQuery; +import com.azure.resourcemanager.securityinsights.models.ActivityEntityQueriesPropertiesQueryDefinitions; +import com.azure.resourcemanager.securityinsights.models.EntityType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EntityQueries CreateOrUpdate. + */ +public final class EntityQueriesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/CreateEntityQueryActivity.json + */ + /** + * Sample code: Creates or updates an Activity entity query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAnActivityEntityQuery( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .createOrUpdateWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + new ActivityCustomEntityQuery().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withTitle("An account was deleted on this host") + .withContent("On '{{Computer}}' the account '{{TargetAccount}}' was deleted by '{{AddedBy}}'") + .withDescription("Account deleted on host") + .withQueryDefinitions(new ActivityEntityQueriesPropertiesQueryDefinitions().withQuery( + "let GetAccountActions = (v_Host_Name:string, v_Host_NTDomain:string, v_Host_DnsDomain:string, v_Host_AzureID:string, v_Host_OMSAgentID:string){\nSecurityEvent\n| where EventID in (4725, 4726, 4767, 4720, 4722, 4723, 4724)\n// parsing for Host to handle variety of conventions coming from data\n| extend Host_HostName = case(\nComputer has '@', tostring(split(Computer, '@')[0]),\nComputer has '\\\\', tostring(split(Computer, '\\\\')[1]),\nComputer has '.', tostring(split(Computer, '.')[0]),\nComputer\n)\n| extend Host_NTDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', tostring(split(Computer, '.')[-2]), \nComputer\n)\n| extend Host_DnsDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', strcat_array(array_slice(split(Computer,'.'),-2,-1),'.'), \nComputer\n)\n| where (Host_HostName =~ v_Host_Name and Host_NTDomain =~ v_Host_NTDomain) \nor (Host_HostName =~ v_Host_Name and Host_DnsDomain =~ v_Host_DnsDomain) \nor v_Host_AzureID =~ _ResourceId \nor v_Host_OMSAgentID == SourceComputerId\n| project TimeGenerated, EventID, Activity, Computer, TargetAccount, TargetUserName, TargetDomainName, TargetSid, SubjectUserName, SubjectUserSid, _ResourceId, SourceComputerId\n| extend AddedBy = SubjectUserName\n// Future support for Activities\n| extend timestamp = TimeGenerated, HostCustomEntity = Computer, AccountCustomEntity = TargetAccount\n};\nGetAccountActions('{{Host_HostName}}', '{{Host_NTDomain}}', '{{Host_DnsDomain}}', '{{Host_AzureID}}', '{{Host_OMSAgentID}}')\n \n| where EventID == 4726 ")) + .withInputEntityType(EntityType.HOST) + .withRequiredInputFieldsSets(Arrays.asList(Arrays.asList("Host_HostName", "Host_NTDomain"), + Arrays.asList("Host_HostName", "Host_DnsDomain"), Arrays.asList("Host_AzureID"), + Arrays.asList("Host_OMSAgentID"))) + .withEntitiesFilter(mapOf("Host_OsFamily", Arrays.asList("Windows"))) + .withEnabled(true), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### WorkspaceManagerAssignments_Get + +```java +/** + * Samples for GetRecommendations List. + */ +public final class GetRecommendationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/GetRecommendations.json + */ + /** + * Sample code: Get Recommendations list. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getRecommendationsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.getRecommendations().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerAssignments_List + +```java +import com.azure.resourcemanager.securityinsights.models.EntityExpandParameters; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** + * Samples for Entities Expand. + */ +public final class EntitiesExpandSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/expand/PostExpandEntity.json + */ + /** + * Sample code: Expand an entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void expandAnEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .expandWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + new EntityExpandParameters().withEndTime(OffsetDateTime.parse("2019-05-26T00:00:00.000Z")) + .withExpansionId(UUID.fromString("a77992f3-25e9-4d01-99a4-5ff606cc410a")) + .withStartTime(OffsetDateTime.parse("2019-04-25T00:00:00.000Z")), + com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerConfigurations_CreateOrUpdate + +```java +import com.azure.resourcemanager.securityinsights.models.ConditionClause; +import com.azure.resourcemanager.securityinsights.models.Operator; +import com.azure.resourcemanager.securityinsights.models.Query; +import com.azure.resourcemanager.securityinsights.models.QueryCondition; +import com.azure.resourcemanager.securityinsights.models.QuerySortBy; +import com.azure.resourcemanager.securityinsights.models.SortingDirection; +import com.azure.resourcemanager.securityinsights.models.TiType; +import java.util.Arrays; + +/** + * Samples for ThreatIntelligence Query. + */ +public final class ThreatIntelligenceQuerySamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/PostThreatIntelligenceQuery.json + */ + /** + * Sample code: Get TI objects. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getTIObjects(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligences() + .query("myRg", "myWorkspace", TiType.MAIN, + new Query() + .withCondition(new QueryCondition().withStixObjectType("attack-pattern") + .withClauses(Arrays.asList(new ConditionClause().withField("lastUpdatedTimeUtc") + .withOperator(Operator.ON_OR_BEFORE_ABSOLUTE) + .withValues(Arrays.asList("2024-02-09T23:59:59.999Z"))))) + .withSortBy(new QuerySortBy().withDirection(SortingDirection.DESC).withField("lastUpdatedTimeUtc")) + .withMaxPageSize(100) + .withMinPageSize(100), + com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerConfigurations_Delete + +```java +/** + * Samples for WatchlistItems List. + */ +public final class WatchlistItemsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlistItems.json + */ + /** + * Sample code: Get all watchlist Items. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllWatchlistItems(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.watchlistItems().list("myRg", "myWorkspace", "highValueAsset", null, com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerConfigurations_Get + +```java +/** + * Samples for EntityRelations GetRelation. + */ +public final class EntityRelationsGetRelationSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/relations/GetEntityRelationByName.json + */ + /** + * Sample code: Get an entity relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnEntityRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityRelations() + .getRelationWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerConfigurations_List + +```java +import com.azure.resourcemanager.securityinsights.models.AssignmentItem; +import java.util.Arrays; + +/** + * Samples for WorkspaceManagerAssignments CreateOrUpdate. + */ +public final class WorkspaceManagerAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/CreateOrUpdateWorkspaceManagerAssignment.json + */ + /** + * Sample code: Creates or updates a workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAWorkspaceManagerAssignment( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .define("47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58") + .withExistingWorkspace("myRg", "myWorkspace") + .withTargetResourceName("37207a7a-3b8a-438f-a559-c7df400e1b96") + .withItems(Arrays.asList(new AssignmentItem().withResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspac-es/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExampleOne"), + new AssignmentItem().withResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspac-es/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExampleTwo"))) + .create(); + } +} +``` + +### WorkspaceManagerGroups_CreateOrUpdate + +```java +/** + * Samples for BillingStatistics List. + */ +public final class BillingStatisticsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * billingStatistics/GetAllBillingStatistics.json + */ + /** + * Sample code: Get all Microsoft Sentinel billing statistics. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllMicrosoftSentinelBillingStatistics( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.billingStatistics().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspaceManagerGroups_Delete + +```java +/** + * Samples for DataConnectors Get. + */ +public final class DataConnectorsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAzureActiveDirectoryById.json + */ + /** + * Sample code: Get an AADIP (Azure Active Directory Identity Protection) data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnAADIPAzureActiveDirectoryIdentityProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOffice365ProjectDataConnetorById.json + */ + /** + * Sample code: Get an Office365 Project data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnOffice365ProjectDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetGenericUI.json + */ + /** + * Sample code: Get a GenericUI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAGenericUIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetPurviewAuditDataConnectorById.json + */ + /** + * Sample code: Get a PurviewAudit data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAPurviewAuditDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOffice365AdvancedThreatProtectionById.json + */ + /** + * Sample code: Get an Office ATP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnOfficeATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "3d3e955e-33eb-401d-89a7-251c81ddd660", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetIoTById.json + */ + /** + * Sample code: Get a IoT data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAIoTDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "d2e5dc7a-f3a2-429d-954b-939fa8c2932e", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftCloudAppSecurityById.json + */ + /** + * Sample code: Get a MCAS data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAMCASDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "b96d014d-b5c2-4a01-9aba-a8058f629d42", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetThreatIntelligenceTaxiiById.json + */ + /** + * Sample code: Get a TI Taxii data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getATITaxiiDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c39bb458-02a7-4b3f-b0c8-71a1d2692652", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftThreatIntelligenceById.json + */ + /** + * Sample code: Get a MicrosoftThreatIntelligence data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMicrosoftThreatIntelligenceDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAzureSecurityCenterById.json + */ + /** + * Sample code: Get a ASC data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAASCDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetThreatIntelligenceById.json + */ + /** + * Sample code: Get a TI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getATIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAmazonWebServicesCloudTrailById.json + */ + /** + * Sample code: Get an AwsCloudTrail data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnAwsCloudTrailDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json + */ + /** + * Sample code: Get a MDATP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAMDATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "06b3ccb8-1384-4bcc-aec7-852f6d57161b", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftThreatProtectionById.json + */ + /** + * Sample code: Get a MicrosoftThreatProtection data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMicrosoftThreatProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftPurviewInformationProtectionDataConnetorById.json + */ + /** + * Sample code: Get a MicrosoftPurviewInformationProtection data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMicrosoftPurviewInformationProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAzureAdvancedThreatProtectionById.json + */ + /** + * Sample code: Get an AATP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnAATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "07e42cb3-e658-4e90-801c-efa0f29d3d44", + com.azure.core.util.Context.NONE); + } + /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/GetThreatIntelligenceById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAPIPolling.json */ /** - * Sample code: View a threat intelligence indicator by name. + * Sample code: Get a APIPolling data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void viewAThreatIntelligenceIndicatorByName( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicators() - .getWithResponse("myRg", "myWorkspace", "e16ef847-962e-d7b6-9c8b-a33e4bd30e47", + public static void + getAAPIPollingDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", com.azure.core.util.Context.NONE); } -} -``` - -### ThreatIntelligenceIndicator_QueryIndicators - -```java -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceFilteringCriteria; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceSortingCriteria; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceSortingOrder; -import java.util.Arrays; -/** - * Samples for ThreatIntelligenceIndicator QueryIndicators. - */ -public final class ThreatIntelligenceIndicatorQueryIndicatorsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/QueryThreatIntelligence.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftInsiderRiskManagementById.json */ /** - * Sample code: Query threat intelligence indicators as per filtering criteria. + * Sample code: Get an Office IRM data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void queryThreatIntelligenceIndicatorsAsPerFilteringCriteria( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicators() - .queryIndicators("myRg", "myWorkspace", new ThreatIntelligenceFilteringCriteria().withPageSize(100) - .withMinConfidence(25) - .withMaxConfidence(80) - .withMinValidUntil("2020-04-05T17:44:00.114052Z") - .withMaxValidUntil("2020-04-25T17:44:00.114052Z") - .withSortBy(Arrays.asList(new ThreatIntelligenceSortingCriteria().withItemKey("fakeTokenPlaceholder") - .withSortOrder(ThreatIntelligenceSortingOrder.DESCENDING))) - .withSources(Arrays.asList("Azure Sentinel")), com.azure.core.util.Context.NONE); + public static void + getAnOfficeIRMDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "3d3e955e-33eb-401d-89a7-251c81ddd660", + com.azure.core.util.Context.NONE); } -} -``` - -### ThreatIntelligenceIndicator_ReplaceTags - -```java -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorModel; -import java.util.Arrays; -/** - * Samples for ThreatIntelligenceIndicator ReplaceTags. - */ -public final class ThreatIntelligenceIndicatorReplaceTagsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/ReplaceTagsThreatIntelligence.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetDynamics365DataConnectorById.json */ /** - * Sample code: Replace tags to a Threat Intelligence. + * Sample code: Get a Dynamics365 data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - replaceTagsToAThreatIntelligence(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicators() - .replaceTagsWithResponse("myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - new ThreatIntelligenceIndicatorModel().withEtag("\"0000262c-0000-0800-0000-5e9767060000\"") - .withThreatIntelligenceTags(Arrays.asList("patching tags")), + getADynamics365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c2541efb-c9a6-47fe-9501-87d1017d1512", com.azure.core.util.Context.NONE); } -} -``` - -### ThreatIntelligenceIndicatorMetrics_List -```java -/** - * Samples for ThreatIntelligenceIndicatorMetrics List. - */ -public final class ThreatIntelligenceIndicatorMetricsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/CollectThreatIntelligenceMetrics.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOfficeDataConnetorById.json */ /** - * Sample code: Get threat intelligence indicators metrics. + * Sample code: Get an Office365 data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getThreatIntelligenceIndicatorsMetrics( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicatorMetrics() - .listWithResponse("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + public static void + getAnOffice365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); } -} -``` - -### ThreatIntelligenceIndicatorsOperation_List -```java -/** - * Samples for ThreatIntelligenceIndicatorsOperation List. - */ -public final class ThreatIntelligenceIndicatorsOperationListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * threatintelligence/GetThreatIntelligence.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetGoogleCloudPlatformById.json */ /** - * Sample code: Get all threat intelligence indicators. + * Sample code: Get a GCP data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAllThreatIntelligenceIndicators(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.threatIntelligenceIndicatorsOperations() - .list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + getAGCPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + com.azure.core.util.Context.NONE); } -} -``` - -### WatchlistItems_CreateOrUpdate - -```java -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -/** - * Samples for WatchlistItems CreateOrUpdate. - */ -public final class WatchlistItemsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * CreateWatchlistItem.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAmazonWebServicesS3ById.json */ /** - * Sample code: Create or update a watchlist item. + * Sample code: Get an Aws S3 data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createOrUpdateAWatchlistItem( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { - manager.watchlistItems() - .define("82ba292c-dc97-4dfc-969d-d4dd9e666842") - .withExistingWatchlist("myRg", "myWorkspace", "highValueAsset") - .withEtag("0300bf09-0000-0000-0000-5c37296e0000") - .withItemsKeyValue(SerializerFactory.createDefaultManagementSerializerAdapter() - .deserialize( - "{\"Business tier\":\"10.0.2.0/24\",\"Data tier\":\"10.0.2.0/24\",\"Gateway subnet\":\"10.0.255.224/27\",\"Private DMZ in\":\"10.0.0.0/27\",\"Public DMZ out\":\"10.0.0.96/27\",\"Web Tier\":\"10.0.1.0/24\"}", - Object.class, SerializerEncoding.JSON)) - .create(); + public static void + getAnAwsS3DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "afef3743-0c88-469c-84ff-ca2e87dc1e48", + com.azure.core.util.Context.NONE); } -} -``` - -### WatchlistItems_Delete -```java -/** - * Samples for WatchlistItems Delete. - */ -public final class WatchlistItemsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * DeleteWatchlistItem.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetRestApiPollerById.json */ /** - * Sample code: Delete a watchlist item. + * Sample code: Get a RestApiPoller data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - deleteAWatchlistItem(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlistItems() - .deleteWithResponse("myRg", "myWorkspace", "highValueAsset", "4008512e-1d30-48b2-9ee2-d3612ed9d3ea", + getARestApiPollerDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "RestApiPoller_fce27b90-d6f5-4d30-991a-af509a2b50a1", com.azure.core.util.Context.NONE); } -} -``` - -### WatchlistItems_Get -```java -/** - * Samples for WatchlistItems Get. - */ -public final class WatchlistItemsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlistItemById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOfficePowerBIDataConnetorById.json */ /** - * Sample code: Get a watchlist item. + * Sample code: Get an Office365 PowerBI data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAWatchlistItem(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlistItems() - .getWithResponse("myRg", "myWorkspace", "highValueAsset", "3f8901fe-63d9-4875-9ad5-9fb3b8105797", + public static void + getAnOffice365PowerBIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } } ``` -### WatchlistItems_List +### WorkspaceManagerGroups_Get ```java +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.HuntOwner; +import com.azure.resourcemanager.securityinsights.models.HypothesisStatus; +import com.azure.resourcemanager.securityinsights.models.Status; +import java.util.Arrays; +import java.util.UUID; + /** - * Samples for WatchlistItems List. + * Samples for Hunts CreateOrUpdate. */ -public final class WatchlistItemsListSamples { +public final class HuntsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlistItems.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/CreateHunt.json */ /** - * Sample code: Get all watchlist Items. + * Sample code: Creates or updates a hunt. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAllWatchlistItems(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlistItems().list("myRg", "myWorkspace", "highValueAsset", null, com.azure.core.util.Context.NONE); + createsOrUpdatesAHunt(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts() + .define("163e7b2a-a2ec-4041-aaba-d878a38f265f") + .withExistingWorkspace("myRg", "myWorkspace") + .withDisplayName("Log4J new hunt") + .withDescription("Log4J Hunt Description") + .withStatus(Status.NEW) + .withHypothesisStatus(HypothesisStatus.UNKNOWN) + .withAttackTactics(Arrays.asList(AttackTactic.RECONNAISSANCE)) + .withAttackTechniques(Arrays.asList("T1595")) + .withLabels(Arrays.asList("Label1", "Label2")) + .withOwner(new HuntOwner().withObjectId(UUID.fromString("873b5263-5d34-4149-b356-ad341b01e123"))) + .create(); } } ``` -### Watchlists_CreateOrUpdate +### WorkspaceManagerGroups_List ```java -import com.azure.resourcemanager.securityinsights.models.Source; - /** - * Samples for Watchlists CreateOrUpdate. + * Samples for ProductTemplateOperation Get. */ -public final class WatchlistsCreateOrUpdateSamples { +public final class ProductTemplateOperationGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * CreateWatchlist.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetProductTemplateById.json */ /** - * Sample code: Create or update a watchlist. + * Sample code: Get a template. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - createOrUpdateAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlists() - .define("highValueAsset") - .withExistingWorkspace("myRg", "myWorkspace") - .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withDisplayName("High Value Assets Watchlist") - .withProvider("Microsoft") - .withSource(Source.LOCAL_FILE) - .withDescription("Watchlist from CSV content") - .withItemsSearchKey("header1") - .create(); + public static void getATemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productTemplateOperations() + .getWithResponse("myRg", "myWorkspace", "8365ebfe-a381-45b7-ad08-7d818070e11f", + com.azure.core.util.Context.NONE); } +} +``` + +### WorkspaceManagerMembers_CreateOrUpdate +```java +/** + * Samples for SentinelOnboardingStates Delete. + */ +public final class SentinelOnboardingStatesDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * CreateWatchlistAndWatchlistItems.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * onboardingStates/DeleteSentinelOnboardingState.json */ /** - * Sample code: Create or update a watchlist and bulk creates watchlist items. + * Sample code: Delete Sentinel onboarding state. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createOrUpdateAWatchlistAndBulkCreatesWatchlistItems( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlists() - .define("highValueAsset") - .withExistingWorkspace("myRg", "myWorkspace") - .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withDisplayName("High Value Assets Watchlist") - .withProvider("Microsoft") - .withSource(Source.LOCAL_FILE) - .withDescription("Watchlist from CSV content") - .withNumberOfLinesToSkip(1) - .withRawContent("This line will be skipped\nheader1,header2\nvalue1,value2") - .withItemsSearchKey("header1") - .withContentType("text/csv") - .create(); + public static void + deleteSentinelOnboardingState(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sentinelOnboardingStates() + .deleteWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); } } ``` -### Watchlists_Delete +### WorkspaceManagerMembers_Delete ```java /** - * Samples for Watchlists Delete. + * Samples for IncidentComments Delete. */ -public final class WatchlistsDeleteSamples { +public final class IncidentCommentsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * DeleteWatchlist.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_Delete.json */ /** - * Sample code: Delete a watchlist. + * Sample code: IncidentComments_Delete. * * @param manager Entry point to SecurityInsightsManager. */ - public static void deleteAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlists() - .deleteWithResponse("myRg", "myWorkspace", "highValueAsset", com.azure.core.util.Context.NONE); + public static void + incidentCommentsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentComments() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); } } ``` -### Watchlists_Get +### WorkspaceManagerMembers_Get ```java /** - * Samples for Watchlists Get. + * Samples for IncidentRelations List. */ -public final class WatchlistsGetSamples { +public final class IncidentRelationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlistByAlias.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/GetAllIncidentRelations.json */ /** - * Sample code: Get a watchlist. + * Sample code: Get all incident relations. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlists().getWithResponse("myRg", "myWorkspace", "highValueAsset", com.azure.core.util.Context.NONE); + public static void + getAllIncidentRelations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentRelations() + .list("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` -### Watchlists_List +### WorkspaceManagerMembers_List ```java +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceFilteringCriteria; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceSortingCriteria; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceSortingOrder; +import java.util.Arrays; + /** - * Samples for Watchlists List. + * Samples for ThreatIntelligenceIndicator QueryIndicators. */ -public final class WatchlistsListSamples { +public final class ThreatIntelligenceIndicatorQueryIndicatorsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlists.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/QueryThreatIntelligence.json */ /** - * Sample code: Get all watchlists. + * Sample code: Query threat intelligence indicators as per filtering criteria. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAllWatchlists(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlists().list("myRg", "myWorkspace", null, com.azure.core.util.Context.NONE); + public static void queryThreatIntelligenceIndicatorsAsPerFilteringCriteria( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligenceIndicators() + .queryIndicators("myRg", "myWorkspace", new ThreatIntelligenceFilteringCriteria().withPageSize(100) + .withMinConfidence(25) + .withMaxConfidence(80) + .withMinValidUntil("2021-04-05T17:44:00.114052Z") + .withMaxValidUntil("2021-04-25T17:44:00.114052Z") + .withSortBy(Arrays.asList(new ThreatIntelligenceSortingCriteria().withItemKey("fakeTokenPlaceholder") + .withSortOrder(ThreatIntelligenceSortingOrder.DESCENDING))) + .withSources(Arrays.asList("Azure Sentinel")), com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml b/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml index 706bf58ce128..93d70273f479 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -18,7 +18,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. jar Microsoft Azure SDK for SecurityInsights Management - This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-2022-11. + This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2025-04-01. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ Code generated by Microsoft (R) AutoRest Code Generator. UTF-8 0 0 - false + true diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/SecurityInsightsManager.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/SecurityInsightsManager.java index de2bd8903d4c..81a7568e5e8b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/SecurityInsightsManager.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/SecurityInsightsManager.java @@ -22,47 +22,141 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.securityinsights.fluent.SecurityInsights; import com.azure.resourcemanager.securityinsights.implementation.ActionsImpl; +import com.azure.resourcemanager.securityinsights.implementation.AlertRuleOperationsImpl; import com.azure.resourcemanager.securityinsights.implementation.AlertRuleTemplatesImpl; import com.azure.resourcemanager.securityinsights.implementation.AlertRulesImpl; import com.azure.resourcemanager.securityinsights.implementation.AutomationRulesImpl; +import com.azure.resourcemanager.securityinsights.implementation.BillingStatisticsImpl; +import com.azure.resourcemanager.securityinsights.implementation.BookmarkOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.BookmarkRelationsImpl; import com.azure.resourcemanager.securityinsights.implementation.BookmarksImpl; +import com.azure.resourcemanager.securityinsights.implementation.BusinessApplicationAgentOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.BusinessApplicationAgentsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ContentPackageOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ContentPackagesImpl; +import com.azure.resourcemanager.securityinsights.implementation.ContentTemplateOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ContentTemplatesImpl; +import com.azure.resourcemanager.securityinsights.implementation.DataConnectorDefinitionsImpl; +import com.azure.resourcemanager.securityinsights.implementation.DataConnectorsCheckRequirementsOperationsImpl; import com.azure.resourcemanager.securityinsights.implementation.DataConnectorsImpl; +import com.azure.resourcemanager.securityinsights.implementation.EntitiesGetTimelinesImpl; +import com.azure.resourcemanager.securityinsights.implementation.EntitiesImpl; +import com.azure.resourcemanager.securityinsights.implementation.EntitiesRelationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.EntityQueriesImpl; +import com.azure.resourcemanager.securityinsights.implementation.EntityQueryTemplatesImpl; +import com.azure.resourcemanager.securityinsights.implementation.EntityRelationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.FileImportsImpl; +import com.azure.resourcemanager.securityinsights.implementation.GetRecommendationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.GetTriggeredAnalyticsRuleRunsImpl; +import com.azure.resourcemanager.securityinsights.implementation.GetsImpl; +import com.azure.resourcemanager.securityinsights.implementation.HuntCommentsImpl; +import com.azure.resourcemanager.securityinsights.implementation.HuntRelationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.HuntsImpl; import com.azure.resourcemanager.securityinsights.implementation.IncidentCommentsImpl; import com.azure.resourcemanager.securityinsights.implementation.IncidentRelationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.IncidentTasksImpl; import com.azure.resourcemanager.securityinsights.implementation.IncidentsImpl; +import com.azure.resourcemanager.securityinsights.implementation.MetadatasImpl; +import com.azure.resourcemanager.securityinsights.implementation.OfficeConsentsImpl; import com.azure.resourcemanager.securityinsights.implementation.OperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ProductPackageOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ProductPackagesImpl; +import com.azure.resourcemanager.securityinsights.implementation.ProductSettingsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ProductTemplateOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ProductTemplatesImpl; +import com.azure.resourcemanager.securityinsights.implementation.ReevaluatesImpl; +import com.azure.resourcemanager.securityinsights.implementation.ResourceProvidersImpl; import com.azure.resourcemanager.securityinsights.implementation.SecurityInsightsBuilder; import com.azure.resourcemanager.securityinsights.implementation.SecurityMLAnalyticsSettingsImpl; import com.azure.resourcemanager.securityinsights.implementation.SentinelOnboardingStatesImpl; +import com.azure.resourcemanager.securityinsights.implementation.SourceControlsImpl; +import com.azure.resourcemanager.securityinsights.implementation.SourceControlsOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.SystemsImpl; import com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorMetricsImpl; import com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsImpl; import com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligencesImpl; +import com.azure.resourcemanager.securityinsights.implementation.TriggeredAnalyticsRuleRunOperationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.UpdatesImpl; import com.azure.resourcemanager.securityinsights.implementation.WatchlistItemsImpl; import com.azure.resourcemanager.securityinsights.implementation.WatchlistsImpl; +import com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerAssignmentJobsImpl; +import com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerAssignmentsImpl; +import com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerConfigurationsImpl; +import com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerGroupsImpl; +import com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerMembersImpl; import com.azure.resourcemanager.securityinsights.models.Actions; +import com.azure.resourcemanager.securityinsights.models.AlertRuleOperations; import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplates; import com.azure.resourcemanager.securityinsights.models.AlertRules; import com.azure.resourcemanager.securityinsights.models.AutomationRules; +import com.azure.resourcemanager.securityinsights.models.BillingStatistics; +import com.azure.resourcemanager.securityinsights.models.BookmarkOperations; +import com.azure.resourcemanager.securityinsights.models.BookmarkRelations; import com.azure.resourcemanager.securityinsights.models.Bookmarks; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgentOperations; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgents; +import com.azure.resourcemanager.securityinsights.models.ContentPackageOperations; +import com.azure.resourcemanager.securityinsights.models.ContentPackages; +import com.azure.resourcemanager.securityinsights.models.ContentTemplateOperations; +import com.azure.resourcemanager.securityinsights.models.ContentTemplates; +import com.azure.resourcemanager.securityinsights.models.DataConnectorDefinitions; import com.azure.resourcemanager.securityinsights.models.DataConnectors; +import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirementsOperations; +import com.azure.resourcemanager.securityinsights.models.Entities; +import com.azure.resourcemanager.securityinsights.models.EntitiesGetTimelines; +import com.azure.resourcemanager.securityinsights.models.EntitiesRelations; +import com.azure.resourcemanager.securityinsights.models.EntityQueries; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplates; +import com.azure.resourcemanager.securityinsights.models.EntityRelations; +import com.azure.resourcemanager.securityinsights.models.FileImports; +import com.azure.resourcemanager.securityinsights.models.GetRecommendations; +import com.azure.resourcemanager.securityinsights.models.GetTriggeredAnalyticsRuleRuns; +import com.azure.resourcemanager.securityinsights.models.Gets; +import com.azure.resourcemanager.securityinsights.models.HuntComments; +import com.azure.resourcemanager.securityinsights.models.HuntRelations; +import com.azure.resourcemanager.securityinsights.models.Hunts; import com.azure.resourcemanager.securityinsights.models.IncidentComments; import com.azure.resourcemanager.securityinsights.models.IncidentRelations; +import com.azure.resourcemanager.securityinsights.models.IncidentTasks; import com.azure.resourcemanager.securityinsights.models.Incidents; +import com.azure.resourcemanager.securityinsights.models.Metadatas; +import com.azure.resourcemanager.securityinsights.models.OfficeConsents; import com.azure.resourcemanager.securityinsights.models.Operations; +import com.azure.resourcemanager.securityinsights.models.ProductPackageOperations; +import com.azure.resourcemanager.securityinsights.models.ProductPackages; +import com.azure.resourcemanager.securityinsights.models.ProductSettings; +import com.azure.resourcemanager.securityinsights.models.ProductTemplateOperations; +import com.azure.resourcemanager.securityinsights.models.ProductTemplates; +import com.azure.resourcemanager.securityinsights.models.Reevaluates; +import com.azure.resourcemanager.securityinsights.models.ResourceProviders; import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettings; import com.azure.resourcemanager.securityinsights.models.SentinelOnboardingStates; +import com.azure.resourcemanager.securityinsights.models.SourceControls; +import com.azure.resourcemanager.securityinsights.models.SourceControlsOperations; +import com.azure.resourcemanager.securityinsights.models.Systems; import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorMetrics; import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicators; import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceIndicatorsOperations; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligences; +import com.azure.resourcemanager.securityinsights.models.TriggeredAnalyticsRuleRunOperations; +import com.azure.resourcemanager.securityinsights.models.Updates; import com.azure.resourcemanager.securityinsights.models.WatchlistItems; import com.azure.resourcemanager.securityinsights.models.Watchlists; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerAssignmentJobs; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerAssignments; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerConfigurations; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerGroups; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerMembers; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -79,31 +173,123 @@ public final class SecurityInsightsManager { private AutomationRules automationRules; + private Entities entities; + + private Incidents incidents; + + private BillingStatistics billingStatistics; + private Bookmarks bookmarks; + private BookmarkRelations bookmarkRelations; + + private BookmarkOperations bookmarkOperations; + + private BusinessApplicationAgents businessApplicationAgents; + + private BusinessApplicationAgentOperations businessApplicationAgentOperations; + + private Systems systems; + + private ContentPackages contentPackages; + + private ContentPackageOperations contentPackageOperations; + + private ProductPackages productPackages; + + private ProductPackageOperations productPackageOperations; + + private ProductTemplates productTemplates; + + private ProductTemplateOperations productTemplateOperations; + + private ContentTemplates contentTemplates; + + private ContentTemplateOperations contentTemplateOperations; + + private DataConnectorDefinitions dataConnectorDefinitions; + private DataConnectors dataConnectors; - private Incidents incidents; + private DataConnectorsCheckRequirementsOperations dataConnectorsCheckRequirementsOperations; + + private ResourceProviders resourceProviders; + + private EntitiesGetTimelines entitiesGetTimelines; + + private EntitiesRelations entitiesRelations; + + private EntityRelations entityRelations; + + private EntityQueries entityQueries; + + private EntityQueryTemplates entityQueryTemplates; + + private FileImports fileImports; + + private Hunts hunts; + + private HuntRelations huntRelations; + + private HuntComments huntComments; private IncidentComments incidentComments; private IncidentRelations incidentRelations; + private IncidentTasks incidentTasks; + + private Metadatas metadatas; + + private OfficeConsents officeConsents; + private SentinelOnboardingStates sentinelOnboardingStates; + private Operations operations; + + private GetRecommendations getRecommendations; + + private Gets gets; + + private Updates updates; + + private Reevaluates reevaluates; + private SecurityMLAnalyticsSettings securityMLAnalyticsSettings; + private ProductSettings productSettings; + + private SourceControls sourceControls; + + private SourceControlsOperations sourceControlsOperations; + private ThreatIntelligenceIndicators threatIntelligenceIndicators; private ThreatIntelligenceIndicatorsOperations threatIntelligenceIndicatorsOperations; private ThreatIntelligenceIndicatorMetrics threatIntelligenceIndicatorMetrics; + private ThreatIntelligences threatIntelligences; + + private TriggeredAnalyticsRuleRunOperations triggeredAnalyticsRuleRunOperations; + + private GetTriggeredAnalyticsRuleRuns getTriggeredAnalyticsRuleRuns; + + private AlertRuleOperations alertRuleOperations; + private Watchlists watchlists; private WatchlistItems watchlistItems; - private Operations operations; + private WorkspaceManagerAssignments workspaceManagerAssignments; + + private WorkspaceManagerAssignmentJobs workspaceManagerAssignmentJobs; + + private WorkspaceManagerConfigurations workspaceManagerConfigurations; + + private WorkspaceManagerGroups workspaceManagerGroups; + + private WorkspaceManagerMembers workspaceManagerMembers; private final SecurityInsights clientObject; @@ -157,6 +343,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-securityinsights.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -264,12 +453,14 @@ public SecurityInsightsManager authenticate(TokenCredential credential, AzurePro Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.securityinsights") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -363,6 +554,42 @@ public AutomationRules automationRules() { return automationRules; } + /** + * Gets the resource collection API of Entities. + * + * @return Resource collection API of Entities. + */ + public Entities entities() { + if (this.entities == null) { + this.entities = new EntitiesImpl(clientObject.getEntities(), this); + } + return entities; + } + + /** + * Gets the resource collection API of Incidents. It manages Incident. + * + * @return Resource collection API of Incidents. + */ + public Incidents incidents() { + if (this.incidents == null) { + this.incidents = new IncidentsImpl(clientObject.getIncidents(), this); + } + return incidents; + } + + /** + * Gets the resource collection API of BillingStatistics. + * + * @return Resource collection API of BillingStatistics. + */ + public BillingStatistics billingStatistics() { + if (this.billingStatistics == null) { + this.billingStatistics = new BillingStatisticsImpl(clientObject.getBillingStatistics(), this); + } + return billingStatistics; + } + /** * Gets the resource collection API of Bookmarks. It manages Bookmark. * @@ -375,6 +602,181 @@ public Bookmarks bookmarks() { return bookmarks; } + /** + * Gets the resource collection API of BookmarkRelations. It manages Relation. + * + * @return Resource collection API of BookmarkRelations. + */ + public BookmarkRelations bookmarkRelations() { + if (this.bookmarkRelations == null) { + this.bookmarkRelations = new BookmarkRelationsImpl(clientObject.getBookmarkRelations(), this); + } + return bookmarkRelations; + } + + /** + * Gets the resource collection API of BookmarkOperations. + * + * @return Resource collection API of BookmarkOperations. + */ + public BookmarkOperations bookmarkOperations() { + if (this.bookmarkOperations == null) { + this.bookmarkOperations = new BookmarkOperationsImpl(clientObject.getBookmarkOperations(), this); + } + return bookmarkOperations; + } + + /** + * Gets the resource collection API of BusinessApplicationAgents. It manages BusinessApplicationAgentResource. + * + * @return Resource collection API of BusinessApplicationAgents. + */ + public BusinessApplicationAgents businessApplicationAgents() { + if (this.businessApplicationAgents == null) { + this.businessApplicationAgents + = new BusinessApplicationAgentsImpl(clientObject.getBusinessApplicationAgents(), this); + } + return businessApplicationAgents; + } + + /** + * Gets the resource collection API of BusinessApplicationAgentOperations. + * + * @return Resource collection API of BusinessApplicationAgentOperations. + */ + public BusinessApplicationAgentOperations businessApplicationAgentOperations() { + if (this.businessApplicationAgentOperations == null) { + this.businessApplicationAgentOperations = new BusinessApplicationAgentOperationsImpl( + clientObject.getBusinessApplicationAgentOperations(), this); + } + return businessApplicationAgentOperations; + } + + /** + * Gets the resource collection API of Systems. It manages SystemResource. + * + * @return Resource collection API of Systems. + */ + public Systems systems() { + if (this.systems == null) { + this.systems = new SystemsImpl(clientObject.getSystems(), this); + } + return systems; + } + + /** + * Gets the resource collection API of ContentPackages. + * + * @return Resource collection API of ContentPackages. + */ + public ContentPackages contentPackages() { + if (this.contentPackages == null) { + this.contentPackages = new ContentPackagesImpl(clientObject.getContentPackages(), this); + } + return contentPackages; + } + + /** + * Gets the resource collection API of ContentPackageOperations. It manages PackageModel. + * + * @return Resource collection API of ContentPackageOperations. + */ + public ContentPackageOperations contentPackageOperations() { + if (this.contentPackageOperations == null) { + this.contentPackageOperations + = new ContentPackageOperationsImpl(clientObject.getContentPackageOperations(), this); + } + return contentPackageOperations; + } + + /** + * Gets the resource collection API of ProductPackages. + * + * @return Resource collection API of ProductPackages. + */ + public ProductPackages productPackages() { + if (this.productPackages == null) { + this.productPackages = new ProductPackagesImpl(clientObject.getProductPackages(), this); + } + return productPackages; + } + + /** + * Gets the resource collection API of ProductPackageOperations. + * + * @return Resource collection API of ProductPackageOperations. + */ + public ProductPackageOperations productPackageOperations() { + if (this.productPackageOperations == null) { + this.productPackageOperations + = new ProductPackageOperationsImpl(clientObject.getProductPackageOperations(), this); + } + return productPackageOperations; + } + + /** + * Gets the resource collection API of ProductTemplates. + * + * @return Resource collection API of ProductTemplates. + */ + public ProductTemplates productTemplates() { + if (this.productTemplates == null) { + this.productTemplates = new ProductTemplatesImpl(clientObject.getProductTemplates(), this); + } + return productTemplates; + } + + /** + * Gets the resource collection API of ProductTemplateOperations. + * + * @return Resource collection API of ProductTemplateOperations. + */ + public ProductTemplateOperations productTemplateOperations() { + if (this.productTemplateOperations == null) { + this.productTemplateOperations + = new ProductTemplateOperationsImpl(clientObject.getProductTemplateOperations(), this); + } + return productTemplateOperations; + } + + /** + * Gets the resource collection API of ContentTemplates. + * + * @return Resource collection API of ContentTemplates. + */ + public ContentTemplates contentTemplates() { + if (this.contentTemplates == null) { + this.contentTemplates = new ContentTemplatesImpl(clientObject.getContentTemplates(), this); + } + return contentTemplates; + } + + /** + * Gets the resource collection API of ContentTemplateOperations. It manages TemplateModel. + * + * @return Resource collection API of ContentTemplateOperations. + */ + public ContentTemplateOperations contentTemplateOperations() { + if (this.contentTemplateOperations == null) { + this.contentTemplateOperations + = new ContentTemplateOperationsImpl(clientObject.getContentTemplateOperations(), this); + } + return contentTemplateOperations; + } + + /** + * Gets the resource collection API of DataConnectorDefinitions. + * + * @return Resource collection API of DataConnectorDefinitions. + */ + public DataConnectorDefinitions dataConnectorDefinitions() { + if (this.dataConnectorDefinitions == null) { + this.dataConnectorDefinitions + = new DataConnectorDefinitionsImpl(clientObject.getDataConnectorDefinitions(), this); + } + return dataConnectorDefinitions; + } + /** * Gets the resource collection API of DataConnectors. * @@ -388,15 +790,136 @@ public DataConnectors dataConnectors() { } /** - * Gets the resource collection API of Incidents. It manages Incident. + * Gets the resource collection API of DataConnectorsCheckRequirementsOperations. * - * @return Resource collection API of Incidents. + * @return Resource collection API of DataConnectorsCheckRequirementsOperations. */ - public Incidents incidents() { - if (this.incidents == null) { - this.incidents = new IncidentsImpl(clientObject.getIncidents(), this); + public DataConnectorsCheckRequirementsOperations dataConnectorsCheckRequirementsOperations() { + if (this.dataConnectorsCheckRequirementsOperations == null) { + this.dataConnectorsCheckRequirementsOperations = new DataConnectorsCheckRequirementsOperationsImpl( + clientObject.getDataConnectorsCheckRequirementsOperations(), this); } - return incidents; + return dataConnectorsCheckRequirementsOperations; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * Gets the resource collection API of EntitiesGetTimelines. + * + * @return Resource collection API of EntitiesGetTimelines. + */ + public EntitiesGetTimelines entitiesGetTimelines() { + if (this.entitiesGetTimelines == null) { + this.entitiesGetTimelines = new EntitiesGetTimelinesImpl(clientObject.getEntitiesGetTimelines(), this); + } + return entitiesGetTimelines; + } + + /** + * Gets the resource collection API of EntitiesRelations. + * + * @return Resource collection API of EntitiesRelations. + */ + public EntitiesRelations entitiesRelations() { + if (this.entitiesRelations == null) { + this.entitiesRelations = new EntitiesRelationsImpl(clientObject.getEntitiesRelations(), this); + } + return entitiesRelations; + } + + /** + * Gets the resource collection API of EntityRelations. + * + * @return Resource collection API of EntityRelations. + */ + public EntityRelations entityRelations() { + if (this.entityRelations == null) { + this.entityRelations = new EntityRelationsImpl(clientObject.getEntityRelations(), this); + } + return entityRelations; + } + + /** + * Gets the resource collection API of EntityQueries. + * + * @return Resource collection API of EntityQueries. + */ + public EntityQueries entityQueries() { + if (this.entityQueries == null) { + this.entityQueries = new EntityQueriesImpl(clientObject.getEntityQueries(), this); + } + return entityQueries; + } + + /** + * Gets the resource collection API of EntityQueryTemplates. + * + * @return Resource collection API of EntityQueryTemplates. + */ + public EntityQueryTemplates entityQueryTemplates() { + if (this.entityQueryTemplates == null) { + this.entityQueryTemplates = new EntityQueryTemplatesImpl(clientObject.getEntityQueryTemplates(), this); + } + return entityQueryTemplates; + } + + /** + * Gets the resource collection API of FileImports. It manages FileImport. + * + * @return Resource collection API of FileImports. + */ + public FileImports fileImports() { + if (this.fileImports == null) { + this.fileImports = new FileImportsImpl(clientObject.getFileImports(), this); + } + return fileImports; + } + + /** + * Gets the resource collection API of Hunts. It manages Hunt. + * + * @return Resource collection API of Hunts. + */ + public Hunts hunts() { + if (this.hunts == null) { + this.hunts = new HuntsImpl(clientObject.getHunts(), this); + } + return hunts; + } + + /** + * Gets the resource collection API of HuntRelations. It manages HuntRelation. + * + * @return Resource collection API of HuntRelations. + */ + public HuntRelations huntRelations() { + if (this.huntRelations == null) { + this.huntRelations = new HuntRelationsImpl(clientObject.getHuntRelations(), this); + } + return huntRelations; + } + + /** + * Gets the resource collection API of HuntComments. It manages HuntComment. + * + * @return Resource collection API of HuntComments. + */ + public HuntComments huntComments() { + if (this.huntComments == null) { + this.huntComments = new HuntCommentsImpl(clientObject.getHuntComments(), this); + } + return huntComments; } /** @@ -412,7 +935,7 @@ public IncidentComments incidentComments() { } /** - * Gets the resource collection API of IncidentRelations. It manages Relation. + * Gets the resource collection API of IncidentRelations. * * @return Resource collection API of IncidentRelations. */ @@ -423,6 +946,42 @@ public IncidentRelations incidentRelations() { return incidentRelations; } + /** + * Gets the resource collection API of IncidentTasks. It manages IncidentTask. + * + * @return Resource collection API of IncidentTasks. + */ + public IncidentTasks incidentTasks() { + if (this.incidentTasks == null) { + this.incidentTasks = new IncidentTasksImpl(clientObject.getIncidentTasks(), this); + } + return incidentTasks; + } + + /** + * Gets the resource collection API of Metadatas. It manages MetadataModel. + * + * @return Resource collection API of Metadatas. + */ + public Metadatas metadatas() { + if (this.metadatas == null) { + this.metadatas = new MetadatasImpl(clientObject.getMetadatas(), this); + } + return metadatas; + } + + /** + * Gets the resource collection API of OfficeConsents. + * + * @return Resource collection API of OfficeConsents. + */ + public OfficeConsents officeConsents() { + if (this.officeConsents == null) { + this.officeConsents = new OfficeConsentsImpl(clientObject.getOfficeConsents(), this); + } + return officeConsents; + } + /** * Gets the resource collection API of SentinelOnboardingStates. It manages SentinelOnboardingState. * @@ -436,6 +995,66 @@ public SentinelOnboardingStates sentinelOnboardingStates() { return sentinelOnboardingStates; } + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of GetRecommendations. + * + * @return Resource collection API of GetRecommendations. + */ + public GetRecommendations getRecommendations() { + if (this.getRecommendations == null) { + this.getRecommendations = new GetRecommendationsImpl(clientObject.getGetRecommendations(), this); + } + return getRecommendations; + } + + /** + * Gets the resource collection API of Gets. + * + * @return Resource collection API of Gets. + */ + public Gets gets() { + if (this.gets == null) { + this.gets = new GetsImpl(clientObject.getGets(), this); + } + return gets; + } + + /** + * Gets the resource collection API of Updates. + * + * @return Resource collection API of Updates. + */ + public Updates updates() { + if (this.updates == null) { + this.updates = new UpdatesImpl(clientObject.getUpdates(), this); + } + return updates; + } + + /** + * Gets the resource collection API of Reevaluates. + * + * @return Resource collection API of Reevaluates. + */ + public Reevaluates reevaluates() { + if (this.reevaluates == null) { + this.reevaluates = new ReevaluatesImpl(clientObject.getReevaluates(), this); + } + return reevaluates; + } + /** * Gets the resource collection API of SecurityMLAnalyticsSettings. * @@ -449,6 +1068,43 @@ public SecurityMLAnalyticsSettings securityMLAnalyticsSettings() { return securityMLAnalyticsSettings; } + /** + * Gets the resource collection API of ProductSettings. + * + * @return Resource collection API of ProductSettings. + */ + public ProductSettings productSettings() { + if (this.productSettings == null) { + this.productSettings = new ProductSettingsImpl(clientObject.getProductSettings(), this); + } + return productSettings; + } + + /** + * Gets the resource collection API of SourceControls. + * + * @return Resource collection API of SourceControls. + */ + public SourceControls sourceControls() { + if (this.sourceControls == null) { + this.sourceControls = new SourceControlsImpl(clientObject.getSourceControls(), this); + } + return sourceControls; + } + + /** + * Gets the resource collection API of SourceControlsOperations. It manages SourceControl. + * + * @return Resource collection API of SourceControlsOperations. + */ + public SourceControlsOperations sourceControlsOperations() { + if (this.sourceControlsOperations == null) { + this.sourceControlsOperations + = new SourceControlsOperationsImpl(clientObject.getSourceControlsOperations(), this); + } + return sourceControlsOperations; + } + /** * Gets the resource collection API of ThreatIntelligenceIndicators. * @@ -488,6 +1144,56 @@ public ThreatIntelligenceIndicatorMetrics threatIntelligenceIndicatorMetrics() { return threatIntelligenceIndicatorMetrics; } + /** + * Gets the resource collection API of ThreatIntelligences. + * + * @return Resource collection API of ThreatIntelligences. + */ + public ThreatIntelligences threatIntelligences() { + if (this.threatIntelligences == null) { + this.threatIntelligences = new ThreatIntelligencesImpl(clientObject.getThreatIntelligences(), this); + } + return threatIntelligences; + } + + /** + * Gets the resource collection API of TriggeredAnalyticsRuleRunOperations. + * + * @return Resource collection API of TriggeredAnalyticsRuleRunOperations. + */ + public TriggeredAnalyticsRuleRunOperations triggeredAnalyticsRuleRunOperations() { + if (this.triggeredAnalyticsRuleRunOperations == null) { + this.triggeredAnalyticsRuleRunOperations = new TriggeredAnalyticsRuleRunOperationsImpl( + clientObject.getTriggeredAnalyticsRuleRunOperations(), this); + } + return triggeredAnalyticsRuleRunOperations; + } + + /** + * Gets the resource collection API of GetTriggeredAnalyticsRuleRuns. + * + * @return Resource collection API of GetTriggeredAnalyticsRuleRuns. + */ + public GetTriggeredAnalyticsRuleRuns getTriggeredAnalyticsRuleRuns() { + if (this.getTriggeredAnalyticsRuleRuns == null) { + this.getTriggeredAnalyticsRuleRuns + = new GetTriggeredAnalyticsRuleRunsImpl(clientObject.getGetTriggeredAnalyticsRuleRuns(), this); + } + return getTriggeredAnalyticsRuleRuns; + } + + /** + * Gets the resource collection API of AlertRuleOperations. + * + * @return Resource collection API of AlertRuleOperations. + */ + public AlertRuleOperations alertRuleOperations() { + if (this.alertRuleOperations == null) { + this.alertRuleOperations = new AlertRuleOperationsImpl(clientObject.getAlertRuleOperations(), this); + } + return alertRuleOperations; + } + /** * Gets the resource collection API of Watchlists. It manages Watchlist. * @@ -513,15 +1219,68 @@ public WatchlistItems watchlistItems() { } /** - * Gets the resource collection API of Operations. + * Gets the resource collection API of WorkspaceManagerAssignments. It manages WorkspaceManagerAssignment. * - * @return Resource collection API of Operations. + * @return Resource collection API of WorkspaceManagerAssignments. */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); + public WorkspaceManagerAssignments workspaceManagerAssignments() { + if (this.workspaceManagerAssignments == null) { + this.workspaceManagerAssignments + = new WorkspaceManagerAssignmentsImpl(clientObject.getWorkspaceManagerAssignments(), this); } - return operations; + return workspaceManagerAssignments; + } + + /** + * Gets the resource collection API of WorkspaceManagerAssignmentJobs. + * + * @return Resource collection API of WorkspaceManagerAssignmentJobs. + */ + public WorkspaceManagerAssignmentJobs workspaceManagerAssignmentJobs() { + if (this.workspaceManagerAssignmentJobs == null) { + this.workspaceManagerAssignmentJobs + = new WorkspaceManagerAssignmentJobsImpl(clientObject.getWorkspaceManagerAssignmentJobs(), this); + } + return workspaceManagerAssignmentJobs; + } + + /** + * Gets the resource collection API of WorkspaceManagerConfigurations. It manages WorkspaceManagerConfiguration. + * + * @return Resource collection API of WorkspaceManagerConfigurations. + */ + public WorkspaceManagerConfigurations workspaceManagerConfigurations() { + if (this.workspaceManagerConfigurations == null) { + this.workspaceManagerConfigurations + = new WorkspaceManagerConfigurationsImpl(clientObject.getWorkspaceManagerConfigurations(), this); + } + return workspaceManagerConfigurations; + } + + /** + * Gets the resource collection API of WorkspaceManagerGroups. It manages WorkspaceManagerGroup. + * + * @return Resource collection API of WorkspaceManagerGroups. + */ + public WorkspaceManagerGroups workspaceManagerGroups() { + if (this.workspaceManagerGroups == null) { + this.workspaceManagerGroups + = new WorkspaceManagerGroupsImpl(clientObject.getWorkspaceManagerGroups(), this); + } + return workspaceManagerGroups; + } + + /** + * Gets the resource collection API of WorkspaceManagerMembers. It manages WorkspaceManagerMember. + * + * @return Resource collection API of WorkspaceManagerMembers. + */ + public WorkspaceManagerMembers workspaceManagerMembers() { + if (this.workspaceManagerMembers == null) { + this.workspaceManagerMembers + = new WorkspaceManagerMembersImpl(clientObject.getWorkspaceManagerMembers(), this); + } + return workspaceManagerMembers; } /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/AlertRuleOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/AlertRuleOperationsClient.java new file mode 100644 index 000000000000..a1a3ad567bc0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/AlertRuleOperationsClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.securityinsights.models.AnalyticsRuleRunTrigger; + +/** + * An instance of this class provides access to all the operations defined in AlertRuleOperationsClient. + */ +public interface AlertRuleOperationsClient { + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginTriggerRuleRun(String resourceGroupName, String workspaceName, + String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter); + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginTriggerRuleRun(String resourceGroupName, String workspaceName, + String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context); + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter); + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BillingStatisticsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BillingStatisticsClient.java new file mode 100644 index 000000000000..6cac546c32ee --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BillingStatisticsClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner; + +/** + * An instance of this class provides access to all the operations defined in BillingStatisticsClient. + */ +public interface BillingStatisticsClient { + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String billingStatisticName, Context context); + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingStatisticInner get(String resourceGroupName, String workspaceName, String billingStatisticName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BookmarkOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BookmarkOperationsClient.java new file mode 100644 index 000000000000..8b2d374f6bb2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BookmarkOperationsClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkExpandResponseInner; +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandParameters; + +/** + * An instance of this class provides access to all the operations defined in BookmarkOperationsClient. + */ +public interface BookmarkOperationsClient { + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response expandWithResponse(String resourceGroupName, String workspaceName, + String bookmarkId, BookmarkExpandParameters parameters, Context context); + + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookmarkExpandResponseInner expand(String resourceGroupName, String workspaceName, String bookmarkId, + BookmarkExpandParameters parameters); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BookmarkRelationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BookmarkRelationsClient.java new file mode 100644 index 000000000000..4557bde35a70 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BookmarkRelationsClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; + +/** + * An instance of this class provides access to all the operations defined in BookmarkRelationsClient. + */ +public interface BookmarkRelationsClient { + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId); + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId, String filter, + String orderby, Integer top, String skipToken, Context context); + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context); + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RelationInner get(String resourceGroupName, String workspaceName, String bookmarkId, String relationName); + + /** + * Creates the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param relation The relation model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String bookmarkId, String relationName, RelationInner relation, Context context); + + /** + * Creates the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param relation The relation model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RelationInner createOrUpdate(String resourceGroupName, String workspaceName, String bookmarkId, String relationName, + RelationInner relation); + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context); + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String bookmarkId, String relationName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BusinessApplicationAgentOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BusinessApplicationAgentOperationsClient.java new file mode 100644 index 000000000000..7848115c0857 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BusinessApplicationAgentOperationsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; + +/** + * An instance of this class provides access to all the operations defined in BusinessApplicationAgentOperationsClient. + */ +public interface BusinessApplicationAgentOperationsClient { + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, Context context); + + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BusinessApplicationAgentResourceInner get(String resourceGroupName, String workspaceName, String agentResourceName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BusinessApplicationAgentsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BusinessApplicationAgentsClient.java new file mode 100644 index 000000000000..3304874cf357 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/BusinessApplicationAgentsClient.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; + +/** + * An instance of this class provides access to all the operations defined in BusinessApplicationAgentsClient. + */ +public interface BusinessApplicationAgentsClient { + /** + * Creates or updates the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param agentToUpsert The Business Application Agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the configuration of a Business Application Agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String agentResourceName, BusinessApplicationAgentResourceInner agentToUpsert, + Context context); + + /** + * Creates or updates the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the configuration of a Business Application Agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BusinessApplicationAgentResourceInner createOrUpdate(String resourceGroupName, String workspaceName, + String agentResourceName); + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + Context context); + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String agentResourceName); + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, + String filter, String skipToken, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentPackageOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentPackageOperationsClient.java new file mode 100644 index 000000000000..ee18a441f879 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentPackageOperationsClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; + +/** + * An instance of this class provides access to all the operations defined in ContentPackageOperationsClient. + */ +public interface ContentPackageOperationsClient { + /** + * Install a package to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param packageInstallationProperties Package installation properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Package in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response installWithResponse(String resourceGroupName, String workspaceName, String packageId, + PackageModelInner packageInstallationProperties, Context context); + + /** + * Install a package to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param packageInstallationProperties Package installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Package in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageModelInner install(String resourceGroupName, String workspaceName, String packageId, + PackageModelInner packageInstallationProperties); + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response uninstallWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context); + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void uninstall(String resourceGroupName, String workspaceName, String packageId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentPackagesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentPackagesClient.java new file mode 100644 index 000000000000..76591a74767c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentPackagesClient.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; + +/** + * An instance of this class provides access to all the operations defined in ContentPackagesClient. + */ +public interface ContentPackagesClient { + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + String search, Boolean count, Integer top, Integer skip, String skipToken, Context context); + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context); + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageModelInner get(String resourceGroupName, String workspaceName, String packageId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentTemplateOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentTemplateOperationsClient.java new file mode 100644 index 000000000000..1ae2dacd2d8b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentTemplateOperationsClient.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; + +/** + * An instance of this class provides access to all the operations defined in ContentTemplateOperationsClient. + */ +public interface ContentTemplateOperationsClient { + /** + * Install a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param templateInstallationProperties Template installation properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return template resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response installWithResponse(String resourceGroupName, String workspaceName, String templateId, + TemplateModelInner templateInstallationProperties, Context context); + + /** + * Install a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param templateInstallationProperties Template installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return template resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TemplateModelInner install(String resourceGroupName, String workspaceName, String templateId, + TemplateModelInner templateInstallationProperties); + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context); + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TemplateModelInner get(String resourceGroupName, String workspaceName, String templateId); + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context); + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String templateId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentTemplatesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentTemplatesClient.java new file mode 100644 index 000000000000..08b3a964aef5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ContentTemplatesClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; + +/** + * An instance of this class provides access to all the operations defined in ContentTemplatesClient. + */ +public interface ContentTemplatesClient { + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param expand Expands the object with optional fiends that are not included by default. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String expand, String search, Boolean count, Integer top, Integer skip, String skipToken, + Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorDefinitionsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorDefinitionsClient.java new file mode 100644 index 000000000000..3260ecd1af62 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorDefinitionsClient.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; + +/** + * An instance of this class provides access to all the operations defined in DataConnectorDefinitionsClient. + */ +public interface DataConnectorDefinitionsClient { + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context); + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataConnectorDefinitionInner get(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName); + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput, Context context); + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataConnectorDefinitionInner createOrUpdate(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput); + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context); + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String dataConnectorDefinitionName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorsCheckRequirementsOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorsCheckRequirementsOperationsClient.java new file mode 100644 index 000000000000..14968c0845e2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorsCheckRequirementsOperationsClient.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorRequirementsStateInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirements; + +/** + * An instance of this class provides access to all the operations defined in + * DataConnectorsCheckRequirementsOperationsClient. + */ +public interface DataConnectorsCheckRequirementsOperationsClient { + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response postWithResponse(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements, Context context); + + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataConnectorRequirementsStateInner post(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorsClient.java index 241dad74d594..2f2bf170bc80 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorsClient.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/DataConnectorsClient.java @@ -10,6 +10,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorConnectBody; /** * An instance of this class provides access to all the operations defined in DataConnectorsClient. @@ -133,4 +134,65 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String workspaceName, String dataConnectorId); + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response connectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody, Context context); + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void connect(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody); + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response disconnectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + Context context); + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void disconnect(String resourceGroupName, String workspaceName, String dataConnectorId); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesClient.java new file mode 100644 index 000000000000..2743c491c1d1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesClient.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityExpandResponseInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityGetInsightsResponseInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner; +import com.azure.resourcemanager.securityinsights.models.EntityExpandParameters; +import com.azure.resourcemanager.securityinsights.models.EntityGetInsightsParameters; +import com.azure.resourcemanager.securityinsights.models.EntityItemQueryKind; +import com.azure.resourcemanager.securityinsights.models.EntityManualTriggerRequestBody; + +/** + * An instance of this class provides access to all the operations defined in EntitiesClient. + */ +public interface EntitiesClient { + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @param requestBody Describes the request body for triggering a playbook on an entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, String entityIdentifier, + EntityManualTriggerRequestBody requestBody, Context context); + + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void runPlaybook(String resourceGroupName, String workspaceName, String entityIdentifier); + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String entityId, + Context context); + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EntityInner get(String resourceGroupName, String workspaceName, String entityId); + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response expandWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityExpandParameters parameters, Context context); + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EntityExpandResponseInner expand(String resourceGroupName, String workspaceName, String entityId, + EntityExpandParameters parameters); + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind); + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind, Context context); + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInsightsWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityGetInsightsParameters parameters, Context context); + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EntityGetInsightsResponseInner getInsights(String resourceGroupName, String workspaceName, String entityId, + EntityGetInsightsParameters parameters); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesGetTimelinesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesGetTimelinesClient.java new file mode 100644 index 000000000000..3eca25a3f85e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesGetTimelinesClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityTimelineResponseInner; +import com.azure.resourcemanager.securityinsights.models.EntityTimelineParameters; + +/** + * An instance of this class provides access to all the operations defined in EntitiesGetTimelinesClient. + */ +public interface EntitiesGetTimelinesClient { + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityTimelineParameters parameters, Context context); + + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EntityTimelineResponseInner list(String resourceGroupName, String workspaceName, String entityId, + EntityTimelineParameters parameters); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesRelationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesRelationsClient.java new file mode 100644 index 000000000000..ae701c02c33a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntitiesRelationsClient.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; + +/** + * An instance of this class provides access to all the operations defined in EntitiesRelationsClient. + */ +public interface EntitiesRelationsClient { + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String entityId); + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String entityId, String filter, + String orderby, Integer top, String skipToken, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityQueriesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityQueriesClient.java new file mode 100644 index 000000000000..09edcf2a25c9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityQueriesClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; +import com.azure.resourcemanager.securityinsights.models.CustomEntityQuery; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + +/** + * An instance of this class provides access to all the operations defined in EntityQueriesClient. + */ +public interface EntityQueriesClient { + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, EntityQueryTemplateKind kind, + Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String entityQueryId, + Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EntityQueryInner get(String resourceGroupName, String workspaceName, String entityQueryId); + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String entityQueryId, CustomEntityQuery entityQuery, Context context); + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EntityQueryInner createOrUpdate(String resourceGroupName, String workspaceName, String entityQueryId, + CustomEntityQuery entityQuery); + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String entityQueryId, + Context context); + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String entityQueryId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityQueryTemplatesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityQueryTemplatesClient.java new file mode 100644 index 000000000000..9d7db77efd7a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityQueryTemplatesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + +/** + * An instance of this class provides access to all the operations defined in EntityQueryTemplatesClient. + */ +public interface EntityQueryTemplatesClient { + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity template query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String entityQueryTemplateId, Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EntityQueryTemplateInner get(String resourceGroupName, String workspaceName, String entityQueryTemplateId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityRelationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityRelationsClient.java new file mode 100644 index 000000000000..146a29937afc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/EntityRelationsClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; + +/** + * An instance of this class provides access to all the operations defined in EntityRelationsClient. + */ +public interface EntityRelationsClient { + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getRelationWithResponse(String resourceGroupName, String workspaceName, String entityId, + String relationName, Context context); + + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RelationInner getRelation(String resourceGroupName, String workspaceName, String entityId, String relationName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/FileImportsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/FileImportsClient.java new file mode 100644 index 000000000000..37a2e8384545 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/FileImportsClient.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.securityinsights.fluent.models.FileImportInner; + +/** + * An instance of this class provides access to all the operations defined in FileImportsClient. + */ +public interface FileImportsClient { + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String fileImportId, + Context context); + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FileImportInner get(String resourceGroupName, String workspaceName, String fileImportId); + + /** + * Creates the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param fileImport The file import. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String workspaceName, String fileImportId, + FileImportInner fileImport, Context context); + + /** + * Creates the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param fileImport The file import. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FileImportInner create(String resourceGroupName, String workspaceName, String fileImportId, + FileImportInner fileImport); + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FileImportInner> beginDelete(String resourceGroupName, String workspaceName, + String fileImportId); + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FileImportInner> beginDelete(String resourceGroupName, String workspaceName, + String fileImportId, Context context); + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FileImportInner delete(String resourceGroupName, String workspaceName, String fileImportId); + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FileImportInner delete(String resourceGroupName, String workspaceName, String fileImportId, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetRecommendationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetRecommendationsClient.java new file mode 100644 index 000000000000..1112c25993e1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetRecommendationsClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; + +/** + * An instance of this class provides access to all the operations defined in GetRecommendationsClient. + */ +public interface GetRecommendationsClient { + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetTriggeredAnalyticsRuleRunsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetTriggeredAnalyticsRuleRunsClient.java new file mode 100644 index 000000000000..0c44336ced41 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetTriggeredAnalyticsRuleRunsClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; + +/** + * An instance of this class provides access to all the operations defined in GetTriggeredAnalyticsRuleRunsClient. + */ +public interface GetTriggeredAnalyticsRuleRunsClient { + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetsClient.java new file mode 100644 index 000000000000..f2f9c0b31a21 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/GetsClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in GetsClient. + */ +public interface GetsClient { + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response singleRecommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, Context context); + + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendationInner singleRecommendation(String resourceGroupName, String workspaceName, UUID recommendationId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntCommentsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntCommentsClient.java new file mode 100644 index 000000000000..5f4c778f9188 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntCommentsClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntCommentInner; + +/** + * An instance of this class provides access to all the operations defined in HuntCommentsClient. + */ +public interface HuntCommentsClient { + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String huntId); + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String huntId, String filter, + String orderby, Integer top, String skipToken, Context context); + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context); + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HuntCommentInner get(String resourceGroupName, String workspaceName, String huntId, String huntCommentId); + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context); + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String huntId, String huntCommentId); + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param huntComment The hunt comment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Comment in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, HuntCommentInner huntComment, Context context); + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param huntComment The hunt comment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Comment in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HuntCommentInner createOrUpdate(String resourceGroupName, String workspaceName, String huntId, String huntCommentId, + HuntCommentInner huntComment); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntRelationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntRelationsClient.java new file mode 100644 index 000000000000..b369335b6631 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntRelationsClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntRelationInner; + +/** + * An instance of this class provides access to all the operations defined in HuntRelationsClient. + */ +public interface HuntRelationsClient { + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String huntId); + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String huntId, String filter, + String orderby, Integer top, String skipToken, Context context); + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context); + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HuntRelationInner get(String resourceGroupName, String workspaceName, String huntId, String huntRelationId); + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context); + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String huntId, String huntRelationId); + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param huntRelation The hunt relation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Relation in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String huntId, String huntRelationId, HuntRelationInner huntRelation, Context context); + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param huntRelation The hunt relation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Relation in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HuntRelationInner createOrUpdate(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, HuntRelationInner huntRelation); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntsClient.java new file mode 100644 index 000000000000..332fc849539a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/HuntsClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntInner; + +/** + * An instance of this class provides access to all the operations defined in HuntsClient. + */ +public interface HuntsClient { + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, Context context); + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HuntInner get(String resourceGroupName, String workspaceName, String huntId); + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, Context context); + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String huntId); + + /** + * Create or update a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param hunt The hunt. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, String huntId, + HuntInner hunt, Context context); + + /** + * Create or update a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param hunt The hunt. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HuntInner createOrUpdate(String resourceGroupName, String workspaceName, String huntId, HuntInner hunt); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentCommentsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentCommentsClient.java index 107b4c042966..b007f5c6df9b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentCommentsClient.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentCommentsClient.java @@ -16,7 +16,7 @@ */ public interface IncidentCommentsClient { /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -24,13 +24,13 @@ public interface IncidentCommentsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedIterable}. + * @return all incident comments as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -45,14 +45,14 @@ public interface IncidentCommentsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedIterable}. + * @return all incident comments as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, String filter, String orderby, Integer top, String skipToken, Context context); /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -62,14 +62,14 @@ PagedIterable list(String resourceGroupName, String worksp * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident along with {@link Response}. + * @return an incident comment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, String incidentCommentId, Context context); /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -78,14 +78,14 @@ Response getWithResponse(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident. + * @return an incident comment. */ @ServiceMethod(returns = ReturnType.SINGLE) IncidentCommentInner get(String resourceGroupName, String workspaceName, String incidentId, String incidentCommentId); /** - * Creates or updates a comment for a given incident. + * Creates or updates the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -103,7 +103,7 @@ Response createOrUpdateWithResponse(String resourceGroupNa String incidentId, String incidentCommentId, IncidentCommentInner incidentComment, Context context); /** - * Creates or updates a comment for a given incident. + * Creates or updates the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -120,7 +120,7 @@ IncidentCommentInner createOrUpdate(String resourceGroupName, String workspaceNa String incidentCommentId, IncidentCommentInner incidentComment); /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -137,7 +137,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName String incidentCommentId, Context context); /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentRelationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentRelationsClient.java index a739b64b2d6e..261d6a8f0bad 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentRelationsClient.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentRelationsClient.java @@ -16,7 +16,7 @@ */ public interface IncidentRelationsClient { /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -24,13 +24,13 @@ public interface IncidentRelationsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedIterable}. + * @return all incident relations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -45,14 +45,14 @@ public interface IncidentRelationsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedIterable}. + * @return all incident relations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, String filter, String orderby, Integer top, String skipToken, Context context); /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -62,14 +62,14 @@ PagedIterable list(String resourceGroupName, String workspaceName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident along with {@link Response}. + * @return an incident relation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, String relationName, Context context); /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -78,13 +78,13 @@ Response getWithResponse(String resourceGroupName, String workspa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident. + * @return an incident relation. */ @ServiceMethod(returns = ReturnType.SINGLE) RelationInner get(String resourceGroupName, String workspaceName, String incidentId, String relationName); /** - * Creates or updates a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -102,7 +102,7 @@ Response createOrUpdateWithResponse(String resourceGroupName, Str String incidentId, String relationName, RelationInner relation, Context context); /** - * Creates or updates a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -119,7 +119,7 @@ RelationInner createOrUpdate(String resourceGroupName, String workspaceName, Str RelationInner relation); /** - * Deletes a relation for a given incident. + * Delete the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -136,7 +136,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName String relationName, Context context); /** - * Deletes a relation for a given incident. + * Delete the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentTasksClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentTasksClient.java new file mode 100644 index 000000000000..69cc0c887325 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentTasksClient.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.IncidentTaskInner; + +/** + * An instance of this class provides access to all the operations defined in IncidentTasksClient. + */ +public interface IncidentTasksClient { + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String incidentId); + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, + Context context); + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, Context context); + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IncidentTaskInner get(String resourceGroupName, String workspaceName, String incidentId, String incidentTaskId); + + /** + * Creates or updates the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param incidentTask The incident task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId, IncidentTaskInner incidentTask, Context context); + + /** + * Creates or updates the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param incidentTask The incident task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IncidentTaskInner createOrUpdate(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, IncidentTaskInner incidentTask); + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, Context context); + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String incidentId, String incidentTaskId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentsClient.java index 169fe6e21f31..9ef9676e3e1d 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentsClient.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/IncidentsClient.java @@ -13,11 +13,43 @@ import com.azure.resourcemanager.securityinsights.fluent.models.IncidentBookmarkListInner; import com.azure.resourcemanager.securityinsights.fluent.models.IncidentEntitiesResponseInner; import com.azure.resourcemanager.securityinsights.fluent.models.IncidentInner; +import com.azure.resourcemanager.securityinsights.models.ManualTriggerRequestBody; /** * An instance of this class provides access to all the operations defined in IncidentsClient. */ public interface IncidentsClient { + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @param requestBody The requestBody parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, String incidentIdentifier, + ManualTriggerRequestBody requestBody, Context context); + + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object runPlaybook(String resourceGroupName, String workspaceName, String incidentIdentifier); + /** * Gets all incidents. * @@ -53,7 +85,7 @@ PagedIterable list(String resourceGroupName, String workspaceName Integer top, String skipToken, Context context); /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -62,14 +94,14 @@ PagedIterable list(String resourceGroupName, String workspaceName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident along with {@link Response}. + * @return an incident along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -77,13 +109,13 @@ Response getWithResponse(String resourceGroupName, String workspa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident. + * @return an incident. */ @ServiceMethod(returns = ReturnType.SINGLE) IncidentInner get(String resourceGroupName, String workspaceName, String incidentId); /** - * Creates or updates an incident. + * Creates or updates the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -93,14 +125,14 @@ Response getWithResponse(String resourceGroupName, String workspa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents an incident in Azure Security Insights along with {@link Response}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, String incidentId, IncidentInner incident, Context context); /** - * Creates or updates an incident. + * Creates or updates the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -109,14 +141,14 @@ Response createOrUpdateWithResponse(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents an incident in Azure Security Insights. + * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) IncidentInner createOrUpdate(String resourceGroupName, String workspaceName, String incidentId, IncidentInner incident); /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -132,7 +164,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName Context context); /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -145,7 +177,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName void delete(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -154,14 +186,14 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident along with {@link Response}. + * @return all incident alerts along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response listAlertsWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -169,13 +201,13 @@ Response listAlertsWithResponse(String resourceGroupName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident. + * @return all incident alerts. */ @ServiceMethod(returns = ReturnType.SINGLE) IncidentAlertListInner listAlerts(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -184,14 +216,14 @@ Response listAlertsWithResponse(String resourceGroupName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident along with {@link Response}. + * @return all incident bookmarks along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response listBookmarksWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -199,13 +231,13 @@ Response listBookmarksWithResponse(String resourceGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident. + * @return all incident bookmarks. */ @ServiceMethod(returns = ReturnType.SINGLE) IncidentBookmarkListInner listBookmarks(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -214,14 +246,14 @@ Response listBookmarksWithResponse(String resourceGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident along with {@link Response}. + * @return all incident related entities along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response listEntitiesWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -229,7 +261,7 @@ Response listEntitiesWithResponse(String resource * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident. + * @return all incident related entities. */ @ServiceMethod(returns = ReturnType.SINGLE) IncidentEntitiesResponseInner listEntities(String resourceGroupName, String workspaceName, String incidentId); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/MetadatasClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/MetadatasClient.java new file mode 100644 index 000000000000..81c75882fbd1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/MetadatasClient.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.MetadataModelInner; +import com.azure.resourcemanager.securityinsights.models.MetadataPatch; + +/** + * An instance of this class provides access to all the operations defined in MetadatasClient. + */ +public interface MetadatasClient { + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, Integer skip, Context context); + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String metadataName, + Context context); + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataModelInner get(String resourceGroupName, String workspaceName, String metadataName); + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String metadataName, + Context context); + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String metadataName); + + /** + * Create a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadata Metadata resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String workspaceName, String metadataName, + MetadataModelInner metadata, Context context); + + /** + * Create a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadata Metadata resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataModelInner create(String resourceGroupName, String workspaceName, String metadataName, + MetadataModelInner metadata); + + /** + * Update an existing Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadataPatch Partial metadata request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String workspaceName, String metadataName, + MetadataPatch metadataPatch, Context context); + + /** + * Update an existing Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadataPatch Partial metadata request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataModelInner update(String resourceGroupName, String workspaceName, String metadataName, + MetadataPatch metadataPatch); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/OfficeConsentsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/OfficeConsentsClient.java new file mode 100644 index 000000000000..b229954462c0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/OfficeConsentsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeConsentInner; + +/** + * An instance of this class provides access to all the operations defined in OfficeConsentsClient. + */ +public interface OfficeConsentsClient { + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String consentId, + Context context); + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OfficeConsentInner get(String resourceGroupName, String workspaceName, String consentId); + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String consentId, + Context context); + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String consentId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductPackageOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductPackageOperationsClient.java new file mode 100644 index 000000000000..795cf9997ee8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductPackageOperationsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; + +/** + * An instance of this class provides access to all the operations defined in ProductPackageOperationsClient. + */ +public interface ProductPackageOperationsClient { + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context); + + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductPackageModelInner get(String resourceGroupName, String workspaceName, String packageId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductPackagesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductPackagesClient.java new file mode 100644 index 000000000000..ffba8e171be1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductPackagesClient.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; + +/** + * An instance of this class provides access to all the operations defined in ProductPackagesClient. + */ +public interface ProductPackagesClient { + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param search Searches for a substring in the response. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, String search, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductSettingsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductSettingsClient.java new file mode 100644 index 000000000000..316614cb49a7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductSettingsClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; + +/** + * An instance of this class provides access to all the operations defined in ProductSettingsClient. + */ +public interface ProductSettingsClient { + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context); + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SettingsInner get(String resourceGroupName, String workspaceName, String settingsName); + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context); + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String settingsName); + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String workspaceName, String settingsName, + SettingsInner settings, Context context); + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SettingsInner update(String resourceGroupName, String workspaceName, String settingsName, SettingsInner settings); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductTemplateOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductTemplateOperationsClient.java new file mode 100644 index 000000000000..80de367e2ea0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductTemplateOperationsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; + +/** + * An instance of this class provides access to all the operations defined in ProductTemplateOperationsClient. + */ +public interface ProductTemplateOperationsClient { + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String templateId, Context context); + + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductTemplateModelInner get(String resourceGroupName, String workspaceName, String templateId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductTemplatesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductTemplatesClient.java new file mode 100644 index 000000000000..d5b2d341178c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ProductTemplatesClient.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; + +/** + * An instance of this class provides access to all the operations defined in ProductTemplatesClient. + */ +public interface ProductTemplatesClient { + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ReevaluatesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ReevaluatesClient.java new file mode 100644 index 000000000000..c79e4dae011d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ReevaluatesClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.ReevaluateResponseInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in ReevaluatesClient. + */ +public interface ReevaluatesClient { + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, Context context); + + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReevaluateResponseInner recommendation(String resourceGroupName, String workspaceName, UUID recommendationId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ResourceProvidersClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..60b18e783f19 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ResourceProvidersClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentDomainWhoisInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentIpGeodataInner; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentIpAddressBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentType; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public interface ResourceProvidersClient { + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listGeodataByIpWithResponse(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody, Context context); + + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnrichmentIpGeodataInner listGeodataByIp(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody); + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWhoisByDomainWithResponse(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody, Context context); + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnrichmentDomainWhoisInner listWhoisByDomain(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SecurityInsights.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SecurityInsights.java index 0e30a1ad43f3..d4bfd123aa09 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SecurityInsights.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SecurityInsights.java @@ -12,7 +12,7 @@ */ public interface SecurityInsights { /** - * Gets The ID of the target subscription. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -74,6 +74,27 @@ public interface SecurityInsights { */ AutomationRulesClient getAutomationRules(); + /** + * Gets the EntitiesClient object to access its operations. + * + * @return the EntitiesClient object. + */ + EntitiesClient getEntities(); + + /** + * Gets the IncidentsClient object to access its operations. + * + * @return the IncidentsClient object. + */ + IncidentsClient getIncidents(); + + /** + * Gets the BillingStatisticsClient object to access its operations. + * + * @return the BillingStatisticsClient object. + */ + BillingStatisticsClient getBillingStatistics(); + /** * Gets the BookmarksClient object to access its operations. * @@ -81,6 +102,104 @@ public interface SecurityInsights { */ BookmarksClient getBookmarks(); + /** + * Gets the BookmarkRelationsClient object to access its operations. + * + * @return the BookmarkRelationsClient object. + */ + BookmarkRelationsClient getBookmarkRelations(); + + /** + * Gets the BookmarkOperationsClient object to access its operations. + * + * @return the BookmarkOperationsClient object. + */ + BookmarkOperationsClient getBookmarkOperations(); + + /** + * Gets the BusinessApplicationAgentsClient object to access its operations. + * + * @return the BusinessApplicationAgentsClient object. + */ + BusinessApplicationAgentsClient getBusinessApplicationAgents(); + + /** + * Gets the BusinessApplicationAgentOperationsClient object to access its operations. + * + * @return the BusinessApplicationAgentOperationsClient object. + */ + BusinessApplicationAgentOperationsClient getBusinessApplicationAgentOperations(); + + /** + * Gets the SystemsClient object to access its operations. + * + * @return the SystemsClient object. + */ + SystemsClient getSystems(); + + /** + * Gets the ContentPackagesClient object to access its operations. + * + * @return the ContentPackagesClient object. + */ + ContentPackagesClient getContentPackages(); + + /** + * Gets the ContentPackageOperationsClient object to access its operations. + * + * @return the ContentPackageOperationsClient object. + */ + ContentPackageOperationsClient getContentPackageOperations(); + + /** + * Gets the ProductPackagesClient object to access its operations. + * + * @return the ProductPackagesClient object. + */ + ProductPackagesClient getProductPackages(); + + /** + * Gets the ProductPackageOperationsClient object to access its operations. + * + * @return the ProductPackageOperationsClient object. + */ + ProductPackageOperationsClient getProductPackageOperations(); + + /** + * Gets the ProductTemplatesClient object to access its operations. + * + * @return the ProductTemplatesClient object. + */ + ProductTemplatesClient getProductTemplates(); + + /** + * Gets the ProductTemplateOperationsClient object to access its operations. + * + * @return the ProductTemplateOperationsClient object. + */ + ProductTemplateOperationsClient getProductTemplateOperations(); + + /** + * Gets the ContentTemplatesClient object to access its operations. + * + * @return the ContentTemplatesClient object. + */ + ContentTemplatesClient getContentTemplates(); + + /** + * Gets the ContentTemplateOperationsClient object to access its operations. + * + * @return the ContentTemplateOperationsClient object. + */ + ContentTemplateOperationsClient getContentTemplateOperations(); + + /** + * Gets the DataConnectorDefinitionsClient object to access its operations. + * + * @return the DataConnectorDefinitionsClient object. + */ + DataConnectorDefinitionsClient getDataConnectorDefinitions(); + /** * Gets the DataConnectorsClient object to access its operations. * @@ -89,11 +208,81 @@ public interface SecurityInsights { DataConnectorsClient getDataConnectors(); /** - * Gets the IncidentsClient object to access its operations. + * Gets the DataConnectorsCheckRequirementsOperationsClient object to access its operations. * - * @return the IncidentsClient object. + * @return the DataConnectorsCheckRequirementsOperationsClient object. */ - IncidentsClient getIncidents(); + DataConnectorsCheckRequirementsOperationsClient getDataConnectorsCheckRequirementsOperations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the EntitiesGetTimelinesClient object to access its operations. + * + * @return the EntitiesGetTimelinesClient object. + */ + EntitiesGetTimelinesClient getEntitiesGetTimelines(); + + /** + * Gets the EntitiesRelationsClient object to access its operations. + * + * @return the EntitiesRelationsClient object. + */ + EntitiesRelationsClient getEntitiesRelations(); + + /** + * Gets the EntityRelationsClient object to access its operations. + * + * @return the EntityRelationsClient object. + */ + EntityRelationsClient getEntityRelations(); + + /** + * Gets the EntityQueriesClient object to access its operations. + * + * @return the EntityQueriesClient object. + */ + EntityQueriesClient getEntityQueries(); + + /** + * Gets the EntityQueryTemplatesClient object to access its operations. + * + * @return the EntityQueryTemplatesClient object. + */ + EntityQueryTemplatesClient getEntityQueryTemplates(); + + /** + * Gets the FileImportsClient object to access its operations. + * + * @return the FileImportsClient object. + */ + FileImportsClient getFileImports(); + + /** + * Gets the HuntsClient object to access its operations. + * + * @return the HuntsClient object. + */ + HuntsClient getHunts(); + + /** + * Gets the HuntRelationsClient object to access its operations. + * + * @return the HuntRelationsClient object. + */ + HuntRelationsClient getHuntRelations(); + + /** + * Gets the HuntCommentsClient object to access its operations. + * + * @return the HuntCommentsClient object. + */ + HuntCommentsClient getHuntComments(); /** * Gets the IncidentCommentsClient object to access its operations. @@ -109,6 +298,27 @@ public interface SecurityInsights { */ IncidentRelationsClient getIncidentRelations(); + /** + * Gets the IncidentTasksClient object to access its operations. + * + * @return the IncidentTasksClient object. + */ + IncidentTasksClient getIncidentTasks(); + + /** + * Gets the MetadatasClient object to access its operations. + * + * @return the MetadatasClient object. + */ + MetadatasClient getMetadatas(); + + /** + * Gets the OfficeConsentsClient object to access its operations. + * + * @return the OfficeConsentsClient object. + */ + OfficeConsentsClient getOfficeConsents(); + /** * Gets the SentinelOnboardingStatesClient object to access its operations. * @@ -116,6 +326,41 @@ public interface SecurityInsights { */ SentinelOnboardingStatesClient getSentinelOnboardingStates(); + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the GetRecommendationsClient object to access its operations. + * + * @return the GetRecommendationsClient object. + */ + GetRecommendationsClient getGetRecommendations(); + + /** + * Gets the GetsClient object to access its operations. + * + * @return the GetsClient object. + */ + GetsClient getGets(); + + /** + * Gets the UpdatesClient object to access its operations. + * + * @return the UpdatesClient object. + */ + UpdatesClient getUpdates(); + + /** + * Gets the ReevaluatesClient object to access its operations. + * + * @return the ReevaluatesClient object. + */ + ReevaluatesClient getReevaluates(); + /** * Gets the SecurityMLAnalyticsSettingsClient object to access its operations. * @@ -123,6 +368,27 @@ public interface SecurityInsights { */ SecurityMLAnalyticsSettingsClient getSecurityMLAnalyticsSettings(); + /** + * Gets the ProductSettingsClient object to access its operations. + * + * @return the ProductSettingsClient object. + */ + ProductSettingsClient getProductSettings(); + + /** + * Gets the SourceControlsClient object to access its operations. + * + * @return the SourceControlsClient object. + */ + SourceControlsClient getSourceControls(); + + /** + * Gets the SourceControlsOperationsClient object to access its operations. + * + * @return the SourceControlsOperationsClient object. + */ + SourceControlsOperationsClient getSourceControlsOperations(); + /** * Gets the ThreatIntelligenceIndicatorsClient object to access its operations. * @@ -144,6 +410,34 @@ public interface SecurityInsights { */ ThreatIntelligenceIndicatorMetricsClient getThreatIntelligenceIndicatorMetrics(); + /** + * Gets the ThreatIntelligencesClient object to access its operations. + * + * @return the ThreatIntelligencesClient object. + */ + ThreatIntelligencesClient getThreatIntelligences(); + + /** + * Gets the TriggeredAnalyticsRuleRunOperationsClient object to access its operations. + * + * @return the TriggeredAnalyticsRuleRunOperationsClient object. + */ + TriggeredAnalyticsRuleRunOperationsClient getTriggeredAnalyticsRuleRunOperations(); + + /** + * Gets the GetTriggeredAnalyticsRuleRunsClient object to access its operations. + * + * @return the GetTriggeredAnalyticsRuleRunsClient object. + */ + GetTriggeredAnalyticsRuleRunsClient getGetTriggeredAnalyticsRuleRuns(); + + /** + * Gets the AlertRuleOperationsClient object to access its operations. + * + * @return the AlertRuleOperationsClient object. + */ + AlertRuleOperationsClient getAlertRuleOperations(); + /** * Gets the WatchlistsClient object to access its operations. * @@ -159,9 +453,37 @@ public interface SecurityInsights { WatchlistItemsClient getWatchlistItems(); /** - * Gets the OperationsClient object to access its operations. + * Gets the WorkspaceManagerAssignmentsClient object to access its operations. * - * @return the OperationsClient object. + * @return the WorkspaceManagerAssignmentsClient object. */ - OperationsClient getOperations(); + WorkspaceManagerAssignmentsClient getWorkspaceManagerAssignments(); + + /** + * Gets the WorkspaceManagerAssignmentJobsClient object to access its operations. + * + * @return the WorkspaceManagerAssignmentJobsClient object. + */ + WorkspaceManagerAssignmentJobsClient getWorkspaceManagerAssignmentJobs(); + + /** + * Gets the WorkspaceManagerConfigurationsClient object to access its operations. + * + * @return the WorkspaceManagerConfigurationsClient object. + */ + WorkspaceManagerConfigurationsClient getWorkspaceManagerConfigurations(); + + /** + * Gets the WorkspaceManagerGroupsClient object to access its operations. + * + * @return the WorkspaceManagerGroupsClient object. + */ + WorkspaceManagerGroupsClient getWorkspaceManagerGroups(); + + /** + * Gets the WorkspaceManagerMembersClient object to access its operations. + * + * @return the WorkspaceManagerMembersClient object. + */ + WorkspaceManagerMembersClient getWorkspaceManagerMembers(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SourceControlsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SourceControlsClient.java new file mode 100644 index 000000000000..0ae114003f4d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SourceControlsClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RepoInner; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; + +/** + * An instance of this class provides access to all the operations defined in SourceControlsClient. + */ +public interface SourceControlsClient { + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess); + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SourceControlsOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SourceControlsOperationsClient.java new file mode 100644 index 000000000000..2e2ebfff8bc8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SourceControlsOperationsClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.SourceControlInner; +import com.azure.resourcemanager.securityinsights.fluent.models.WarningInner; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; + +/** + * An instance of this class provides access to all the operations defined in SourceControlsOperationsClient. + */ +public interface SourceControlsOperationsClient { + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String sourceControlId, + Context context); + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SourceControlInner get(String resourceGroupName, String workspaceName, String sourceControlId); + + /** + * Creates a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param sourceControl The SourceControl. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SourceControl in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String workspaceName, + String sourceControlId, SourceControlInner sourceControl, Context context); + + /** + * Creates a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param sourceControl The SourceControl. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SourceControl in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SourceControlInner create(String resourceGroupName, String workspaceName, String sourceControlId, + SourceControlInner sourceControl); + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess, Context context); + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WarningInner delete(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SystemsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SystemsClient.java new file mode 100644 index 000000000000..a2fadea467c3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/SystemsClient.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; +import com.azure.resourcemanager.securityinsights.fluent.models.SystemResourceInner; +import com.azure.resourcemanager.securityinsights.models.ReportActionStatusPayload; +import com.azure.resourcemanager.securityinsights.models.UndoActionPayload; + +/** + * An instance of this class provides access to all the operations defined in SystemsClient. + */ +public interface SystemsClient { + /** + * Creates or updates the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param systemToUpsert The system to upsert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the system within the agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, SystemResourceInner systemToUpsert, Context context); + + /** + * Creates or updates the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the system within the agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SystemResourceInner createOrUpdate(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context); + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SystemResourceInner get(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context); + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String agentResourceName, String systemResourceName); + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String agentResourceName); + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String agentResourceName, + String filter, String skipToken, Context context); + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listActions(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listActions(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context); + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Undo action, based on the actionId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response undoActionWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, UndoActionPayload payload, Context context); + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void undoAction(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Report a status of the action that was performed by the agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response reportActionStatusWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, ReportActionStatusPayload payload, Context context); + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void reportActionStatus(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ThreatIntelligencesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ThreatIntelligencesClient.java new file mode 100644 index 000000000000..91dfdaef749b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/ThreatIntelligencesClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceCountInner; +import com.azure.resourcemanager.securityinsights.models.CountQuery; +import com.azure.resourcemanager.securityinsights.models.Query; +import com.azure.resourcemanager.securityinsights.models.TiType; + +/** + * An instance of this class provides access to all the operations defined in ThreatIntelligencesClient. + */ +public interface ThreatIntelligencesClient { + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response countWithResponse(String resourceGroupName, String workspaceName, + TiType tiType, CountQuery query, Context context); + + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ThreatIntelligenceCountInner count(String resourceGroupName, String workspaceName, TiType tiType); + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType); + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType, Query query, + Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/TriggeredAnalyticsRuleRunOperationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/TriggeredAnalyticsRuleRunOperationsClient.java new file mode 100644 index 000000000000..91613c00afdd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/TriggeredAnalyticsRuleRunOperationsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; + +/** + * An instance of this class provides access to all the operations defined in TriggeredAnalyticsRuleRunOperationsClient. + */ +public interface TriggeredAnalyticsRuleRunOperationsClient { + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String ruleRunId, Context context); + + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TriggeredAnalyticsRuleRunInner get(String resourceGroupName, String workspaceName, String ruleRunId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/UpdatesClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/UpdatesClient.java new file mode 100644 index 000000000000..106808e9b72c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/UpdatesClient.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import com.azure.resourcemanager.securityinsights.models.RecommendationPatch; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in UpdatesClient. + */ +public interface UpdatesClient { + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, RecommendationPatch recommendationPatch, Context context); + + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendationInner recommendation(String resourceGroupName, String workspaceName, UUID recommendationId, + RecommendationPatch recommendationPatch); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistItemsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistItemsClient.java index 5bc1e1c84f1c..0a2a50c8270e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistItemsClient.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistItemsClient.java @@ -16,11 +16,11 @@ */ public interface WatchlistItemsClient { /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -30,11 +30,11 @@ public interface WatchlistItemsClient { PagedIterable list(String resourceGroupName, String workspaceName, String watchlistAlias); /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies * a starting point to use for subsequent calls. Optional. @@ -49,33 +49,33 @@ PagedIterable list(String resourceGroupName, String workspac String skipToken, Context context); /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item along with {@link Response}. + * @return a watchlist, without its watchlist items along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse(String resourceGroupName, String workspaceName, String watchlistAlias, String watchlistItemId, Context context); /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item. + * @return a watchlist, without its watchlist items. */ @ServiceMethod(returns = ReturnType.SINGLE) WatchlistItemInner get(String resourceGroupName, String workspaceName, String watchlistAlias, @@ -86,8 +86,8 @@ WatchlistItemInner get(String resourceGroupName, String workspaceName, String wa * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -103,8 +103,8 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -113,35 +113,35 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName void delete(String resourceGroupName, String workspaceName, String watchlistAlias, String watchlistItemId); /** - * Create or update a watchlist item. + * Creates or updates a watchlist item. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param watchlistItem The watchlist item. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist Item in Azure Security Insights along with {@link Response}. + * @return represents a Watchlist item in Azure Security Insights along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, String watchlistAlias, String watchlistItemId, WatchlistItemInner watchlistItem, Context context); /** - * Create or update a watchlist item. + * Creates or updates a watchlist item. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param watchlistItem The watchlist item. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist Item in Azure Security Insights. + * @return represents a Watchlist item in Azure Security Insights. */ @ServiceMethod(returns = ReturnType.SINGLE) WatchlistItemInner createOrUpdate(String resourceGroupName, String workspaceName, String watchlistAlias, diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistsClient.java index 297446f54e25..74e8a638926b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistsClient.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WatchlistsClient.java @@ -8,7 +8,9 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.securityinsights.fluent.models.WatchlistInner; /** @@ -16,7 +18,7 @@ */ public interface WatchlistsClient { /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -29,7 +31,7 @@ public interface WatchlistsClient { PagedIterable list(String resourceGroupName, String workspaceName); /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -47,11 +49,11 @@ PagedIterable list(String resourceGroupName, String workspaceNam Context context); /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -63,11 +65,11 @@ Response getWithResponse(String resourceGroupName, String worksp Context context); /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -81,23 +83,38 @@ Response getWithResponse(String resourceGroupName, String worksp * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String watchlistAlias); + + /** + * Delete a watchlist. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String workspaceName, String watchlistAlias, - Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String watchlistAlias, Context context); /** * Delete a watchlist. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -105,31 +122,71 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String workspaceName, String watchlistAlias); + /** + * Delete a watchlist. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String watchlistAlias, Context context); + /** * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To - * create a Watchlist and its Items, we should call this endpoint with rawContent and contentType properties. + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. + * @param watchlist The watchlist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Watchlist in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WatchlistInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String watchlistAlias, WatchlistInner watchlist); + + /** + * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. * @param watchlist The watchlist. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist in Azure Security Insights along with {@link Response}. + * @return the {@link SyncPoller} for polling of represents a Watchlist in Azure Security Insights. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, - String watchlistAlias, WatchlistInner watchlist, Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WatchlistInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String watchlistAlias, WatchlistInner watchlist, Context context); /** * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To - * create a Watchlist and its Items, we should call this endpoint with rawContent and contentType properties. + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param watchlist The watchlist. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -139,4 +196,25 @@ Response createOrUpdateWithResponse(String resourceGroupName, St @ServiceMethod(returns = ReturnType.SINGLE) WatchlistInner createOrUpdate(String resourceGroupName, String workspaceName, String watchlistAlias, WatchlistInner watchlist); + + /** + * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param watchlist The watchlist. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Watchlist in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WatchlistInner createOrUpdate(String resourceGroupName, String workspaceName, String watchlistAlias, + WatchlistInner watchlist, Context context); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerAssignmentJobsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerAssignmentJobsClient.java new file mode 100644 index 000000000000..b1df7c351eab --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerAssignmentJobsClient.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.JobInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerAssignmentJobsClient. + */ +public interface WorkspaceManagerAssignmentJobsClient { + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName); + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, + String orderby, Integer top, String skipToken, Context context); + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context); + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobInner create(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobInner get(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, String jobName); + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context); + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, String jobName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerAssignmentsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerAssignmentsClient.java new file mode 100644 index 000000000000..1df3dbe69149 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerAssignmentsClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerAssignmentInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerAssignmentsClient. + */ +public interface WorkspaceManagerAssignmentsClient { + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context); + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerAssignmentInner get(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName); + + /** + * Creates or updates a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param workspaceManagerAssignment The workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, WorkspaceManagerAssignmentInner workspaceManagerAssignment, + Context context); + + /** + * Creates or updates a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param workspaceManagerAssignment The workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerAssignmentInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, WorkspaceManagerAssignmentInner workspaceManagerAssignment); + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context); + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerConfigurationsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerConfigurationsClient.java new file mode 100644 index 000000000000..fdfda6fb9a86 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerConfigurationsClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerConfigurationInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerConfigurationsClient. + */ +public interface WorkspaceManagerConfigurationsClient { + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context); + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerConfigurationInner get(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName); + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context); + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String workspaceManagerConfigurationName); + + /** + * Creates or updates a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param workspaceManagerConfiguration The workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String workspaceManagerConfigurationName, + WorkspaceManagerConfigurationInner workspaceManagerConfiguration, Context context); + + /** + * Creates or updates a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param workspaceManagerConfiguration The workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerConfigurationInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, WorkspaceManagerConfigurationInner workspaceManagerConfiguration); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerGroupsClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerGroupsClient.java new file mode 100644 index 000000000000..6a62e785bc72 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerGroupsClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerGroupInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerGroupsClient. + */ +public interface WorkspaceManagerGroupsClient { + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, Context context); + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerGroupInner get(String resourceGroupName, String workspaceName, String workspaceManagerGroupName); + + /** + * Creates or updates a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param workspaceManagerGroup The workspace manager group object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, WorkspaceManagerGroupInner workspaceManagerGroup, Context context); + + /** + * Creates or updates a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param workspaceManagerGroup The workspace manager group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerGroupInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, WorkspaceManagerGroupInner workspaceManagerGroup); + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String workspaceManagerGroupName, + Context context); + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String workspaceManagerGroupName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerMembersClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerMembersClient.java new file mode 100644 index 000000000000..c082ae91d74c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/WorkspaceManagerMembersClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerMemberInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerMembersClient. + */ +public interface WorkspaceManagerMembersClient { + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, Context context); + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerMemberInner get(String resourceGroupName, String workspaceName, String workspaceManagerMemberName); + + /** + * Creates or updates a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param workspaceManagerMember The workspace manager member object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager member along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, WorkspaceManagerMemberInner workspaceManagerMember, Context context); + + /** + * Creates or updates a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param workspaceManagerMember The workspace manager member object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceManagerMemberInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, WorkspaceManagerMemberInner workspaceManagerMember); + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String workspaceName, String workspaceManagerMemberName, + Context context); + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String workspaceManagerMemberName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AadCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AadCheckRequirementsProperties.java new file mode 100644 index 000000000000..2d145b8cd5f6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AadCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * AADIP (Azure Active Directory Identity Protection) requirements check properties. + */ +@Fluent +public final class AadCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of AadCheckRequirementsProperties class. + */ + public AadCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public AadCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model AadCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AadCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AadCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AadCheckRequirementsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AadCheckRequirementsProperties. + */ + public static AadCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AadCheckRequirementsProperties deserializedAadCheckRequirementsProperties + = new AadCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedAadCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAadCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AadDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AadDataConnectorProperties.java index 584b4b41623e..18332492a768 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AadDataConnectorProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AadDataConnectorProperties.java @@ -5,23 +5,19 @@ package com.azure.resourcemanager.securityinsights.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; import java.io.IOException; /** - * AAD (Azure Active Directory) data connector properties. + * AADIP (Azure Active Directory Identity Protection) data connector properties. */ @Fluent -public final class AadDataConnectorProperties implements JsonSerializable { - /* - * The tenant id to connect to, and get the data from. - */ - private String tenantId; - +public final class AadDataConnectorProperties extends DataConnectorTenantId { /* * The available data types for the connector. */ @@ -33,26 +29,6 @@ public final class AadDataConnectorProperties implements JsonSerializable { + AatpCheckRequirementsProperties deserializedAatpCheckRequirementsProperties + = new AatpCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedAatpCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAatpCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AatpDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AatpDataConnectorProperties.java index 63b8c8f525c6..c77eed3b2a15 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AatpDataConnectorProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AatpDataConnectorProperties.java @@ -5,23 +5,19 @@ package com.azure.resourcemanager.securityinsights.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; import java.io.IOException; /** * AATP (Azure Advanced Threat Protection) data connector properties. */ @Fluent -public final class AatpDataConnectorProperties implements JsonSerializable { - /* - * The tenant id to connect to, and get the data from. - */ - private String tenantId; - +public final class AatpDataConnectorProperties extends DataConnectorTenantId { /* * The available data types for the connector. */ @@ -33,26 +29,6 @@ public final class AatpDataConnectorProperties implements JsonSerializable { + /* + * The actions kind + */ + private ListActionKind kind = ListActionKind.fromString("Action"); + + /** + * Creates an instance of ActionInner class. + */ + public ActionInner() { + } + + /** + * Get the kind property: The actions kind. + * + * @return the kind value. + */ + public ListActionKind kind() { + return this.kind; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActionInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ActionInner. + */ + public static ActionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("LockUser".equals(discriminatorValue)) { + return LockUserAction.fromJson(readerToUse.reset()); + } else if ("UnlockUser".equals(discriminatorValue)) { + return UnlockUserAction.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ActionInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActionInner deserializedActionInner = new ActionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedActionInner.kind = ListActionKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedActionInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActionResponseInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActionResponseInner.java index f9831cffcab2..3350c3767cc6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActionResponseInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActionResponseInner.java @@ -5,23 +5,18 @@ package com.azure.resourcemanager.securityinsights.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; import java.io.IOException; /** * Action for alert rule. */ @Fluent -public final class ActionResponseInner extends ProxyResource { - /* - * Etag of the action. - */ - private String etag; - +public final class ActionResponseInner extends ResourceWithEtag { /* * Action properties for get request */ @@ -53,26 +48,6 @@ public final class ActionResponseInner extends ProxyResource { public ActionResponseInner() { } - /** - * Get the etag property: Etag of the action. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Set the etag property: Etag of the action. - * - * @param etag the etag value to set. - * @return the ActionResponseInner object itself. - */ - public ActionResponseInner withEtag(String etag) { - this.etag = etag; - return this; - } - /** * Get the innerProperties property: Action properties for get request. * @@ -87,6 +62,7 @@ private ActionResponseProperties innerProperties() { * * @return the systemData value. */ + @Override public SystemData systemData() { return this.systemData; } @@ -121,6 +97,15 @@ public String id() { return this.id; } + /** + * {@inheritDoc} + */ + @Override + public ActionResponseInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + /** * Get the workflowId property: The name of the logic app's workflow. * @@ -174,6 +159,7 @@ public ActionResponseInner withLogicAppResourceId(String logicAppResourceId) { * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { if (innerProperties() != null) { innerProperties().validate(); @@ -186,7 +172,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("etag", this.etag); + jsonWriter.writeStringField("etag", etag()); jsonWriter.writeJsonField("properties", this.innerProperties); return jsonWriter.writeEndObject(); } @@ -214,11 +200,11 @@ public static ActionResponseInner fromJson(JsonReader jsonReader) throws IOExcep } else if ("type".equals(fieldName)) { deserializedActionResponseInner.type = reader.getString(); } else if ("etag".equals(fieldName)) { - deserializedActionResponseInner.etag = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedActionResponseInner.innerProperties = ActionResponseProperties.fromJson(reader); + deserializedActionResponseInner.withEtag(reader.getString()); } else if ("systemData".equals(fieldName)) { deserializedActionResponseInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedActionResponseInner.innerProperties = ActionResponseProperties.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActivityEntityQueriesProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActivityEntityQueriesProperties.java new file mode 100644 index 000000000000..27c0eebf71bb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActivityEntityQueriesProperties.java @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ActivityEntityQueriesPropertiesQueryDefinitions; +import com.azure.resourcemanager.securityinsights.models.EntityType; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Describes activity entity query properties. + */ +@Fluent +public final class ActivityEntityQueriesProperties implements JsonSerializable { + /* + * The entity query title + */ + private String title; + + /* + * The entity query content to display in timeline + */ + private String content; + + /* + * The entity query description + */ + private String description; + + /* + * The Activity query definitions + */ + private ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions; + + /* + * The type of the query's source entity + */ + private EntityType inputEntityType; + + /* + * List of the fields of the source entity that are required to run the query + */ + private List> requiredInputFieldsSets; + + /* + * The query applied only to entities matching to all filters + */ + private Map> entitiesFilter; + + /* + * The template id this activity was created from + */ + private String templateName; + + /* + * Determines whether this activity is enabled or disabled. + */ + private Boolean enabled; + + /* + * The time the activity was created + */ + private OffsetDateTime createdTimeUtc; + + /* + * The last time the activity was updated + */ + private OffsetDateTime lastModifiedTimeUtc; + + /** + * Creates an instance of ActivityEntityQueriesProperties class. + */ + public ActivityEntityQueriesProperties() { + } + + /** + * Get the title property: The entity query title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The entity query title. + * + * @param title the title value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the content property: The entity query content to display in timeline. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: The entity query content to display in timeline. + * + * @param content the content value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withContent(String content) { + this.content = content; + return this; + } + + /** + * Get the description property: The entity query description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The entity query description. + * + * @param description the description value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the queryDefinitions property: The Activity query definitions. + * + * @return the queryDefinitions value. + */ + public ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions() { + return this.queryDefinitions; + } + + /** + * Set the queryDefinitions property: The Activity query definitions. + * + * @param queryDefinitions the queryDefinitions value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties + withQueryDefinitions(ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions) { + this.queryDefinitions = queryDefinitions; + return this; + } + + /** + * Get the inputEntityType property: The type of the query's source entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.inputEntityType; + } + + /** + * Set the inputEntityType property: The type of the query's source entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withInputEntityType(EntityType inputEntityType) { + this.inputEntityType = inputEntityType; + return this; + } + + /** + * Get the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @return the requiredInputFieldsSets value. + */ + public List> requiredInputFieldsSets() { + return this.requiredInputFieldsSets; + } + + /** + * Set the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @param requiredInputFieldsSets the requiredInputFieldsSets value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withRequiredInputFieldsSets(List> requiredInputFieldsSets) { + this.requiredInputFieldsSets = requiredInputFieldsSets; + return this; + } + + /** + * Get the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @return the entitiesFilter value. + */ + public Map> entitiesFilter() { + return this.entitiesFilter; + } + + /** + * Set the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @param entitiesFilter the entitiesFilter value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withEntitiesFilter(Map> entitiesFilter) { + this.entitiesFilter = entitiesFilter; + return this; + } + + /** + * Get the templateName property: The template id this activity was created from. + * + * @return the templateName value. + */ + public String templateName() { + return this.templateName; + } + + /** + * Set the templateName property: The template id this activity was created from. + * + * @param templateName the templateName value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withTemplateName(String templateName) { + this.templateName = templateName; + return this; + } + + /** + * Get the enabled property: Determines whether this activity is enabled or disabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether this activity is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the ActivityEntityQueriesProperties object itself. + */ + public ActivityEntityQueriesProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the createdTimeUtc property: The time the activity was created. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.createdTimeUtc; + } + + /** + * Get the lastModifiedTimeUtc property: The last time the activity was updated. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.lastModifiedTimeUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queryDefinitions() != null) { + queryDefinitions().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("content", this.content); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("queryDefinitions", this.queryDefinitions); + jsonWriter.writeStringField("inputEntityType", + this.inputEntityType == null ? null : this.inputEntityType.toString()); + jsonWriter.writeArrayField("requiredInputFieldsSets", this.requiredInputFieldsSets, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeMapField("entitiesFilter", this.entitiesFilter, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeStringField("templateName", this.templateName); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityEntityQueriesProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityEntityQueriesProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActivityEntityQueriesProperties. + */ + public static ActivityEntityQueriesProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivityEntityQueriesProperties deserializedActivityEntityQueriesProperties + = new ActivityEntityQueriesProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.title = reader.getString(); + } else if ("content".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.content = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.description = reader.getString(); + } else if ("queryDefinitions".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.queryDefinitions + = ActivityEntityQueriesPropertiesQueryDefinitions.fromJson(reader); + } else if ("inputEntityType".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.inputEntityType + = EntityType.fromString(reader.getString()); + } else if ("requiredInputFieldsSets".equals(fieldName)) { + List> requiredInputFieldsSets + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedActivityEntityQueriesProperties.requiredInputFieldsSets = requiredInputFieldsSets; + } else if ("entitiesFilter".equals(fieldName)) { + Map> entitiesFilter + = reader.readMap(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedActivityEntityQueriesProperties.entitiesFilter = entitiesFilter; + } else if ("templateName".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.templateName = reader.getString(); + } else if ("enabled".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("createdTimeUtc".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.createdTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedTimeUtc".equals(fieldName)) { + deserializedActivityEntityQueriesProperties.lastModifiedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedActivityEntityQueriesProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActivityEntityQueryTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActivityEntityQueryTemplateProperties.java new file mode 100644 index 000000000000..bbc1252d6d09 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ActivityEntityQueryTemplateProperties.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ActivityEntityQueryTemplatePropertiesQueryDefinitions; +import com.azure.resourcemanager.securityinsights.models.DataTypeDefinitions; +import com.azure.resourcemanager.securityinsights.models.EntityType; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Describes activity entity query properties. + */ +@Fluent +public final class ActivityEntityQueryTemplateProperties + implements JsonSerializable { + /* + * The entity query title + */ + private String title; + + /* + * The entity query content to display in timeline + */ + private String content; + + /* + * The entity query description + */ + private String description; + + /* + * The Activity query definitions + */ + private ActivityEntityQueryTemplatePropertiesQueryDefinitions queryDefinitions; + + /* + * List of required data types for the given entity query template + */ + private List dataTypes; + + /* + * The type of the query's source entity + */ + private EntityType inputEntityType; + + /* + * List of the fields of the source entity that are required to run the query + */ + private List> requiredInputFieldsSets; + + /* + * The query applied only to entities matching to all filters + */ + private Map> entitiesFilter; + + /** + * Creates an instance of ActivityEntityQueryTemplateProperties class. + */ + public ActivityEntityQueryTemplateProperties() { + } + + /** + * Get the title property: The entity query title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The entity query title. + * + * @param title the title value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the content property: The entity query content to display in timeline. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: The entity query content to display in timeline. + * + * @param content the content value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties withContent(String content) { + this.content = content; + return this; + } + + /** + * Get the description property: The entity query description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The entity query description. + * + * @param description the description value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the queryDefinitions property: The Activity query definitions. + * + * @return the queryDefinitions value. + */ + public ActivityEntityQueryTemplatePropertiesQueryDefinitions queryDefinitions() { + return this.queryDefinitions; + } + + /** + * Set the queryDefinitions property: The Activity query definitions. + * + * @param queryDefinitions the queryDefinitions value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties + withQueryDefinitions(ActivityEntityQueryTemplatePropertiesQueryDefinitions queryDefinitions) { + this.queryDefinitions = queryDefinitions; + return this; + } + + /** + * Get the dataTypes property: List of required data types for the given entity query template. + * + * @return the dataTypes value. + */ + public List dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: List of required data types for the given entity query template. + * + * @param dataTypes the dataTypes value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties withDataTypes(List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * Get the inputEntityType property: The type of the query's source entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.inputEntityType; + } + + /** + * Set the inputEntityType property: The type of the query's source entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties withInputEntityType(EntityType inputEntityType) { + this.inputEntityType = inputEntityType; + return this; + } + + /** + * Get the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @return the requiredInputFieldsSets value. + */ + public List> requiredInputFieldsSets() { + return this.requiredInputFieldsSets; + } + + /** + * Set the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @param requiredInputFieldsSets the requiredInputFieldsSets value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties + withRequiredInputFieldsSets(List> requiredInputFieldsSets) { + this.requiredInputFieldsSets = requiredInputFieldsSets; + return this; + } + + /** + * Get the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @return the entitiesFilter value. + */ + public Map> entitiesFilter() { + return this.entitiesFilter; + } + + /** + * Set the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @param entitiesFilter the entitiesFilter value to set. + * @return the ActivityEntityQueryTemplateProperties object itself. + */ + public ActivityEntityQueryTemplateProperties withEntitiesFilter(Map> entitiesFilter) { + this.entitiesFilter = entitiesFilter; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queryDefinitions() != null) { + queryDefinitions().validate(); + } + if (dataTypes() != null) { + dataTypes().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("content", this.content); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("queryDefinitions", this.queryDefinitions); + jsonWriter.writeArrayField("dataTypes", this.dataTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("inputEntityType", + this.inputEntityType == null ? null : this.inputEntityType.toString()); + jsonWriter.writeArrayField("requiredInputFieldsSets", this.requiredInputFieldsSets, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeMapField("entitiesFilter", this.entitiesFilter, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityEntityQueryTemplateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityEntityQueryTemplateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActivityEntityQueryTemplateProperties. + */ + public static ActivityEntityQueryTemplateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivityEntityQueryTemplateProperties deserializedActivityEntityQueryTemplateProperties + = new ActivityEntityQueryTemplateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedActivityEntityQueryTemplateProperties.title = reader.getString(); + } else if ("content".equals(fieldName)) { + deserializedActivityEntityQueryTemplateProperties.content = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedActivityEntityQueryTemplateProperties.description = reader.getString(); + } else if ("queryDefinitions".equals(fieldName)) { + deserializedActivityEntityQueryTemplateProperties.queryDefinitions + = ActivityEntityQueryTemplatePropertiesQueryDefinitions.fromJson(reader); + } else if ("dataTypes".equals(fieldName)) { + List dataTypes + = reader.readArray(reader1 -> DataTypeDefinitions.fromJson(reader1)); + deserializedActivityEntityQueryTemplateProperties.dataTypes = dataTypes; + } else if ("inputEntityType".equals(fieldName)) { + deserializedActivityEntityQueryTemplateProperties.inputEntityType + = EntityType.fromString(reader.getString()); + } else if ("requiredInputFieldsSets".equals(fieldName)) { + List> requiredInputFieldsSets + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedActivityEntityQueryTemplateProperties.requiredInputFieldsSets = requiredInputFieldsSets; + } else if ("entitiesFilter".equals(fieldName)) { + Map> entitiesFilter + = reader.readMap(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedActivityEntityQueryTemplateProperties.entitiesFilter = entitiesFilter; + } else { + reader.skipChildren(); + } + } + + return deserializedActivityEntityQueryTemplateProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AgentProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AgentProperties.java new file mode 100644 index 000000000000..974889429b02 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AgentProperties.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AgentConfiguration; +import com.azure.resourcemanager.securityinsights.models.AgentSystem; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The AgentProperties model. + */ +@Fluent +public final class AgentProperties implements JsonSerializable { + /* + * Describes the configuration of a Business Application Agent. + */ + private AgentConfiguration configuration; + + /* + * The agentSystems property. + */ + private List agentSystems; + + /* + * The displayName property. + */ + private String displayName; + + /* + * The lastModifiedTimeUtc property. + */ + private OffsetDateTime lastModifiedTimeUtc; + + /** + * Creates an instance of AgentProperties class. + */ + public AgentProperties() { + } + + /** + * Get the configuration property: Describes the configuration of a Business Application Agent. + * + * @return the configuration value. + */ + public AgentConfiguration configuration() { + return this.configuration; + } + + /** + * Set the configuration property: Describes the configuration of a Business Application Agent. + * + * @param configuration the configuration value to set. + * @return the AgentProperties object itself. + */ + public AgentProperties withConfiguration(AgentConfiguration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Get the agentSystems property: The agentSystems property. + * + * @return the agentSystems value. + */ + public List agentSystems() { + return this.agentSystems; + } + + /** + * Get the displayName property: The displayName property. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The displayName property. + * + * @param displayName the displayName value to set. + * @return the AgentProperties object itself. + */ + public AgentProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the lastModifiedTimeUtc property: The lastModifiedTimeUtc property. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.lastModifiedTimeUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configuration() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property configuration in model AgentProperties")); + } else { + configuration().validate(); + } + if (agentSystems() != null) { + agentSystems().forEach(e -> e.validate()); + } + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property displayName in model AgentProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AgentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("configuration", this.configuration); + jsonWriter.writeStringField("displayName", this.displayName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AgentProperties. + */ + public static AgentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentProperties deserializedAgentProperties = new AgentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("configuration".equals(fieldName)) { + deserializedAgentProperties.configuration = AgentConfiguration.fromJson(reader); + } else if ("displayName".equals(fieldName)) { + deserializedAgentProperties.displayName = reader.getString(); + } else if ("agentSystems".equals(fieldName)) { + List agentSystems = reader.readArray(reader1 -> AgentSystem.fromJson(reader1)); + deserializedAgentProperties.agentSystems = agentSystems; + } else if ("lastModifiedTimeUtc".equals(fieldName)) { + deserializedAgentProperties.lastModifiedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleInner.java index 82b21a9babd1..86910984748a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleInner.java @@ -11,9 +11,12 @@ import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.models.AlertRuleKind; import com.azure.resourcemanager.securityinsights.models.FusionAlertRule; +import com.azure.resourcemanager.securityinsights.models.MLBehaviorAnalyticsAlertRule; import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRule; +import com.azure.resourcemanager.securityinsights.models.NrtAlertRule; import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRule; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceAlertRule; import java.io.IOException; /** @@ -22,7 +25,7 @@ @Fluent public class AlertRuleInner extends ResourceWithEtag { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.fromString("AlertRule"); @@ -53,7 +56,7 @@ public AlertRuleInner() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ @@ -155,12 +158,18 @@ public static AlertRuleInner fromJson(JsonReader jsonReader) throws IOException } } // Use the discriminator value to determine which subtype should be deserialized. - if ("Fusion".equals(discriminatorValue)) { + if ("MLBehaviorAnalytics".equals(discriminatorValue)) { + return MLBehaviorAnalyticsAlertRule.fromJson(readerToUse.reset()); + } else if ("Fusion".equals(discriminatorValue)) { return FusionAlertRule.fromJson(readerToUse.reset()); + } else if ("ThreatIntelligence".equals(discriminatorValue)) { + return ThreatIntelligenceAlertRule.fromJson(readerToUse.reset()); } else if ("MicrosoftSecurityIncidentCreation".equals(discriminatorValue)) { return MicrosoftSecurityIncidentCreationAlertRule.fromJson(readerToUse.reset()); } else if ("Scheduled".equals(discriminatorValue)) { return ScheduledAlertRule.fromJson(readerToUse.reset()); + } else if ("NRT".equals(discriminatorValue)) { + return NrtAlertRule.fromJson(readerToUse.reset()); } else { return fromJsonKnownDiscriminator(readerToUse.reset()); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleTemplateInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleTemplateInner.java index c91682bf8b56..cc0e18936276 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleTemplateInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AlertRuleTemplateInner.java @@ -12,8 +12,11 @@ import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.models.AlertRuleKind; import com.azure.resourcemanager.securityinsights.models.FusionAlertRuleTemplate; +import com.azure.resourcemanager.securityinsights.models.MLBehaviorAnalyticsAlertRuleTemplate; import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRuleTemplate; +import com.azure.resourcemanager.securityinsights.models.NrtAlertRuleTemplate; import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRuleTemplate; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceAlertRuleTemplate; import java.io.IOException; /** @@ -22,7 +25,7 @@ @Immutable public class AlertRuleTemplateInner extends ProxyResource { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.fromString("AlertRuleTemplate"); @@ -53,7 +56,7 @@ public AlertRuleTemplateInner() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ @@ -154,12 +157,18 @@ public static AlertRuleTemplateInner fromJson(JsonReader jsonReader) throws IOEx } } // Use the discriminator value to determine which subtype should be deserialized. - if ("Fusion".equals(discriminatorValue)) { + if ("MLBehaviorAnalytics".equals(discriminatorValue)) { + return MLBehaviorAnalyticsAlertRuleTemplate.fromJson(readerToUse.reset()); + } else if ("Fusion".equals(discriminatorValue)) { return FusionAlertRuleTemplate.fromJson(readerToUse.reset()); + } else if ("ThreatIntelligence".equals(discriminatorValue)) { + return ThreatIntelligenceAlertRuleTemplate.fromJson(readerToUse.reset()); } else if ("MicrosoftSecurityIncidentCreation".equals(discriminatorValue)) { return MicrosoftSecurityIncidentCreationAlertRuleTemplate.fromJson(readerToUse.reset()); } else if ("Scheduled".equals(discriminatorValue)) { return ScheduledAlertRuleTemplate.fromJson(readerToUse.reset()); + } else if ("NRT".equals(discriminatorValue)) { + return NrtAlertRuleTemplate.fromJson(readerToUse.reset()); } else { return fromJsonKnownDiscriminator(readerToUse.reset()); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AnalyticsRuleRunTriggerProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AnalyticsRuleRunTriggerProperties.java new file mode 100644 index 000000000000..1cc38ad1f10c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AnalyticsRuleRunTriggerProperties.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The Analytics Rule Run Trigger properties. + */ +@Fluent +public final class AnalyticsRuleRunTriggerProperties implements JsonSerializable { + /* + * The executionTimeUtc property. + */ + private OffsetDateTime executionTimeUtc; + + /** + * Creates an instance of AnalyticsRuleRunTriggerProperties class. + */ + public AnalyticsRuleRunTriggerProperties() { + } + + /** + * Get the executionTimeUtc property: The executionTimeUtc property. + * + * @return the executionTimeUtc value. + */ + public OffsetDateTime executionTimeUtc() { + return this.executionTimeUtc; + } + + /** + * Set the executionTimeUtc property: The executionTimeUtc property. + * + * @param executionTimeUtc the executionTimeUtc value to set. + * @return the AnalyticsRuleRunTriggerProperties object itself. + */ + public AnalyticsRuleRunTriggerProperties withExecutionTimeUtc(OffsetDateTime executionTimeUtc) { + this.executionTimeUtc = executionTimeUtc; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (executionTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionTimeUtc in model AnalyticsRuleRunTriggerProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AnalyticsRuleRunTriggerProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("executionTimeUtc", + this.executionTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.executionTimeUtc)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyticsRuleRunTriggerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyticsRuleRunTriggerProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AnalyticsRuleRunTriggerProperties. + */ + public static AnalyticsRuleRunTriggerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnalyticsRuleRunTriggerProperties deserializedAnalyticsRuleRunTriggerProperties + = new AnalyticsRuleRunTriggerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("executionTimeUtc".equals(fieldName)) { + deserializedAnalyticsRuleRunTriggerProperties.executionTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAnalyticsRuleRunTriggerProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AnomaliesSettingsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AnomaliesSettingsProperties.java new file mode 100644 index 000000000000..48405ac1cf79 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AnomaliesSettingsProperties.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Anomalies property bag. + */ +@Immutable +public final class AnomaliesSettingsProperties implements JsonSerializable { + /* + * Determines whether the setting is enable or disabled. + */ + private Boolean isEnabled; + + /** + * Creates an instance of AnomaliesSettingsProperties class. + */ + public AnomaliesSettingsProperties() { + } + + /** + * Get the isEnabled property: Determines whether the setting is enable or disabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnomaliesSettingsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnomaliesSettingsProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AnomaliesSettingsProperties. + */ + public static AnomaliesSettingsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnomaliesSettingsProperties deserializedAnomaliesSettingsProperties = new AnomaliesSettingsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedAnomaliesSettingsProperties.isEnabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAnomaliesSettingsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ApiPollingParameters.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ApiPollingParameters.java new file mode 100644 index 000000000000..50e2d664d0e8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ApiPollingParameters.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingConfigProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigProperties; +import java.io.IOException; + +/** + * Represents Codeless API Polling data connector. + */ +@Fluent +public final class ApiPollingParameters implements JsonSerializable { + /* + * Config to describe the instructions blade + */ + private CodelessUiConnectorConfigProperties connectorUiConfig; + + /* + * Config to describe the polling instructions + */ + private CodelessConnectorPollingConfigProperties pollingConfig; + + /** + * Creates an instance of ApiPollingParameters class. + */ + public ApiPollingParameters() { + } + + /** + * Get the connectorUiConfig property: Config to describe the instructions blade. + * + * @return the connectorUiConfig value. + */ + public CodelessUiConnectorConfigProperties connectorUiConfig() { + return this.connectorUiConfig; + } + + /** + * Set the connectorUiConfig property: Config to describe the instructions blade. + * + * @param connectorUiConfig the connectorUiConfig value to set. + * @return the ApiPollingParameters object itself. + */ + public ApiPollingParameters withConnectorUiConfig(CodelessUiConnectorConfigProperties connectorUiConfig) { + this.connectorUiConfig = connectorUiConfig; + return this; + } + + /** + * Get the pollingConfig property: Config to describe the polling instructions. + * + * @return the pollingConfig value. + */ + public CodelessConnectorPollingConfigProperties pollingConfig() { + return this.pollingConfig; + } + + /** + * Set the pollingConfig property: Config to describe the polling instructions. + * + * @param pollingConfig the pollingConfig value to set. + * @return the ApiPollingParameters object itself. + */ + public ApiPollingParameters withPollingConfig(CodelessConnectorPollingConfigProperties pollingConfig) { + this.pollingConfig = pollingConfig; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectorUiConfig() != null) { + connectorUiConfig().validate(); + } + if (pollingConfig() != null) { + pollingConfig().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("connectorUiConfig", this.connectorUiConfig); + jsonWriter.writeJsonField("pollingConfig", this.pollingConfig); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiPollingParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiPollingParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ApiPollingParameters. + */ + public static ApiPollingParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiPollingParameters deserializedApiPollingParameters = new ApiPollingParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectorUiConfig".equals(fieldName)) { + deserializedApiPollingParameters.connectorUiConfig + = CodelessUiConnectorConfigProperties.fromJson(reader); + } else if ("pollingConfig".equals(fieldName)) { + deserializedApiPollingParameters.pollingConfig + = CodelessConnectorPollingConfigProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApiPollingParameters; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AscCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AscCheckRequirementsProperties.java new file mode 100644 index 000000000000..10fa9858aa1c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AscCheckRequirementsProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * ASC (Azure Security Center) requirements check properties. + */ +@Fluent +public final class AscCheckRequirementsProperties implements JsonSerializable { + /* + * The subscription id to connect to, and get the data from. + */ + private String subscriptionId; + + /** + * Creates an instance of AscCheckRequirementsProperties class. + */ + public AscCheckRequirementsProperties() { + } + + /** + * Get the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the AscCheckRequirementsProperties object itself. + */ + public AscCheckRequirementsProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AscCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AscCheckRequirementsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AscCheckRequirementsProperties. + */ + public static AscCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AscCheckRequirementsProperties deserializedAscCheckRequirementsProperties + = new AscCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionId".equals(fieldName)) { + deserializedAscCheckRequirementsProperties.subscriptionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAscCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AwsCloudTrailDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AwsCloudTrailDataConnectorProperties.java index 272f287264ab..90a43fd7cc58 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AwsCloudTrailDataConnectorProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AwsCloudTrailDataConnectorProperties.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -82,19 +83,25 @@ public AwsCloudTrailDataConnectorProperties withDataTypes(AwsCloudTrailDataConne * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (dataTypes() != null) { + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model AwsCloudTrailDataConnectorProperties")); + } else { dataTypes().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(AwsCloudTrailDataConnectorProperties.class); + /** * {@inheritDoc} */ @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("awsRoleArn", this.awsRoleArn); jsonWriter.writeJsonField("dataTypes", this.dataTypes); + jsonWriter.writeStringField("awsRoleArn", this.awsRoleArn); return jsonWriter.writeEndObject(); } @@ -104,6 +111,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of AwsCloudTrailDataConnectorProperties if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the AwsCloudTrailDataConnectorProperties. */ public static AwsCloudTrailDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { @@ -114,11 +122,11 @@ public static AwsCloudTrailDataConnectorProperties fromJson(JsonReader jsonReade String fieldName = reader.getFieldName(); reader.nextToken(); - if ("awsRoleArn".equals(fieldName)) { - deserializedAwsCloudTrailDataConnectorProperties.awsRoleArn = reader.getString(); - } else if ("dataTypes".equals(fieldName)) { + if ("dataTypes".equals(fieldName)) { deserializedAwsCloudTrailDataConnectorProperties.dataTypes = AwsCloudTrailDataConnectorDataTypes.fromJson(reader); + } else if ("awsRoleArn".equals(fieldName)) { + deserializedAwsCloudTrailDataConnectorProperties.awsRoleArn = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AwsS3DataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AwsS3DataConnectorProperties.java new file mode 100644 index 000000000000..3320e607be78 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/AwsS3DataConnectorProperties.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AwsS3DataConnectorDataTypes; +import java.io.IOException; +import java.util.List; + +/** + * Amazon Web Services S3 data connector properties. + */ +@Fluent +public final class AwsS3DataConnectorProperties implements JsonSerializable { + /* + * The logs destination table name in LogAnalytics. + */ + private String destinationTable; + + /* + * The AWS sqs urls for the connector. + */ + private List sqsUrls; + + /* + * The Aws Role Arn that is used to access the Aws account. + */ + private String roleArn; + + /* + * The available data types for the connector. + */ + private AwsS3DataConnectorDataTypes dataTypes; + + /** + * Creates an instance of AwsS3DataConnectorProperties class. + */ + public AwsS3DataConnectorProperties() { + } + + /** + * Get the destinationTable property: The logs destination table name in LogAnalytics. + * + * @return the destinationTable value. + */ + public String destinationTable() { + return this.destinationTable; + } + + /** + * Set the destinationTable property: The logs destination table name in LogAnalytics. + * + * @param destinationTable the destinationTable value to set. + * @return the AwsS3DataConnectorProperties object itself. + */ + public AwsS3DataConnectorProperties withDestinationTable(String destinationTable) { + this.destinationTable = destinationTable; + return this; + } + + /** + * Get the sqsUrls property: The AWS sqs urls for the connector. + * + * @return the sqsUrls value. + */ + public List sqsUrls() { + return this.sqsUrls; + } + + /** + * Set the sqsUrls property: The AWS sqs urls for the connector. + * + * @param sqsUrls the sqsUrls value to set. + * @return the AwsS3DataConnectorProperties object itself. + */ + public AwsS3DataConnectorProperties withSqsUrls(List sqsUrls) { + this.sqsUrls = sqsUrls; + return this; + } + + /** + * Get the roleArn property: The Aws Role Arn that is used to access the Aws account. + * + * @return the roleArn value. + */ + public String roleArn() { + return this.roleArn; + } + + /** + * Set the roleArn property: The Aws Role Arn that is used to access the Aws account. + * + * @param roleArn the roleArn value to set. + * @return the AwsS3DataConnectorProperties object itself. + */ + public AwsS3DataConnectorProperties withRoleArn(String roleArn) { + this.roleArn = roleArn; + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public AwsS3DataConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the AwsS3DataConnectorProperties object itself. + */ + public AwsS3DataConnectorProperties withDataTypes(AwsS3DataConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (destinationTable() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property destinationTable in model AwsS3DataConnectorProperties")); + } + if (sqsUrls() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sqsUrls in model AwsS3DataConnectorProperties")); + } + if (roleArn() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property roleArn in model AwsS3DataConnectorProperties")); + } + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model AwsS3DataConnectorProperties")); + } else { + dataTypes().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AwsS3DataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("destinationTable", this.destinationTable); + jsonWriter.writeArrayField("sqsUrls", this.sqsUrls, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("roleArn", this.roleArn); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsS3DataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsS3DataConnectorProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwsS3DataConnectorProperties. + */ + public static AwsS3DataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsS3DataConnectorProperties deserializedAwsS3DataConnectorProperties = new AwsS3DataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("destinationTable".equals(fieldName)) { + deserializedAwsS3DataConnectorProperties.destinationTable = reader.getString(); + } else if ("sqsUrls".equals(fieldName)) { + List sqsUrls = reader.readArray(reader1 -> reader1.getString()); + deserializedAwsS3DataConnectorProperties.sqsUrls = sqsUrls; + } else if ("roleArn".equals(fieldName)) { + deserializedAwsS3DataConnectorProperties.roleArn = reader.getString(); + } else if ("dataTypes".equals(fieldName)) { + deserializedAwsS3DataConnectorProperties.dataTypes = AwsS3DataConnectorDataTypes.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsS3DataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BillingStatisticInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BillingStatisticInner.java new file mode 100644 index 000000000000..23b95e87da4a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BillingStatisticInner.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AzureEntityResource; +import com.azure.resourcemanager.securityinsights.models.BillingStatisticKind; +import com.azure.resourcemanager.securityinsights.models.SapSolutionUsageStatistic; +import java.io.IOException; + +/** + * Billing statistic. + */ +@Immutable +public class BillingStatisticInner extends AzureEntityResource { + /* + * The kind of the billing statistic + */ + private BillingStatisticKind kind = BillingStatisticKind.fromString("BillingStatistic"); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Resource Etag. + */ + private String etag; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BillingStatisticInner class. + */ + public BillingStatisticInner() { + } + + /** + * Get the kind property: The kind of the billing statistic. + * + * @return the kind value. + */ + public BillingStatisticKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BillingStatisticInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BillingStatisticInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BillingStatisticInner. + */ + public static BillingStatisticInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SapSolutionUsage".equals(discriminatorValue)) { + return SapSolutionUsageStatistic.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static BillingStatisticInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BillingStatisticInner deserializedBillingStatisticInner = new BillingStatisticInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBillingStatisticInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBillingStatisticInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBillingStatisticInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedBillingStatisticInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedBillingStatisticInner.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedBillingStatisticInner.kind = BillingStatisticKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBillingStatisticInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkExpandResponseInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkExpandResponseInner.java new file mode 100644 index 000000000000..dc68c86915ac --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkExpandResponseInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandResponseValue; +import com.azure.resourcemanager.securityinsights.models.ExpansionResultsMetadata; +import java.io.IOException; + +/** + * The entity expansion result operation response. + */ +@Fluent +public final class BookmarkExpandResponseInner implements JsonSerializable { + /* + * The metadata from the expansion operation results. + */ + private ExpansionResultsMetadata metadata; + + /* + * The expansion result values. + */ + private BookmarkExpandResponseValue value; + + /** + * Creates an instance of BookmarkExpandResponseInner class. + */ + public BookmarkExpandResponseInner() { + } + + /** + * Get the metadata property: The metadata from the expansion operation results. + * + * @return the metadata value. + */ + public ExpansionResultsMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The metadata from the expansion operation results. + * + * @param metadata the metadata value to set. + * @return the BookmarkExpandResponseInner object itself. + */ + public BookmarkExpandResponseInner withMetadata(ExpansionResultsMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the value property: The expansion result values. + * + * @return the value value. + */ + public BookmarkExpandResponseValue value() { + return this.value; + } + + /** + * Set the value property: The expansion result values. + * + * @param value the value value to set. + * @return the BookmarkExpandResponseInner object itself. + */ + public BookmarkExpandResponseInner withValue(BookmarkExpandResponseValue value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().validate(); + } + if (value() != null) { + value().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("metaData", this.metadata); + jsonWriter.writeJsonField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookmarkExpandResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookmarkExpandResponseInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BookmarkExpandResponseInner. + */ + public static BookmarkExpandResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookmarkExpandResponseInner deserializedBookmarkExpandResponseInner = new BookmarkExpandResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metaData".equals(fieldName)) { + deserializedBookmarkExpandResponseInner.metadata = ExpansionResultsMetadata.fromJson(reader); + } else if ("value".equals(fieldName)) { + deserializedBookmarkExpandResponseInner.value = BookmarkExpandResponseValue.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBookmarkExpandResponseInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkInner.java index 5d156d50c82d..177daa18330e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkInner.java @@ -9,6 +9,8 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.BookmarkEntityMappings; import com.azure.resourcemanager.securityinsights.models.IncidentInfo; import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; import com.azure.resourcemanager.securityinsights.models.UserInfo; @@ -409,6 +411,75 @@ public BookmarkInner withIncidentInfo(IncidentInfo incidentInfo) { return this; } + /** + * Get the entityMappings property: Describes the entity mappings of the bookmark. + * + * @return the entityMappings value. + */ + public List entityMappings() { + return this.innerProperties() == null ? null : this.innerProperties().entityMappings(); + } + + /** + * Set the entityMappings property: Describes the entity mappings of the bookmark. + * + * @param entityMappings the entityMappings value to set. + * @return the BookmarkInner object itself. + */ + public BookmarkInner withEntityMappings(List entityMappings) { + if (this.innerProperties() == null) { + this.innerProperties = new BookmarkProperties(); + } + this.innerProperties().withEntityMappings(entityMappings); + return this; + } + + /** + * Get the tactics property: A list of relevant mitre attacks. + * + * @return the tactics value. + */ + public List tactics() { + return this.innerProperties() == null ? null : this.innerProperties().tactics(); + } + + /** + * Set the tactics property: A list of relevant mitre attacks. + * + * @param tactics the tactics value to set. + * @return the BookmarkInner object itself. + */ + public BookmarkInner withTactics(List tactics) { + if (this.innerProperties() == null) { + this.innerProperties = new BookmarkProperties(); + } + this.innerProperties().withTactics(tactics); + return this; + } + + /** + * Get the techniques property: A list of relevant mitre techniques. + * + * @return the techniques value. + */ + public List techniques() { + return this.innerProperties() == null ? null : this.innerProperties().techniques(); + } + + /** + * Set the techniques property: A list of relevant mitre techniques. + * + * @param techniques the techniques value to set. + * @return the BookmarkInner object itself. + */ + public BookmarkInner withTechniques(List techniques) { + if (this.innerProperties() == null) { + this.innerProperties = new BookmarkProperties(); + } + this.innerProperties().withTechniques(techniques); + return this; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkProperties.java index 971c9bc589fd..e5b95c85bc6a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BookmarkProperties.java @@ -11,6 +11,8 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.BookmarkEntityMappings; import com.azure.resourcemanager.securityinsights.models.IncidentInfo; import com.azure.resourcemanager.securityinsights.models.UserInfo; import java.io.IOException; @@ -88,6 +90,21 @@ public final class BookmarkProperties implements JsonSerializable entityMappings; + + /* + * A list of relevant mitre attacks + */ + private List tactics; + + /* + * A list of relevant mitre techniques + */ + private List techniques; + /** * Creates an instance of BookmarkProperties class. */ @@ -354,6 +371,66 @@ public BookmarkProperties withIncidentInfo(IncidentInfo incidentInfo) { return this; } + /** + * Get the entityMappings property: Describes the entity mappings of the bookmark. + * + * @return the entityMappings value. + */ + public List entityMappings() { + return this.entityMappings; + } + + /** + * Set the entityMappings property: Describes the entity mappings of the bookmark. + * + * @param entityMappings the entityMappings value to set. + * @return the BookmarkProperties object itself. + */ + public BookmarkProperties withEntityMappings(List entityMappings) { + this.entityMappings = entityMappings; + return this; + } + + /** + * Get the tactics property: A list of relevant mitre attacks. + * + * @return the tactics value. + */ + public List tactics() { + return this.tactics; + } + + /** + * Set the tactics property: A list of relevant mitre attacks. + * + * @param tactics the tactics value to set. + * @return the BookmarkProperties object itself. + */ + public BookmarkProperties withTactics(List tactics) { + this.tactics = tactics; + return this; + } + + /** + * Get the techniques property: A list of relevant mitre techniques. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Set the techniques property: A list of relevant mitre techniques. + * + * @param techniques the techniques value to set. + * @return the BookmarkProperties object itself. + */ + public BookmarkProperties withTechniques(List techniques) { + this.techniques = techniques; + return this; + } + /** * Validates the instance. * @@ -377,6 +454,9 @@ public void validate() { if (incidentInfo() != null) { incidentInfo().validate(); } + if (entityMappings() != null) { + entityMappings().forEach(e -> e.validate()); + } } private static final ClientLogger LOGGER = new ClientLogger(BookmarkProperties.class); @@ -405,6 +485,11 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("queryEndTime", this.queryEndTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.queryEndTime)); jsonWriter.writeJsonField("incidentInfo", this.incidentInfo); + jsonWriter.writeArrayField("entityMappings", this.entityMappings, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("tactics", this.tactics, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } @@ -456,6 +541,17 @@ public static BookmarkProperties fromJson(JsonReader jsonReader) throws IOExcept .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("incidentInfo".equals(fieldName)) { deserializedBookmarkProperties.incidentInfo = IncidentInfo.fromJson(reader); + } else if ("entityMappings".equals(fieldName)) { + List entityMappings + = reader.readArray(reader1 -> BookmarkEntityMappings.fromJson(reader1)); + deserializedBookmarkProperties.entityMappings = entityMappings; + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedBookmarkProperties.tactics = tactics; + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedBookmarkProperties.techniques = techniques; } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BusinessApplicationAgentResourceInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BusinessApplicationAgentResourceInner.java new file mode 100644 index 000000000000..7cc6a2c81c7c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/BusinessApplicationAgentResourceInner.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AgentConfiguration; +import com.azure.resourcemanager.securityinsights.models.AgentSystem; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Describes the configuration of a Business Application Agent. + */ +@Fluent +public final class BusinessApplicationAgentResourceInner extends ResourceWithEtag { + /* + * The properties property. + */ + private AgentProperties innerProperties = new AgentProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BusinessApplicationAgentResourceInner class. + */ + public BusinessApplicationAgentResourceInner() { + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private AgentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public BusinessApplicationAgentResourceInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the configuration property: Describes the configuration of a Business Application Agent. + * + * @return the configuration value. + */ + public AgentConfiguration configuration() { + return this.innerProperties() == null ? null : this.innerProperties().configuration(); + } + + /** + * Set the configuration property: Describes the configuration of a Business Application Agent. + * + * @param configuration the configuration value to set. + * @return the BusinessApplicationAgentResourceInner object itself. + */ + public BusinessApplicationAgentResourceInner withConfiguration(AgentConfiguration configuration) { + if (this.innerProperties() == null) { + this.innerProperties = new AgentProperties(); + } + this.innerProperties().withConfiguration(configuration); + return this; + } + + /** + * Get the agentSystems property: The agentSystems property. + * + * @return the agentSystems value. + */ + public List agentSystems() { + return this.innerProperties() == null ? null : this.innerProperties().agentSystems(); + } + + /** + * Get the displayName property: The displayName property. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The displayName property. + * + * @param displayName the displayName value to set. + * @return the BusinessApplicationAgentResourceInner object itself. + */ + public BusinessApplicationAgentResourceInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new AgentProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the lastModifiedTimeUtc property: The lastModifiedTimeUtc property. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model BusinessApplicationAgentResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BusinessApplicationAgentResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BusinessApplicationAgentResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BusinessApplicationAgentResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BusinessApplicationAgentResourceInner. + */ + public static BusinessApplicationAgentResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BusinessApplicationAgentResourceInner deserializedBusinessApplicationAgentResourceInner + = new BusinessApplicationAgentResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBusinessApplicationAgentResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBusinessApplicationAgentResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBusinessApplicationAgentResourceInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedBusinessApplicationAgentResourceInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedBusinessApplicationAgentResourceInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedBusinessApplicationAgentResourceInner.innerProperties + = AgentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBusinessApplicationAgentResourceInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/CodelessParameters.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/CodelessParameters.java new file mode 100644 index 000000000000..3941049d4bcb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/CodelessParameters.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigProperties; +import java.io.IOException; + +/** + * Represents Codeless UI data connector. + */ +@Fluent +public final class CodelessParameters implements JsonSerializable { + /* + * Config to describe the instructions blade + */ + private CodelessUiConnectorConfigProperties connectorUiConfig; + + /** + * Creates an instance of CodelessParameters class. + */ + public CodelessParameters() { + } + + /** + * Get the connectorUiConfig property: Config to describe the instructions blade. + * + * @return the connectorUiConfig value. + */ + public CodelessUiConnectorConfigProperties connectorUiConfig() { + return this.connectorUiConfig; + } + + /** + * Set the connectorUiConfig property: Config to describe the instructions blade. + * + * @param connectorUiConfig the connectorUiConfig value to set. + * @return the CodelessParameters object itself. + */ + public CodelessParameters withConnectorUiConfig(CodelessUiConnectorConfigProperties connectorUiConfig) { + this.connectorUiConfig = connectorUiConfig; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectorUiConfig() != null) { + connectorUiConfig().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("connectorUiConfig", this.connectorUiConfig); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessParameters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CodelessParameters. + */ + public static CodelessParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessParameters deserializedCodelessParameters = new CodelessParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectorUiConfig".equals(fieldName)) { + deserializedCodelessParameters.connectorUiConfig + = CodelessUiConnectorConfigProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessParameters; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/CustomizableConnectorDefinitionProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/CustomizableConnectorDefinitionProperties.java new file mode 100644 index 000000000000..0cb5dd7a4884 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/CustomizableConnectorDefinitionProperties.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.CustomizableConnectionsConfig; +import com.azure.resourcemanager.securityinsights.models.CustomizableConnectorUiConfig; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The UiConfig for 'Customizable' connector definition kind. + */ +@Fluent +public final class CustomizableConnectorDefinitionProperties + implements JsonSerializable { + /* + * Gets or sets the connector definition created date in UTC format. + */ + private OffsetDateTime createdTimeUtc; + + /* + * Gets or sets the connector definition last modified date in UTC format. + */ + private OffsetDateTime lastModifiedUtc; + + /* + * The UiConfig for 'Customizable' connector definition kind. + */ + private CustomizableConnectorUiConfig connectorUiConfig; + + /* + * The UiConfig for 'Customizable' connector definition kind. + */ + private CustomizableConnectionsConfig connectionsConfig; + + /** + * Creates an instance of CustomizableConnectorDefinitionProperties class. + */ + public CustomizableConnectorDefinitionProperties() { + } + + /** + * Get the createdTimeUtc property: Gets or sets the connector definition created date in UTC format. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.createdTimeUtc; + } + + /** + * Set the createdTimeUtc property: Gets or sets the connector definition created date in UTC format. + * + * @param createdTimeUtc the createdTimeUtc value to set. + * @return the CustomizableConnectorDefinitionProperties object itself. + */ + public CustomizableConnectorDefinitionProperties withCreatedTimeUtc(OffsetDateTime createdTimeUtc) { + this.createdTimeUtc = createdTimeUtc; + return this; + } + + /** + * Get the lastModifiedUtc property: Gets or sets the connector definition last modified date in UTC format. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Set the lastModifiedUtc property: Gets or sets the connector definition last modified date in UTC format. + * + * @param lastModifiedUtc the lastModifiedUtc value to set. + * @return the CustomizableConnectorDefinitionProperties object itself. + */ + public CustomizableConnectorDefinitionProperties withLastModifiedUtc(OffsetDateTime lastModifiedUtc) { + this.lastModifiedUtc = lastModifiedUtc; + return this; + } + + /** + * Get the connectorUiConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @return the connectorUiConfig value. + */ + public CustomizableConnectorUiConfig connectorUiConfig() { + return this.connectorUiConfig; + } + + /** + * Set the connectorUiConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @param connectorUiConfig the connectorUiConfig value to set. + * @return the CustomizableConnectorDefinitionProperties object itself. + */ + public CustomizableConnectorDefinitionProperties + withConnectorUiConfig(CustomizableConnectorUiConfig connectorUiConfig) { + this.connectorUiConfig = connectorUiConfig; + return this; + } + + /** + * Get the connectionsConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @return the connectionsConfig value. + */ + public CustomizableConnectionsConfig connectionsConfig() { + return this.connectionsConfig; + } + + /** + * Set the connectionsConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @param connectionsConfig the connectionsConfig value to set. + * @return the CustomizableConnectorDefinitionProperties object itself. + */ + public CustomizableConnectorDefinitionProperties + withConnectionsConfig(CustomizableConnectionsConfig connectionsConfig) { + this.connectionsConfig = connectionsConfig; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectorUiConfig() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectorUiConfig in model CustomizableConnectorDefinitionProperties")); + } else { + connectorUiConfig().validate(); + } + if (connectionsConfig() != null) { + connectionsConfig().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CustomizableConnectorDefinitionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("connectorUiConfig", this.connectorUiConfig); + jsonWriter.writeStringField("createdTimeUtc", + this.createdTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdTimeUtc)); + jsonWriter.writeStringField("lastModifiedUtc", + this.lastModifiedUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedUtc)); + jsonWriter.writeJsonField("connectionsConfig", this.connectionsConfig); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomizableConnectorDefinitionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomizableConnectorDefinitionProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomizableConnectorDefinitionProperties. + */ + public static CustomizableConnectorDefinitionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomizableConnectorDefinitionProperties deserializedCustomizableConnectorDefinitionProperties + = new CustomizableConnectorDefinitionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectorUiConfig".equals(fieldName)) { + deserializedCustomizableConnectorDefinitionProperties.connectorUiConfig + = CustomizableConnectorUiConfig.fromJson(reader); + } else if ("createdTimeUtc".equals(fieldName)) { + deserializedCustomizableConnectorDefinitionProperties.createdTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedUtc".equals(fieldName)) { + deserializedCustomizableConnectorDefinitionProperties.lastModifiedUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("connectionsConfig".equals(fieldName)) { + deserializedCustomizableConnectorDefinitionProperties.connectionsConfig + = CustomizableConnectionsConfig.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomizableConnectorDefinitionProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorDefinitionInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorDefinitionInner.java new file mode 100644 index 000000000000..1ad105a0743b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorDefinitionInner.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.CustomizableConnectorDefinition; +import com.azure.resourcemanager.securityinsights.models.DataConnectorDefinitionKind; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; + +/** + * An Azure resource, which encapsulate the entire info requires to display a data connector page in Azure portal, + * and the info required to define data connections. + */ +@Fluent +public class DataConnectorDefinitionInner extends ResourceWithEtag { + /* + * The data connector kind + */ + private DataConnectorDefinitionKind kind = DataConnectorDefinitionKind.fromString("DataConnectorDefinition"); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DataConnectorDefinitionInner class. + */ + public DataConnectorDefinitionInner() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + public DataConnectorDefinitionKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public DataConnectorDefinitionInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorDefinitionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorDefinitionInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataConnectorDefinitionInner. + */ + public static DataConnectorDefinitionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Customizable".equals(discriminatorValue)) { + return CustomizableConnectorDefinition.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static DataConnectorDefinitionInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorDefinitionInner deserializedDataConnectorDefinitionInner = new DataConnectorDefinitionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDataConnectorDefinitionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDataConnectorDefinitionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDataConnectorDefinitionInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedDataConnectorDefinitionInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedDataConnectorDefinitionInner.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedDataConnectorDefinitionInner.kind + = DataConnectorDefinitionKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorDefinitionInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorInner.java index 8fdbe82ec45f..fee549b65bdc 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorInner.java @@ -13,12 +13,28 @@ import com.azure.resourcemanager.securityinsights.models.AatpDataConnector; import com.azure.resourcemanager.securityinsights.models.AscDataConnector; import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnector; +import com.azure.resourcemanager.securityinsights.models.AwsS3DataConnector; +import com.azure.resourcemanager.securityinsights.models.CodelessApiPollingDataConnector; +import com.azure.resourcemanager.securityinsights.models.CodelessUiDataConnector; import com.azure.resourcemanager.securityinsights.models.DataConnectorKind; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnector; +import com.azure.resourcemanager.securityinsights.models.GcpDataConnector; +import com.azure.resourcemanager.securityinsights.models.IoTDataConnector; import com.azure.resourcemanager.securityinsights.models.McasDataConnector; import com.azure.resourcemanager.securityinsights.models.MdatpDataConnector; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionDataConnector; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnector; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnector; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectDataConnector; +import com.azure.resourcemanager.securityinsights.models.OfficeAtpDataConnector; import com.azure.resourcemanager.securityinsights.models.OfficeDataConnector; +import com.azure.resourcemanager.securityinsights.models.OfficeIrmDataConnector; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIDataConnector; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditDataConnector; import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import com.azure.resourcemanager.securityinsights.models.RestApiPollerDataConnector; import com.azure.resourcemanager.securityinsights.models.TIDataConnector; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnector; import java.io.IOException; /** @@ -162,20 +178,52 @@ public static DataConnectorInner fromJson(JsonReader jsonReader) throws IOExcept // Use the discriminator value to determine which subtype should be deserialized. if ("AzureActiveDirectory".equals(discriminatorValue)) { return AadDataConnector.fromJson(readerToUse.reset()); + } else if ("MicrosoftThreatIntelligence".equals(discriminatorValue)) { + return MstiDataConnector.fromJson(readerToUse.reset()); + } else if ("MicrosoftThreatProtection".equals(discriminatorValue)) { + return MtpDataConnector.fromJson(readerToUse.reset()); } else if ("AzureAdvancedThreatProtection".equals(discriminatorValue)) { return AatpDataConnector.fromJson(readerToUse.reset()); } else if ("AzureSecurityCenter".equals(discriminatorValue)) { return AscDataConnector.fromJson(readerToUse.reset()); } else if ("AmazonWebServicesCloudTrail".equals(discriminatorValue)) { return AwsCloudTrailDataConnector.fromJson(readerToUse.reset()); + } else if ("AmazonWebServicesS3".equals(discriminatorValue)) { + return AwsS3DataConnector.fromJson(readerToUse.reset()); + } else if ("RestApiPoller".equals(discriminatorValue)) { + return RestApiPollerDataConnector.fromJson(readerToUse.reset()); + } else if ("GCP".equals(discriminatorValue)) { + return GcpDataConnector.fromJson(readerToUse.reset()); } else if ("MicrosoftCloudAppSecurity".equals(discriminatorValue)) { return McasDataConnector.fromJson(readerToUse.reset()); + } else if ("Dynamics365".equals(discriminatorValue)) { + return Dynamics365DataConnector.fromJson(readerToUse.reset()); + } else if ("OfficeATP".equals(discriminatorValue)) { + return OfficeAtpDataConnector.fromJson(readerToUse.reset()); + } else if ("MicrosoftPurviewInformationProtection".equals(discriminatorValue)) { + return MicrosoftPurviewInformationProtectionDataConnector.fromJson(readerToUse.reset()); + } else if ("Office365Project".equals(discriminatorValue)) { + return Office365ProjectDataConnector.fromJson(readerToUse.reset()); + } else if ("OfficePowerBI".equals(discriminatorValue)) { + return OfficePowerBIDataConnector.fromJson(readerToUse.reset()); + } else if ("PurviewAudit".equals(discriminatorValue)) { + return PurviewAuditDataConnector.fromJson(readerToUse.reset()); + } else if ("OfficeIRM".equals(discriminatorValue)) { + return OfficeIrmDataConnector.fromJson(readerToUse.reset()); } else if ("MicrosoftDefenderAdvancedThreatProtection".equals(discriminatorValue)) { return MdatpDataConnector.fromJson(readerToUse.reset()); - } else if ("ThreatIntelligence".equals(discriminatorValue)) { - return TIDataConnector.fromJson(readerToUse.reset()); } else if ("Office365".equals(discriminatorValue)) { return OfficeDataConnector.fromJson(readerToUse.reset()); + } else if ("ThreatIntelligence".equals(discriminatorValue)) { + return TIDataConnector.fromJson(readerToUse.reset()); + } else if ("ThreatIntelligenceTaxii".equals(discriminatorValue)) { + return TiTaxiiDataConnector.fromJson(readerToUse.reset()); + } else if ("IOT".equals(discriminatorValue)) { + return IoTDataConnector.fromJson(readerToUse.reset()); + } else if ("GenericUI".equals(discriminatorValue)) { + return CodelessUiDataConnector.fromJson(readerToUse.reset()); + } else if ("APIPolling".equals(discriminatorValue)) { + return CodelessApiPollingDataConnector.fromJson(readerToUse.reset()); } else { return fromJsonKnownDiscriminator(readerToUse.reset()); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorRequirementsStateInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorRequirementsStateInner.java new file mode 100644 index 000000000000..c57bbd24274a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/DataConnectorRequirementsStateInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorAuthorizationState; +import com.azure.resourcemanager.securityinsights.models.DataConnectorLicenseState; +import java.io.IOException; + +/** + * Data connector requirements status. + */ +@Fluent +public final class DataConnectorRequirementsStateInner + implements JsonSerializable { + /* + * Authorization state for this connector + */ + private DataConnectorAuthorizationState authorizationState; + + /* + * License state for this connector + */ + private DataConnectorLicenseState licenseState; + + /** + * Creates an instance of DataConnectorRequirementsStateInner class. + */ + public DataConnectorRequirementsStateInner() { + } + + /** + * Get the authorizationState property: Authorization state for this connector. + * + * @return the authorizationState value. + */ + public DataConnectorAuthorizationState authorizationState() { + return this.authorizationState; + } + + /** + * Set the authorizationState property: Authorization state for this connector. + * + * @param authorizationState the authorizationState value to set. + * @return the DataConnectorRequirementsStateInner object itself. + */ + public DataConnectorRequirementsStateInner + withAuthorizationState(DataConnectorAuthorizationState authorizationState) { + this.authorizationState = authorizationState; + return this; + } + + /** + * Get the licenseState property: License state for this connector. + * + * @return the licenseState value. + */ + public DataConnectorLicenseState licenseState() { + return this.licenseState; + } + + /** + * Set the licenseState property: License state for this connector. + * + * @param licenseState the licenseState value to set. + * @return the DataConnectorRequirementsStateInner object itself. + */ + public DataConnectorRequirementsStateInner withLicenseState(DataConnectorLicenseState licenseState) { + this.licenseState = licenseState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("authorizationState", + this.authorizationState == null ? null : this.authorizationState.toString()); + jsonWriter.writeStringField("licenseState", this.licenseState == null ? null : this.licenseState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorRequirementsStateInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorRequirementsStateInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataConnectorRequirementsStateInner. + */ + public static DataConnectorRequirementsStateInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorRequirementsStateInner deserializedDataConnectorRequirementsStateInner + = new DataConnectorRequirementsStateInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authorizationState".equals(fieldName)) { + deserializedDataConnectorRequirementsStateInner.authorizationState + = DataConnectorAuthorizationState.fromString(reader.getString()); + } else if ("licenseState".equals(fieldName)) { + deserializedDataConnectorRequirementsStateInner.licenseState + = DataConnectorLicenseState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorRequirementsStateInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Dynamics365CheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Dynamics365CheckRequirementsProperties.java new file mode 100644 index 000000000000..3a39d2e5f9c0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Dynamics365CheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * Dynamics365 requirements check properties. + */ +@Fluent +public final class Dynamics365CheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of Dynamics365CheckRequirementsProperties class. + */ + public Dynamics365CheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public Dynamics365CheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model Dynamics365CheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Dynamics365CheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dynamics365CheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dynamics365CheckRequirementsProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dynamics365CheckRequirementsProperties. + */ + public static Dynamics365CheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dynamics365CheckRequirementsProperties deserializedDynamics365CheckRequirementsProperties + = new Dynamics365CheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedDynamics365CheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDynamics365CheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Dynamics365DataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Dynamics365DataConnectorProperties.java new file mode 100644 index 000000000000..bd440bc9edad --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Dynamics365DataConnectorProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnectorDataTypes; +import java.io.IOException; + +/** + * Dynamics365 data connector properties. + */ +@Fluent +public final class Dynamics365DataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private Dynamics365DataConnectorDataTypes dataTypes; + + /** + * Creates an instance of Dynamics365DataConnectorProperties class. + */ + public Dynamics365DataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public Dynamics365DataConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the Dynamics365DataConnectorProperties object itself. + */ + public Dynamics365DataConnectorProperties withDataTypes(Dynamics365DataConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public Dynamics365DataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model Dynamics365DataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model Dynamics365DataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Dynamics365DataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dynamics365DataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dynamics365DataConnectorProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dynamics365DataConnectorProperties. + */ + public static Dynamics365DataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dynamics365DataConnectorProperties deserializedDynamics365DataConnectorProperties + = new Dynamics365DataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedDynamics365DataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedDynamics365DataConnectorProperties.dataTypes + = Dynamics365DataConnectorDataTypes.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDynamics365DataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EnrichmentDomainWhoisInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EnrichmentDomainWhoisInner.java new file mode 100644 index 000000000000..58d659ab213a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EnrichmentDomainWhoisInner.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainWhoisDetails; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Whois information for a given domain and associated metadata. + */ +@Fluent +public final class EnrichmentDomainWhoisInner implements JsonSerializable { + /* + * The domain for this whois record + */ + private String domain; + + /* + * The hostname of this registrar's whois server + */ + private String server; + + /* + * The timestamp at which this record was created + */ + private OffsetDateTime created; + + /* + * The timestamp at which this record was last updated + */ + private OffsetDateTime updated; + + /* + * The timestamp at which this record will expire + */ + private OffsetDateTime expires; + + /* + * The whois record for a given domain + */ + private EnrichmentDomainWhoisDetails parsedWhois; + + /** + * Creates an instance of EnrichmentDomainWhoisInner class. + */ + public EnrichmentDomainWhoisInner() { + } + + /** + * Get the domain property: The domain for this whois record. + * + * @return the domain value. + */ + public String domain() { + return this.domain; + } + + /** + * Set the domain property: The domain for this whois record. + * + * @param domain the domain value to set. + * @return the EnrichmentDomainWhoisInner object itself. + */ + public EnrichmentDomainWhoisInner withDomain(String domain) { + this.domain = domain; + return this; + } + + /** + * Get the server property: The hostname of this registrar's whois server. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Set the server property: The hostname of this registrar's whois server. + * + * @param server the server value to set. + * @return the EnrichmentDomainWhoisInner object itself. + */ + public EnrichmentDomainWhoisInner withServer(String server) { + this.server = server; + return this; + } + + /** + * Get the created property: The timestamp at which this record was created. + * + * @return the created value. + */ + public OffsetDateTime created() { + return this.created; + } + + /** + * Set the created property: The timestamp at which this record was created. + * + * @param created the created value to set. + * @return the EnrichmentDomainWhoisInner object itself. + */ + public EnrichmentDomainWhoisInner withCreated(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * Get the updated property: The timestamp at which this record was last updated. + * + * @return the updated value. + */ + public OffsetDateTime updated() { + return this.updated; + } + + /** + * Set the updated property: The timestamp at which this record was last updated. + * + * @param updated the updated value to set. + * @return the EnrichmentDomainWhoisInner object itself. + */ + public EnrichmentDomainWhoisInner withUpdated(OffsetDateTime updated) { + this.updated = updated; + return this; + } + + /** + * Get the expires property: The timestamp at which this record will expire. + * + * @return the expires value. + */ + public OffsetDateTime expires() { + return this.expires; + } + + /** + * Set the expires property: The timestamp at which this record will expire. + * + * @param expires the expires value to set. + * @return the EnrichmentDomainWhoisInner object itself. + */ + public EnrichmentDomainWhoisInner withExpires(OffsetDateTime expires) { + this.expires = expires; + return this; + } + + /** + * Get the parsedWhois property: The whois record for a given domain. + * + * @return the parsedWhois value. + */ + public EnrichmentDomainWhoisDetails parsedWhois() { + return this.parsedWhois; + } + + /** + * Set the parsedWhois property: The whois record for a given domain. + * + * @param parsedWhois the parsedWhois value to set. + * @return the EnrichmentDomainWhoisInner object itself. + */ + public EnrichmentDomainWhoisInner withParsedWhois(EnrichmentDomainWhoisDetails parsedWhois) { + this.parsedWhois = parsedWhois; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parsedWhois() != null) { + parsedWhois().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("domain", this.domain); + jsonWriter.writeStringField("server", this.server); + jsonWriter.writeStringField("created", + this.created == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.created)); + jsonWriter.writeStringField("updated", + this.updated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.updated)); + jsonWriter.writeStringField("expires", + this.expires == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expires)); + jsonWriter.writeJsonField("parsedWhois", this.parsedWhois); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentDomainWhoisInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentDomainWhoisInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentDomainWhoisInner. + */ + public static EnrichmentDomainWhoisInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentDomainWhoisInner deserializedEnrichmentDomainWhoisInner = new EnrichmentDomainWhoisInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domain".equals(fieldName)) { + deserializedEnrichmentDomainWhoisInner.domain = reader.getString(); + } else if ("server".equals(fieldName)) { + deserializedEnrichmentDomainWhoisInner.server = reader.getString(); + } else if ("created".equals(fieldName)) { + deserializedEnrichmentDomainWhoisInner.created = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("updated".equals(fieldName)) { + deserializedEnrichmentDomainWhoisInner.updated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expires".equals(fieldName)) { + deserializedEnrichmentDomainWhoisInner.expires = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("parsedWhois".equals(fieldName)) { + deserializedEnrichmentDomainWhoisInner.parsedWhois = EnrichmentDomainWhoisDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentDomainWhoisInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EnrichmentIpGeodataInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EnrichmentIpGeodataInner.java new file mode 100644 index 000000000000..11f8e44758d8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EnrichmentIpGeodataInner.java @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Geodata information for a given IP address. + */ +@Fluent +public final class EnrichmentIpGeodataInner implements JsonSerializable { + /* + * The autonomous system number associated with this IP address + */ + private String asn; + + /* + * The name of the carrier for this IP address + */ + private String carrier; + + /* + * The city this IP address is located in + */ + private String city; + + /* + * A numeric rating of confidence that the value in the 'city' field is correct, on a scale of 0-100 + */ + private Integer cityConfidenceFactor; + + /* + * The continent this IP address is located on + */ + private String continent; + + /* + * The county this IP address is located in + */ + private String country; + + /* + * A numeric rating of confidence that the value in the 'country' field is correct on a scale of 0-100 + */ + private Integer countryConfidenceFactor; + + /* + * The dotted-decimal or colon-separated string representation of the IP address + */ + private String ipAddr; + + /* + * A description of the connection type of this IP address + */ + private String ipRoutingType; + + /* + * The latitude of this IP address + */ + private String latitude; + + /* + * The longitude of this IP address + */ + private String longitude; + + /* + * The name of the organization for this IP address + */ + private String organization; + + /* + * The type of the organization for this IP address + */ + private String organizationType; + + /* + * The geographic region this IP address is located in + */ + private String region; + + /* + * The state this IP address is located in + */ + private String state; + + /* + * A numeric rating of confidence that the value in the 'state' field is correct on a scale of 0-100 + */ + private Integer stateConfidenceFactor; + + /* + * The abbreviated name for the state this IP address is located in + */ + private String stateCode; + + /** + * Creates an instance of EnrichmentIpGeodataInner class. + */ + public EnrichmentIpGeodataInner() { + } + + /** + * Get the asn property: The autonomous system number associated with this IP address. + * + * @return the asn value. + */ + public String asn() { + return this.asn; + } + + /** + * Set the asn property: The autonomous system number associated with this IP address. + * + * @param asn the asn value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withAsn(String asn) { + this.asn = asn; + return this; + } + + /** + * Get the carrier property: The name of the carrier for this IP address. + * + * @return the carrier value. + */ + public String carrier() { + return this.carrier; + } + + /** + * Set the carrier property: The name of the carrier for this IP address. + * + * @param carrier the carrier value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withCarrier(String carrier) { + this.carrier = carrier; + return this; + } + + /** + * Get the city property: The city this IP address is located in. + * + * @return the city value. + */ + public String city() { + return this.city; + } + + /** + * Set the city property: The city this IP address is located in. + * + * @param city the city value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withCity(String city) { + this.city = city; + return this; + } + + /** + * Get the cityConfidenceFactor property: A numeric rating of confidence that the value in the 'city' field is + * correct, on a scale of 0-100. + * + * @return the cityConfidenceFactor value. + */ + public Integer cityConfidenceFactor() { + return this.cityConfidenceFactor; + } + + /** + * Set the cityConfidenceFactor property: A numeric rating of confidence that the value in the 'city' field is + * correct, on a scale of 0-100. + * + * @param cityConfidenceFactor the cityConfidenceFactor value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withCityConfidenceFactor(Integer cityConfidenceFactor) { + this.cityConfidenceFactor = cityConfidenceFactor; + return this; + } + + /** + * Get the continent property: The continent this IP address is located on. + * + * @return the continent value. + */ + public String continent() { + return this.continent; + } + + /** + * Set the continent property: The continent this IP address is located on. + * + * @param continent the continent value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withContinent(String continent) { + this.continent = continent; + return this; + } + + /** + * Get the country property: The county this IP address is located in. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: The county this IP address is located in. + * + * @param country the country value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get the countryConfidenceFactor property: A numeric rating of confidence that the value in the 'country' field is + * correct on a scale of 0-100. + * + * @return the countryConfidenceFactor value. + */ + public Integer countryConfidenceFactor() { + return this.countryConfidenceFactor; + } + + /** + * Set the countryConfidenceFactor property: A numeric rating of confidence that the value in the 'country' field is + * correct on a scale of 0-100. + * + * @param countryConfidenceFactor the countryConfidenceFactor value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withCountryConfidenceFactor(Integer countryConfidenceFactor) { + this.countryConfidenceFactor = countryConfidenceFactor; + return this; + } + + /** + * Get the ipAddr property: The dotted-decimal or colon-separated string representation of the IP address. + * + * @return the ipAddr value. + */ + public String ipAddr() { + return this.ipAddr; + } + + /** + * Set the ipAddr property: The dotted-decimal or colon-separated string representation of the IP address. + * + * @param ipAddr the ipAddr value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withIpAddr(String ipAddr) { + this.ipAddr = ipAddr; + return this; + } + + /** + * Get the ipRoutingType property: A description of the connection type of this IP address. + * + * @return the ipRoutingType value. + */ + public String ipRoutingType() { + return this.ipRoutingType; + } + + /** + * Set the ipRoutingType property: A description of the connection type of this IP address. + * + * @param ipRoutingType the ipRoutingType value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withIpRoutingType(String ipRoutingType) { + this.ipRoutingType = ipRoutingType; + return this; + } + + /** + * Get the latitude property: The latitude of this IP address. + * + * @return the latitude value. + */ + public String latitude() { + return this.latitude; + } + + /** + * Set the latitude property: The latitude of this IP address. + * + * @param latitude the latitude value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withLatitude(String latitude) { + this.latitude = latitude; + return this; + } + + /** + * Get the longitude property: The longitude of this IP address. + * + * @return the longitude value. + */ + public String longitude() { + return this.longitude; + } + + /** + * Set the longitude property: The longitude of this IP address. + * + * @param longitude the longitude value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withLongitude(String longitude) { + this.longitude = longitude; + return this; + } + + /** + * Get the organization property: The name of the organization for this IP address. + * + * @return the organization value. + */ + public String organization() { + return this.organization; + } + + /** + * Set the organization property: The name of the organization for this IP address. + * + * @param organization the organization value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withOrganization(String organization) { + this.organization = organization; + return this; + } + + /** + * Get the organizationType property: The type of the organization for this IP address. + * + * @return the organizationType value. + */ + public String organizationType() { + return this.organizationType; + } + + /** + * Set the organizationType property: The type of the organization for this IP address. + * + * @param organizationType the organizationType value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withOrganizationType(String organizationType) { + this.organizationType = organizationType; + return this; + } + + /** + * Get the region property: The geographic region this IP address is located in. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: The geographic region this IP address is located in. + * + * @param region the region value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the state property: The state this IP address is located in. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state this IP address is located in. + * + * @param state the state value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withState(String state) { + this.state = state; + return this; + } + + /** + * Get the stateConfidenceFactor property: A numeric rating of confidence that the value in the 'state' field is + * correct on a scale of 0-100. + * + * @return the stateConfidenceFactor value. + */ + public Integer stateConfidenceFactor() { + return this.stateConfidenceFactor; + } + + /** + * Set the stateConfidenceFactor property: A numeric rating of confidence that the value in the 'state' field is + * correct on a scale of 0-100. + * + * @param stateConfidenceFactor the stateConfidenceFactor value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withStateConfidenceFactor(Integer stateConfidenceFactor) { + this.stateConfidenceFactor = stateConfidenceFactor; + return this; + } + + /** + * Get the stateCode property: The abbreviated name for the state this IP address is located in. + * + * @return the stateCode value. + */ + public String stateCode() { + return this.stateCode; + } + + /** + * Set the stateCode property: The abbreviated name for the state this IP address is located in. + * + * @param stateCode the stateCode value to set. + * @return the EnrichmentIpGeodataInner object itself. + */ + public EnrichmentIpGeodataInner withStateCode(String stateCode) { + this.stateCode = stateCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("asn", this.asn); + jsonWriter.writeStringField("carrier", this.carrier); + jsonWriter.writeStringField("city", this.city); + jsonWriter.writeNumberField("cityConfidenceFactor", this.cityConfidenceFactor); + jsonWriter.writeStringField("continent", this.continent); + jsonWriter.writeStringField("country", this.country); + jsonWriter.writeNumberField("countryConfidenceFactor", this.countryConfidenceFactor); + jsonWriter.writeStringField("ipAddr", this.ipAddr); + jsonWriter.writeStringField("ipRoutingType", this.ipRoutingType); + jsonWriter.writeStringField("latitude", this.latitude); + jsonWriter.writeStringField("longitude", this.longitude); + jsonWriter.writeStringField("organization", this.organization); + jsonWriter.writeStringField("organizationType", this.organizationType); + jsonWriter.writeStringField("region", this.region); + jsonWriter.writeStringField("state", this.state); + jsonWriter.writeNumberField("stateConfidenceFactor", this.stateConfidenceFactor); + jsonWriter.writeStringField("stateCode", this.stateCode); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentIpGeodataInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentIpGeodataInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentIpGeodataInner. + */ + public static EnrichmentIpGeodataInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentIpGeodataInner deserializedEnrichmentIpGeodataInner = new EnrichmentIpGeodataInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("asn".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.asn = reader.getString(); + } else if ("carrier".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.carrier = reader.getString(); + } else if ("city".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.city = reader.getString(); + } else if ("cityConfidenceFactor".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.cityConfidenceFactor = reader.getNullable(JsonReader::getInt); + } else if ("continent".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.continent = reader.getString(); + } else if ("country".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.country = reader.getString(); + } else if ("countryConfidenceFactor".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.countryConfidenceFactor + = reader.getNullable(JsonReader::getInt); + } else if ("ipAddr".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.ipAddr = reader.getString(); + } else if ("ipRoutingType".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.ipRoutingType = reader.getString(); + } else if ("latitude".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.latitude = reader.getString(); + } else if ("longitude".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.longitude = reader.getString(); + } else if ("organization".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.organization = reader.getString(); + } else if ("organizationType".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.organizationType = reader.getString(); + } else if ("region".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.region = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.state = reader.getString(); + } else if ("stateConfidenceFactor".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.stateConfidenceFactor = reader.getNullable(JsonReader::getInt); + } else if ("stateCode".equals(fieldName)) { + deserializedEnrichmentIpGeodataInner.stateCode = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentIpGeodataInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityAnalyticsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityAnalyticsProperties.java new file mode 100644 index 000000000000..b5a38c1c6aa4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityAnalyticsProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EntityProviders; +import java.io.IOException; +import java.util.List; + +/** + * EntityAnalytics property bag. + */ +@Fluent +public final class EntityAnalyticsProperties implements JsonSerializable { + /* + * The relevant entity providers that are synced + */ + private List entityProviders; + + /** + * Creates an instance of EntityAnalyticsProperties class. + */ + public EntityAnalyticsProperties() { + } + + /** + * Get the entityProviders property: The relevant entity providers that are synced. + * + * @return the entityProviders value. + */ + public List entityProviders() { + return this.entityProviders; + } + + /** + * Set the entityProviders property: The relevant entity providers that are synced. + * + * @param entityProviders the entityProviders value to set. + * @return the EntityAnalyticsProperties object itself. + */ + public EntityAnalyticsProperties withEntityProviders(List entityProviders) { + this.entityProviders = entityProviders; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("entityProviders", this.entityProviders, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityAnalyticsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityAnalyticsProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityAnalyticsProperties. + */ + public static EntityAnalyticsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityAnalyticsProperties deserializedEntityAnalyticsProperties = new EntityAnalyticsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityProviders".equals(fieldName)) { + List entityProviders + = reader.readArray(reader1 -> EntityProviders.fromString(reader1.getString())); + deserializedEntityAnalyticsProperties.entityProviders = entityProviders; + } else { + reader.skipChildren(); + } + } + + return deserializedEntityAnalyticsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityExpandResponseInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityExpandResponseInner.java new file mode 100644 index 000000000000..e6e0b9fa2a56 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityExpandResponseInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EntityExpandResponseValue; +import com.azure.resourcemanager.securityinsights.models.ExpansionResultsMetadata; +import java.io.IOException; + +/** + * The entity expansion result operation response. + */ +@Fluent +public final class EntityExpandResponseInner implements JsonSerializable { + /* + * The metadata from the expansion operation results. + */ + private ExpansionResultsMetadata metadata; + + /* + * The expansion result values. + */ + private EntityExpandResponseValue value; + + /** + * Creates an instance of EntityExpandResponseInner class. + */ + public EntityExpandResponseInner() { + } + + /** + * Get the metadata property: The metadata from the expansion operation results. + * + * @return the metadata value. + */ + public ExpansionResultsMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The metadata from the expansion operation results. + * + * @param metadata the metadata value to set. + * @return the EntityExpandResponseInner object itself. + */ + public EntityExpandResponseInner withMetadata(ExpansionResultsMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the value property: The expansion result values. + * + * @return the value value. + */ + public EntityExpandResponseValue value() { + return this.value; + } + + /** + * Set the value property: The expansion result values. + * + * @param value the value value to set. + * @return the EntityExpandResponseInner object itself. + */ + public EntityExpandResponseInner withValue(EntityExpandResponseValue value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().validate(); + } + if (value() != null) { + value().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("metaData", this.metadata); + jsonWriter.writeJsonField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityExpandResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityExpandResponseInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityExpandResponseInner. + */ + public static EntityExpandResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityExpandResponseInner deserializedEntityExpandResponseInner = new EntityExpandResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metaData".equals(fieldName)) { + deserializedEntityExpandResponseInner.metadata = ExpansionResultsMetadata.fromJson(reader); + } else if ("value".equals(fieldName)) { + deserializedEntityExpandResponseInner.value = EntityExpandResponseValue.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityExpandResponseInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityGetInsightsResponseInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityGetInsightsResponseInner.java new file mode 100644 index 000000000000..4821fc4a1a3d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityGetInsightsResponseInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EntityInsightItem; +import com.azure.resourcemanager.securityinsights.models.GetInsightsResultsMetadata; +import java.io.IOException; +import java.util.List; + +/** + * The Get Insights result operation response. + */ +@Fluent +public final class EntityGetInsightsResponseInner implements JsonSerializable { + /* + * The metadata from the get insights operation results. + */ + private GetInsightsResultsMetadata metadata; + + /* + * The insights result values. + */ + private List value; + + /** + * Creates an instance of EntityGetInsightsResponseInner class. + */ + public EntityGetInsightsResponseInner() { + } + + /** + * Get the metadata property: The metadata from the get insights operation results. + * + * @return the metadata value. + */ + public GetInsightsResultsMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The metadata from the get insights operation results. + * + * @param metadata the metadata value to set. + * @return the EntityGetInsightsResponseInner object itself. + */ + public EntityGetInsightsResponseInner withMetadata(GetInsightsResultsMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the value property: The insights result values. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The insights result values. + * + * @param value the value value to set. + * @return the EntityGetInsightsResponseInner object itself. + */ + public EntityGetInsightsResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().validate(); + } + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("metaData", this.metadata); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityGetInsightsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityGetInsightsResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityGetInsightsResponseInner. + */ + public static EntityGetInsightsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityGetInsightsResponseInner deserializedEntityGetInsightsResponseInner + = new EntityGetInsightsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metaData".equals(fieldName)) { + deserializedEntityGetInsightsResponseInner.metadata = GetInsightsResultsMetadata.fromJson(reader); + } else if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> EntityInsightItem.fromJson(reader1)); + deserializedEntityGetInsightsResponseInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedEntityGetInsightsResponseInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityInner.java new file mode 100644 index 000000000000..d0af51819533 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityInner.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AccountEntity; +import com.azure.resourcemanager.securityinsights.models.AzureResourceEntity; +import com.azure.resourcemanager.securityinsights.models.CloudApplicationEntity; +import com.azure.resourcemanager.securityinsights.models.DnsEntity; +import com.azure.resourcemanager.securityinsights.models.EntityKindEnum; +import com.azure.resourcemanager.securityinsights.models.FileEntity; +import com.azure.resourcemanager.securityinsights.models.FileHashEntity; +import com.azure.resourcemanager.securityinsights.models.HostEntity; +import com.azure.resourcemanager.securityinsights.models.HuntingBookmark; +import com.azure.resourcemanager.securityinsights.models.IoTDeviceEntity; +import com.azure.resourcemanager.securityinsights.models.IpEntity; +import com.azure.resourcemanager.securityinsights.models.MailClusterEntity; +import com.azure.resourcemanager.securityinsights.models.MailMessageEntity; +import com.azure.resourcemanager.securityinsights.models.MailboxEntity; +import com.azure.resourcemanager.securityinsights.models.MalwareEntity; +import com.azure.resourcemanager.securityinsights.models.NicEntity; +import com.azure.resourcemanager.securityinsights.models.ProcessEntity; +import com.azure.resourcemanager.securityinsights.models.RegistryKeyEntity; +import com.azure.resourcemanager.securityinsights.models.RegistryValueEntity; +import com.azure.resourcemanager.securityinsights.models.SecurityAlert; +import com.azure.resourcemanager.securityinsights.models.SecurityGroupEntity; +import com.azure.resourcemanager.securityinsights.models.SubmissionMailEntity; +import com.azure.resourcemanager.securityinsights.models.UrlEntity; +import java.io.IOException; + +/** + * Specific entity. + */ +@Immutable +public class EntityInner extends ProxyResource { + /* + * The kind of the entity. + */ + private EntityKindEnum kind = EntityKindEnum.fromString("Entity"); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EntityInner class. + */ + public EntityInner() { + } + + /** + * Get the kind property: The kind of the entity. + * + * @return the kind value. + */ + public EntityKindEnum kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Set the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @param systemData the systemData value to set. + * @return the EntityInner object itself. + */ + EntityInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityInner. + */ + public static EntityInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SecurityAlert".equals(discriminatorValue)) { + return SecurityAlert.fromJson(readerToUse.reset()); + } else if ("Bookmark".equals(discriminatorValue)) { + return HuntingBookmark.fromJson(readerToUse.reset()); + } else if ("Account".equals(discriminatorValue)) { + return AccountEntity.fromJson(readerToUse.reset()); + } else if ("AzureResource".equals(discriminatorValue)) { + return AzureResourceEntity.fromJson(readerToUse.reset()); + } else if ("CloudApplication".equals(discriminatorValue)) { + return CloudApplicationEntity.fromJson(readerToUse.reset()); + } else if ("DnsResolution".equals(discriminatorValue)) { + return DnsEntity.fromJson(readerToUse.reset()); + } else if ("File".equals(discriminatorValue)) { + return FileEntity.fromJson(readerToUse.reset()); + } else if ("FileHash".equals(discriminatorValue)) { + return FileHashEntity.fromJson(readerToUse.reset()); + } else if ("Host".equals(discriminatorValue)) { + return HostEntity.fromJson(readerToUse.reset()); + } else if ("IoTDevice".equals(discriminatorValue)) { + return IoTDeviceEntity.fromJson(readerToUse.reset()); + } else if ("Ip".equals(discriminatorValue)) { + return IpEntity.fromJson(readerToUse.reset()); + } else if ("Mailbox".equals(discriminatorValue)) { + return MailboxEntity.fromJson(readerToUse.reset()); + } else if ("MailCluster".equals(discriminatorValue)) { + return MailClusterEntity.fromJson(readerToUse.reset()); + } else if ("MailMessage".equals(discriminatorValue)) { + return MailMessageEntity.fromJson(readerToUse.reset()); + } else if ("Malware".equals(discriminatorValue)) { + return MalwareEntity.fromJson(readerToUse.reset()); + } else if ("Process".equals(discriminatorValue)) { + return ProcessEntity.fromJson(readerToUse.reset()); + } else if ("RegistryKey".equals(discriminatorValue)) { + return RegistryKeyEntity.fromJson(readerToUse.reset()); + } else if ("RegistryValue".equals(discriminatorValue)) { + return RegistryValueEntity.fromJson(readerToUse.reset()); + } else if ("SecurityGroup".equals(discriminatorValue)) { + return SecurityGroupEntity.fromJson(readerToUse.reset()); + } else if ("SubmissionMail".equals(discriminatorValue)) { + return SubmissionMailEntity.fromJson(readerToUse.reset()); + } else if ("Url".equals(discriminatorValue)) { + return UrlEntity.fromJson(readerToUse.reset()); + } else if ("Nic".equals(discriminatorValue)) { + return NicEntity.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EntityInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityInner deserializedEntityInner = new EntityInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEntityInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEntityInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEntityInner.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedEntityInner.kind = EntityKindEnum.fromString(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedEntityInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryInner.java new file mode 100644 index 000000000000..45497bef84a8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryInner.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ActivityEntityQuery; +import com.azure.resourcemanager.securityinsights.models.EntityQueryKind; +import com.azure.resourcemanager.securityinsights.models.ExpansionEntityQuery; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; + +/** + * Specific entity query. + */ +@Fluent +public class EntityQueryInner extends ResourceWithEtag { + /* + * the entity query kind + */ + private EntityQueryKind kind = EntityQueryKind.fromString("EntityQuery"); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EntityQueryInner class. + */ + public EntityQueryInner() { + } + + /** + * Get the kind property: the entity query kind. + * + * @return the kind value. + */ + public EntityQueryKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public EntityQueryInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityQueryInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityQueryInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityQueryInner. + */ + public static EntityQueryInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Expansion".equals(discriminatorValue)) { + return ExpansionEntityQuery.fromJson(readerToUse.reset()); + } else if ("Activity".equals(discriminatorValue)) { + return ActivityEntityQuery.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EntityQueryInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityQueryInner deserializedEntityQueryInner = new EntityQueryInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEntityQueryInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEntityQueryInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEntityQueryInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedEntityQueryInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedEntityQueryInner.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedEntityQueryInner.kind = EntityQueryKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityQueryInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryItemInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryItemInner.java new file mode 100644 index 000000000000..3c8e6769159d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryItemInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EntityQueryKind; +import com.azure.resourcemanager.securityinsights.models.InsightQueryItem; +import java.io.IOException; + +/** + * An abstract Query item for entity. + */ +@Fluent +public class EntityQueryItemInner implements JsonSerializable { + /* + * The kind of the entity query + */ + private EntityQueryKind kind = EntityQueryKind.fromString("EntityQueryItem"); + + /* + * Query Template ARM ID + */ + private String id; + + /* + * Query Template ARM Name + */ + private String name; + + /* + * ARM Type + */ + private String type; + + /** + * Creates an instance of EntityQueryItemInner class. + */ + public EntityQueryItemInner() { + } + + /** + * Get the kind property: The kind of the entity query. + * + * @return the kind value. + */ + public EntityQueryKind kind() { + return this.kind; + } + + /** + * Get the id property: Query Template ARM ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Query Template ARM ID. + * + * @param id the id value to set. + * @return the EntityQueryItemInner object itself. + */ + EntityQueryItemInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Query Template ARM Name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Query Template ARM Name. + * + * @param name the name value to set. + * @return the EntityQueryItemInner object itself. + */ + public EntityQueryItemInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: ARM Type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: ARM Type. + * + * @param type the type value to set. + * @return the EntityQueryItemInner object itself. + */ + public EntityQueryItemInner withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityQueryItemInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityQueryItemInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityQueryItemInner. + */ + public static EntityQueryItemInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Insight".equals(discriminatorValue)) { + return InsightQueryItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EntityQueryItemInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityQueryItemInner deserializedEntityQueryItemInner = new EntityQueryItemInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedEntityQueryItemInner.kind = EntityQueryKind.fromString(reader.getString()); + } else if ("id".equals(fieldName)) { + deserializedEntityQueryItemInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEntityQueryItemInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEntityQueryItemInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityQueryItemInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryTemplateInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryTemplateInner.java new file mode 100644 index 000000000000..36fefa4646d8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityQueryTemplateInner.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ActivityEntityQueryTemplate; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; +import java.io.IOException; + +/** + * Specific entity query template. + */ +@Immutable +public class EntityQueryTemplateInner extends ProxyResource { + /* + * the entity query template kind + */ + private EntityQueryTemplateKind kind = EntityQueryTemplateKind.fromString("EntityQueryTemplate"); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EntityQueryTemplateInner class. + */ + public EntityQueryTemplateInner() { + } + + /** + * Get the kind property: the entity query template kind. + * + * @return the kind value. + */ + public EntityQueryTemplateKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Set the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @param systemData the systemData value to set. + * @return the EntityQueryTemplateInner object itself. + */ + EntityQueryTemplateInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityQueryTemplateInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityQueryTemplateInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityQueryTemplateInner. + */ + public static EntityQueryTemplateInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Activity".equals(discriminatorValue)) { + return ActivityEntityQueryTemplate.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EntityQueryTemplateInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityQueryTemplateInner deserializedEntityQueryTemplateInner = new EntityQueryTemplateInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEntityQueryTemplateInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEntityQueryTemplateInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEntityQueryTemplateInner.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedEntityQueryTemplateInner.kind = EntityQueryTemplateKind.fromString(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedEntityQueryTemplateInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityQueryTemplateInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityTimelineResponseInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityTimelineResponseInner.java new file mode 100644 index 000000000000..c006f0477155 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EntityTimelineResponseInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EntityTimelineItem; +import com.azure.resourcemanager.securityinsights.models.TimelineResultsMetadata; +import java.io.IOException; +import java.util.List; + +/** + * The entity timeline result operation response. + */ +@Fluent +public final class EntityTimelineResponseInner implements JsonSerializable { + /* + * The metadata from the timeline operation results. + */ + private TimelineResultsMetadata metadata; + + /* + * The timeline result values. + */ + private List value; + + /** + * Creates an instance of EntityTimelineResponseInner class. + */ + public EntityTimelineResponseInner() { + } + + /** + * Get the metadata property: The metadata from the timeline operation results. + * + * @return the metadata value. + */ + public TimelineResultsMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The metadata from the timeline operation results. + * + * @param metadata the metadata value to set. + * @return the EntityTimelineResponseInner object itself. + */ + public EntityTimelineResponseInner withMetadata(TimelineResultsMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the value property: The timeline result values. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The timeline result values. + * + * @param value the value value to set. + * @return the EntityTimelineResponseInner object itself. + */ + public EntityTimelineResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().validate(); + } + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("metaData", this.metadata); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityTimelineResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityTimelineResponseInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityTimelineResponseInner. + */ + public static EntityTimelineResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityTimelineResponseInner deserializedEntityTimelineResponseInner = new EntityTimelineResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metaData".equals(fieldName)) { + deserializedEntityTimelineResponseInner.metadata = TimelineResultsMetadata.fromJson(reader); + } else if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> EntityTimelineItem.fromJson(reader1)); + deserializedEntityTimelineResponseInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedEntityTimelineResponseInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ExpansionEntityQueriesProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ExpansionEntityQueriesProperties.java new file mode 100644 index 000000000000..20e4bf0a5f45 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ExpansionEntityQueriesProperties.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EntityType; +import java.io.IOException; +import java.util.List; + +/** + * Describes expansion entity query properties. + */ +@Fluent +public final class ExpansionEntityQueriesProperties implements JsonSerializable { + /* + * List of the data sources that are required to run the query + */ + private List dataSources; + + /* + * The query display name + */ + private String displayName; + + /* + * The type of the query's source entity + */ + private EntityType inputEntityType; + + /* + * List of the fields of the source entity that are required to run the query + */ + private List inputFields; + + /* + * List of the desired output types to be constructed from the result + */ + private List outputEntityTypes; + + /* + * The template query string to be parsed and formatted + */ + private String queryTemplate; + + /** + * Creates an instance of ExpansionEntityQueriesProperties class. + */ + public ExpansionEntityQueriesProperties() { + } + + /** + * Get the dataSources property: List of the data sources that are required to run the query. + * + * @return the dataSources value. + */ + public List dataSources() { + return this.dataSources; + } + + /** + * Set the dataSources property: List of the data sources that are required to run the query. + * + * @param dataSources the dataSources value to set. + * @return the ExpansionEntityQueriesProperties object itself. + */ + public ExpansionEntityQueriesProperties withDataSources(List dataSources) { + this.dataSources = dataSources; + return this; + } + + /** + * Get the displayName property: The query display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The query display name. + * + * @param displayName the displayName value to set. + * @return the ExpansionEntityQueriesProperties object itself. + */ + public ExpansionEntityQueriesProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the inputEntityType property: The type of the query's source entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.inputEntityType; + } + + /** + * Set the inputEntityType property: The type of the query's source entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the ExpansionEntityQueriesProperties object itself. + */ + public ExpansionEntityQueriesProperties withInputEntityType(EntityType inputEntityType) { + this.inputEntityType = inputEntityType; + return this; + } + + /** + * Get the inputFields property: List of the fields of the source entity that are required to run the query. + * + * @return the inputFields value. + */ + public List inputFields() { + return this.inputFields; + } + + /** + * Set the inputFields property: List of the fields of the source entity that are required to run the query. + * + * @param inputFields the inputFields value to set. + * @return the ExpansionEntityQueriesProperties object itself. + */ + public ExpansionEntityQueriesProperties withInputFields(List inputFields) { + this.inputFields = inputFields; + return this; + } + + /** + * Get the outputEntityTypes property: List of the desired output types to be constructed from the result. + * + * @return the outputEntityTypes value. + */ + public List outputEntityTypes() { + return this.outputEntityTypes; + } + + /** + * Set the outputEntityTypes property: List of the desired output types to be constructed from the result. + * + * @param outputEntityTypes the outputEntityTypes value to set. + * @return the ExpansionEntityQueriesProperties object itself. + */ + public ExpansionEntityQueriesProperties withOutputEntityTypes(List outputEntityTypes) { + this.outputEntityTypes = outputEntityTypes; + return this; + } + + /** + * Get the queryTemplate property: The template query string to be parsed and formatted. + * + * @return the queryTemplate value. + */ + public String queryTemplate() { + return this.queryTemplate; + } + + /** + * Set the queryTemplate property: The template query string to be parsed and formatted. + * + * @param queryTemplate the queryTemplate value to set. + * @return the ExpansionEntityQueriesProperties object itself. + */ + public ExpansionEntityQueriesProperties withQueryTemplate(String queryTemplate) { + this.queryTemplate = queryTemplate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dataSources", this.dataSources, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("inputEntityType", + this.inputEntityType == null ? null : this.inputEntityType.toString()); + jsonWriter.writeArrayField("inputFields", this.inputFields, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("outputEntityTypes", this.outputEntityTypes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("queryTemplate", this.queryTemplate); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExpansionEntityQueriesProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExpansionEntityQueriesProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExpansionEntityQueriesProperties. + */ + public static ExpansionEntityQueriesProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExpansionEntityQueriesProperties deserializedExpansionEntityQueriesProperties + = new ExpansionEntityQueriesProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataSources".equals(fieldName)) { + List dataSources = reader.readArray(reader1 -> reader1.getString()); + deserializedExpansionEntityQueriesProperties.dataSources = dataSources; + } else if ("displayName".equals(fieldName)) { + deserializedExpansionEntityQueriesProperties.displayName = reader.getString(); + } else if ("inputEntityType".equals(fieldName)) { + deserializedExpansionEntityQueriesProperties.inputEntityType + = EntityType.fromString(reader.getString()); + } else if ("inputFields".equals(fieldName)) { + List inputFields = reader.readArray(reader1 -> reader1.getString()); + deserializedExpansionEntityQueriesProperties.inputFields = inputFields; + } else if ("outputEntityTypes".equals(fieldName)) { + List outputEntityTypes + = reader.readArray(reader1 -> EntityType.fromString(reader1.getString())); + deserializedExpansionEntityQueriesProperties.outputEntityTypes = outputEntityTypes; + } else if ("queryTemplate".equals(fieldName)) { + deserializedExpansionEntityQueriesProperties.queryTemplate = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExpansionEntityQueriesProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EyesOnSettingsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EyesOnSettingsProperties.java new file mode 100644 index 000000000000..17de87877fba --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/EyesOnSettingsProperties.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * EyesOn property bag. + */ +@Immutable +public final class EyesOnSettingsProperties implements JsonSerializable { + /* + * Determines whether the setting is enable or disabled. + */ + private Boolean isEnabled; + + /** + * Creates an instance of EyesOnSettingsProperties class. + */ + public EyesOnSettingsProperties() { + } + + /** + * Get the isEnabled property: Determines whether the setting is enable or disabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EyesOnSettingsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EyesOnSettingsProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EyesOnSettingsProperties. + */ + public static EyesOnSettingsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EyesOnSettingsProperties deserializedEyesOnSettingsProperties = new EyesOnSettingsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedEyesOnSettingsProperties.isEnabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedEyesOnSettingsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FileImportInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FileImportInner.java new file mode 100644 index 000000000000..c5c4aa213973 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FileImportInner.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.FileImportContentType; +import com.azure.resourcemanager.securityinsights.models.FileImportState; +import com.azure.resourcemanager.securityinsights.models.FileMetadata; +import com.azure.resourcemanager.securityinsights.models.IngestionMode; +import com.azure.resourcemanager.securityinsights.models.ValidationError; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Represents a file import in Azure Security Insights. + */ +@Fluent +public final class FileImportInner extends ProxyResource { + /* + * File import properties + */ + private FileImportProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of FileImportInner class. + */ + public FileImportInner() { + } + + /** + * Get the innerProperties property: File import properties. + * + * @return the innerProperties value. + */ + private FileImportProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the ingestionMode property: Describes how to ingest the records in the file. + * + * @return the ingestionMode value. + */ + public IngestionMode ingestionMode() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionMode(); + } + + /** + * Set the ingestionMode property: Describes how to ingest the records in the file. + * + * @param ingestionMode the ingestionMode value to set. + * @return the FileImportInner object itself. + */ + public FileImportInner withIngestionMode(IngestionMode ingestionMode) { + if (this.innerProperties() == null) { + this.innerProperties = new FileImportProperties(); + } + this.innerProperties().withIngestionMode(ingestionMode); + return this; + } + + /** + * Get the contentType property: The content type of this file. + * + * @return the contentType value. + */ + public FileImportContentType contentType() { + return this.innerProperties() == null ? null : this.innerProperties().contentType(); + } + + /** + * Set the contentType property: The content type of this file. + * + * @param contentType the contentType value to set. + * @return the FileImportInner object itself. + */ + public FileImportInner withContentType(FileImportContentType contentType) { + if (this.innerProperties() == null) { + this.innerProperties = new FileImportProperties(); + } + this.innerProperties().withContentType(contentType); + return this; + } + + /** + * Get the createdTimeUtc property: The time the file was imported. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); + } + + /** + * Get the errorFile property: Represents the error file (if the import was ingested with errors or failed the + * validation). + * + * @return the errorFile value. + */ + public FileMetadata errorFile() { + return this.innerProperties() == null ? null : this.innerProperties().errorFile(); + } + + /** + * Get the errorsPreview property: An ordered list of some of the errors that were encountered during validation. + * + * @return the errorsPreview value. + */ + public List errorsPreview() { + return this.innerProperties() == null ? null : this.innerProperties().errorsPreview(); + } + + /** + * Get the importFile property: Represents the imported file. + * + * @return the importFile value. + */ + public FileMetadata importFile() { + return this.innerProperties() == null ? null : this.innerProperties().importFile(); + } + + /** + * Set the importFile property: Represents the imported file. + * + * @param importFile the importFile value to set. + * @return the FileImportInner object itself. + */ + public FileImportInner withImportFile(FileMetadata importFile) { + if (this.innerProperties() == null) { + this.innerProperties = new FileImportProperties(); + } + this.innerProperties().withImportFile(importFile); + return this; + } + + /** + * Get the ingestedRecordCount property: The number of records that have been successfully ingested. + * + * @return the ingestedRecordCount value. + */ + public Integer ingestedRecordCount() { + return this.innerProperties() == null ? null : this.innerProperties().ingestedRecordCount(); + } + + /** + * Get the source property: The source for the data in the file. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: The source for the data in the file. + * + * @param source the source value to set. + * @return the FileImportInner object itself. + */ + public FileImportInner withSource(String source) { + if (this.innerProperties() == null) { + this.innerProperties = new FileImportProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the state property: The state of the file import. + * + * @return the state value. + */ + public FileImportState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the totalRecordCount property: The number of records in the file. + * + * @return the totalRecordCount value. + */ + public Integer totalRecordCount() { + return this.innerProperties() == null ? null : this.innerProperties().totalRecordCount(); + } + + /** + * Get the validRecordCount property: The number of records that have passed validation. + * + * @return the validRecordCount value. + */ + public Integer validRecordCount() { + return this.innerProperties() == null ? null : this.innerProperties().validRecordCount(); + } + + /** + * Get the filesValidUntilTimeUtc property: The time the files associated with this import are deleted from the + * storage account. + * + * @return the filesValidUntilTimeUtc value. + */ + public OffsetDateTime filesValidUntilTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().filesValidUntilTimeUtc(); + } + + /** + * Get the importValidUntilTimeUtc property: The time the file import record is soft deleted from the database and + * history. + * + * @return the importValidUntilTimeUtc value. + */ + public OffsetDateTime importValidUntilTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().importValidUntilTimeUtc(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileImportInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileImportInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileImportInner. + */ + public static FileImportInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileImportInner deserializedFileImportInner = new FileImportInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFileImportInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFileImportInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFileImportInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFileImportInner.innerProperties = FileImportProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFileImportInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFileImportInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FileImportProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FileImportProperties.java new file mode 100644 index 000000000000..b35ed9853b55 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FileImportProperties.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.FileImportContentType; +import com.azure.resourcemanager.securityinsights.models.FileImportState; +import com.azure.resourcemanager.securityinsights.models.FileMetadata; +import com.azure.resourcemanager.securityinsights.models.IngestionMode; +import com.azure.resourcemanager.securityinsights.models.ValidationError; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Describes the FileImport's properties. + */ +@Fluent +public final class FileImportProperties implements JsonSerializable { + /* + * Describes how to ingest the records in the file. + */ + private IngestionMode ingestionMode; + + /* + * The content type of this file. + */ + private FileImportContentType contentType; + + /* + * The time the file was imported. + */ + private OffsetDateTime createdTimeUtc; + + /* + * Represents the error file (if the import was ingested with errors or failed the validation). + */ + private FileMetadata errorFile; + + /* + * An ordered list of some of the errors that were encountered during validation. + */ + private List errorsPreview; + + /* + * Represents the imported file. + */ + private FileMetadata importFile; + + /* + * The number of records that have been successfully ingested. + */ + private Integer ingestedRecordCount; + + /* + * The source for the data in the file. + */ + private String source; + + /* + * The state of the file import. + */ + private FileImportState state; + + /* + * The number of records in the file. + */ + private Integer totalRecordCount; + + /* + * The number of records that have passed validation. + */ + private Integer validRecordCount; + + /* + * The time the files associated with this import are deleted from the storage account. + */ + private OffsetDateTime filesValidUntilTimeUtc; + + /* + * The time the file import record is soft deleted from the database and history. + */ + private OffsetDateTime importValidUntilTimeUtc; + + /** + * Creates an instance of FileImportProperties class. + */ + public FileImportProperties() { + } + + /** + * Get the ingestionMode property: Describes how to ingest the records in the file. + * + * @return the ingestionMode value. + */ + public IngestionMode ingestionMode() { + return this.ingestionMode; + } + + /** + * Set the ingestionMode property: Describes how to ingest the records in the file. + * + * @param ingestionMode the ingestionMode value to set. + * @return the FileImportProperties object itself. + */ + public FileImportProperties withIngestionMode(IngestionMode ingestionMode) { + this.ingestionMode = ingestionMode; + return this; + } + + /** + * Get the contentType property: The content type of this file. + * + * @return the contentType value. + */ + public FileImportContentType contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content type of this file. + * + * @param contentType the contentType value to set. + * @return the FileImportProperties object itself. + */ + public FileImportProperties withContentType(FileImportContentType contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the createdTimeUtc property: The time the file was imported. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.createdTimeUtc; + } + + /** + * Get the errorFile property: Represents the error file (if the import was ingested with errors or failed the + * validation). + * + * @return the errorFile value. + */ + public FileMetadata errorFile() { + return this.errorFile; + } + + /** + * Get the errorsPreview property: An ordered list of some of the errors that were encountered during validation. + * + * @return the errorsPreview value. + */ + public List errorsPreview() { + return this.errorsPreview; + } + + /** + * Get the importFile property: Represents the imported file. + * + * @return the importFile value. + */ + public FileMetadata importFile() { + return this.importFile; + } + + /** + * Set the importFile property: Represents the imported file. + * + * @param importFile the importFile value to set. + * @return the FileImportProperties object itself. + */ + public FileImportProperties withImportFile(FileMetadata importFile) { + this.importFile = importFile; + return this; + } + + /** + * Get the ingestedRecordCount property: The number of records that have been successfully ingested. + * + * @return the ingestedRecordCount value. + */ + public Integer ingestedRecordCount() { + return this.ingestedRecordCount; + } + + /** + * Get the source property: The source for the data in the file. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: The source for the data in the file. + * + * @param source the source value to set. + * @return the FileImportProperties object itself. + */ + public FileImportProperties withSource(String source) { + this.source = source; + return this; + } + + /** + * Get the state property: The state of the file import. + * + * @return the state value. + */ + public FileImportState state() { + return this.state; + } + + /** + * Get the totalRecordCount property: The number of records in the file. + * + * @return the totalRecordCount value. + */ + public Integer totalRecordCount() { + return this.totalRecordCount; + } + + /** + * Get the validRecordCount property: The number of records that have passed validation. + * + * @return the validRecordCount value. + */ + public Integer validRecordCount() { + return this.validRecordCount; + } + + /** + * Get the filesValidUntilTimeUtc property: The time the files associated with this import are deleted from the + * storage account. + * + * @return the filesValidUntilTimeUtc value. + */ + public OffsetDateTime filesValidUntilTimeUtc() { + return this.filesValidUntilTimeUtc; + } + + /** + * Get the importValidUntilTimeUtc property: The time the file import record is soft deleted from the database and + * history. + * + * @return the importValidUntilTimeUtc value. + */ + public OffsetDateTime importValidUntilTimeUtc() { + return this.importValidUntilTimeUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ingestionMode() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property ingestionMode in model FileImportProperties")); + } + if (contentType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property contentType in model FileImportProperties")); + } + if (errorFile() != null) { + errorFile().validate(); + } + if (errorsPreview() != null) { + errorsPreview().forEach(e -> e.validate()); + } + if (importFile() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property importFile in model FileImportProperties")); + } else { + importFile().validate(); + } + if (source() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property source in model FileImportProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FileImportProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ingestionMode", this.ingestionMode == null ? null : this.ingestionMode.toString()); + jsonWriter.writeStringField("contentType", this.contentType == null ? null : this.contentType.toString()); + jsonWriter.writeJsonField("importFile", this.importFile); + jsonWriter.writeStringField("source", this.source); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileImportProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileImportProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileImportProperties. + */ + public static FileImportProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileImportProperties deserializedFileImportProperties = new FileImportProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ingestionMode".equals(fieldName)) { + deserializedFileImportProperties.ingestionMode = IngestionMode.fromString(reader.getString()); + } else if ("contentType".equals(fieldName)) { + deserializedFileImportProperties.contentType = FileImportContentType.fromString(reader.getString()); + } else if ("importFile".equals(fieldName)) { + deserializedFileImportProperties.importFile = FileMetadata.fromJson(reader); + } else if ("source".equals(fieldName)) { + deserializedFileImportProperties.source = reader.getString(); + } else if ("createdTimeUTC".equals(fieldName)) { + deserializedFileImportProperties.createdTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("errorFile".equals(fieldName)) { + deserializedFileImportProperties.errorFile = FileMetadata.fromJson(reader); + } else if ("errorsPreview".equals(fieldName)) { + List errorsPreview + = reader.readArray(reader1 -> ValidationError.fromJson(reader1)); + deserializedFileImportProperties.errorsPreview = errorsPreview; + } else if ("ingestedRecordCount".equals(fieldName)) { + deserializedFileImportProperties.ingestedRecordCount = reader.getNullable(JsonReader::getInt); + } else if ("state".equals(fieldName)) { + deserializedFileImportProperties.state = FileImportState.fromString(reader.getString()); + } else if ("totalRecordCount".equals(fieldName)) { + deserializedFileImportProperties.totalRecordCount = reader.getNullable(JsonReader::getInt); + } else if ("validRecordCount".equals(fieldName)) { + deserializedFileImportProperties.validRecordCount = reader.getNullable(JsonReader::getInt); + } else if ("filesValidUntilTimeUTC".equals(fieldName)) { + deserializedFileImportProperties.filesValidUntilTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("importValidUntilTimeUTC".equals(fieldName)) { + deserializedFileImportProperties.importValidUntilTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedFileImportProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleProperties.java index 8ffd126ba8c8..5eac6f3ffe4e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleProperties.java @@ -13,6 +13,8 @@ import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.models.AlertSeverity; import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.FusionScenarioExclusionPattern; +import com.azure.resourcemanager.securityinsights.models.FusionSourceSettings; import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -42,6 +44,16 @@ public final class FusionAlertRuleProperties implements JsonSerializable sourceSettings; + + /* + * Configuration to exclude scenarios in fusion detection. + */ + private List scenarioExclusionPatterns; + /* * The last time that this alert has been modified. */ @@ -62,6 +74,11 @@ public final class FusionAlertRuleProperties implements JsonSerializable techniques; + /* + * The sub-techniques of the alert rule + */ + private List subTechniques; + /** * Creates an instance of FusionAlertRuleProperties class. */ @@ -126,6 +143,47 @@ public FusionAlertRuleProperties withEnabled(boolean enabled) { return this; } + /** + * Get the sourceSettings property: Configuration for all supported source signals in fusion detection. + * + * @return the sourceSettings value. + */ + public List sourceSettings() { + return this.sourceSettings; + } + + /** + * Set the sourceSettings property: Configuration for all supported source signals in fusion detection. + * + * @param sourceSettings the sourceSettings value to set. + * @return the FusionAlertRuleProperties object itself. + */ + public FusionAlertRuleProperties withSourceSettings(List sourceSettings) { + this.sourceSettings = sourceSettings; + return this; + } + + /** + * Get the scenarioExclusionPatterns property: Configuration to exclude scenarios in fusion detection. + * + * @return the scenarioExclusionPatterns value. + */ + public List scenarioExclusionPatterns() { + return this.scenarioExclusionPatterns; + } + + /** + * Set the scenarioExclusionPatterns property: Configuration to exclude scenarios in fusion detection. + * + * @param scenarioExclusionPatterns the scenarioExclusionPatterns value to set. + * @return the FusionAlertRuleProperties object itself. + */ + public FusionAlertRuleProperties + withScenarioExclusionPatterns(List scenarioExclusionPatterns) { + this.scenarioExclusionPatterns = scenarioExclusionPatterns; + return this; + } + /** * Get the lastModifiedUtc property: The last time that this alert has been modified. * @@ -162,6 +220,15 @@ public List techniques() { return this.techniques; } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.subTechniques; + } + /** * Validates the instance. * @@ -173,6 +240,12 @@ public void validate() { .log(new IllegalArgumentException( "Missing required property alertRuleTemplateName in model FusionAlertRuleProperties")); } + if (sourceSettings() != null) { + sourceSettings().forEach(e -> e.validate()); + } + if (scenarioExclusionPatterns() != null) { + scenarioExclusionPatterns().forEach(e -> e.validate()); + } } private static final ClientLogger LOGGER = new ClientLogger(FusionAlertRuleProperties.class); @@ -185,6 +258,10 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("alertRuleTemplateName", this.alertRuleTemplateName); jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeArrayField("sourceSettings", this.sourceSettings, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("scenarioExclusionPatterns", this.scenarioExclusionPatterns, + (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -212,6 +289,14 @@ public static FusionAlertRuleProperties fromJson(JsonReader jsonReader) throws I deserializedFusionAlertRuleProperties.description = reader.getString(); } else if ("displayName".equals(fieldName)) { deserializedFusionAlertRuleProperties.displayName = reader.getString(); + } else if ("sourceSettings".equals(fieldName)) { + List sourceSettings + = reader.readArray(reader1 -> FusionSourceSettings.fromJson(reader1)); + deserializedFusionAlertRuleProperties.sourceSettings = sourceSettings; + } else if ("scenarioExclusionPatterns".equals(fieldName)) { + List scenarioExclusionPatterns + = reader.readArray(reader1 -> FusionScenarioExclusionPattern.fromJson(reader1)); + deserializedFusionAlertRuleProperties.scenarioExclusionPatterns = scenarioExclusionPatterns; } else if ("lastModifiedUtc".equals(fieldName)) { deserializedFusionAlertRuleProperties.lastModifiedUtc = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); @@ -224,6 +309,9 @@ public static FusionAlertRuleProperties fromJson(JsonReader jsonReader) throws I } else if ("techniques".equals(fieldName)) { List techniques = reader.readArray(reader1 -> reader1.getString()); deserializedFusionAlertRuleProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedFusionAlertRuleProperties.subTechniques = subTechniques; } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleTemplateProperties.java index eb4f04d27f2b..3e22b4ce99a4 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleTemplateProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/FusionAlertRuleTemplateProperties.java @@ -13,13 +13,14 @@ import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; import com.azure.resourcemanager.securityinsights.models.AlertSeverity; import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.FusionTemplateSourceSetting; import com.azure.resourcemanager.securityinsights.models.TemplateStatus; import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; /** - * Represents Fusion alert rule template properties. + * Fusion alert rule template properties. */ @Fluent public final class FusionAlertRuleTemplateProperties implements JsonSerializable { @@ -69,10 +70,20 @@ public final class FusionAlertRuleTemplateProperties implements JsonSerializable private List tactics; /* - * The techniques of the alert rule template + * The techniques of the alert rule */ private List techniques; + /* + * The sub-techniques of the alert rule + */ + private List subTechniques; + + /* + * All supported source signal configurations consumed in fusion detection. + */ + private List sourceSettings; + /** * Creates an instance of FusionAlertRuleTemplateProperties class. */ @@ -240,7 +251,7 @@ public FusionAlertRuleTemplateProperties withTactics(List tactics) } /** - * Get the techniques property: The techniques of the alert rule template. + * Get the techniques property: The techniques of the alert rule. * * @return the techniques value. */ @@ -249,7 +260,7 @@ public List techniques() { } /** - * Set the techniques property: The techniques of the alert rule template. + * Set the techniques property: The techniques of the alert rule. * * @param techniques the techniques value to set. * @return the FusionAlertRuleTemplateProperties object itself. @@ -259,6 +270,46 @@ public FusionAlertRuleTemplateProperties withTechniques(List techniques) return this; } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.subTechniques; + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the FusionAlertRuleTemplateProperties object itself. + */ + public FusionAlertRuleTemplateProperties withSubTechniques(List subTechniques) { + this.subTechniques = subTechniques; + return this; + } + + /** + * Get the sourceSettings property: All supported source signal configurations consumed in fusion detection. + * + * @return the sourceSettings value. + */ + public List sourceSettings() { + return this.sourceSettings; + } + + /** + * Set the sourceSettings property: All supported source signal configurations consumed in fusion detection. + * + * @param sourceSettings the sourceSettings value to set. + * @return the FusionAlertRuleTemplateProperties object itself. + */ + public FusionAlertRuleTemplateProperties withSourceSettings(List sourceSettings) { + this.sourceSettings = sourceSettings; + return this; + } + /** * Validates the instance. * @@ -268,6 +319,9 @@ public void validate() { if (requiredDataConnectors() != null) { requiredDataConnectors().forEach(e -> e.validate()); } + if (sourceSettings() != null) { + sourceSettings().forEach(e -> e.validate()); + } } /** @@ -286,6 +340,10 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeArrayField("tactics", this.tactics, (writer, element) -> writer.writeString(element == null ? null : element.toString())); jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("subTechniques", this.subTechniques, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("sourceSettings", this.sourceSettings, + (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -335,6 +393,13 @@ public static FusionAlertRuleTemplateProperties fromJson(JsonReader jsonReader) } else if ("techniques".equals(fieldName)) { List techniques = reader.readArray(reader1 -> reader1.getString()); deserializedFusionAlertRuleTemplateProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedFusionAlertRuleTemplateProperties.subTechniques = subTechniques; + } else if ("sourceSettings".equals(fieldName)) { + List sourceSettings + = reader.readArray(reader1 -> FusionTemplateSourceSetting.fromJson(reader1)); + deserializedFusionAlertRuleTemplateProperties.sourceSettings = sourceSettings; } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/GcpDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/GcpDataConnectorProperties.java new file mode 100644 index 000000000000..34a2c6e7ba8c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/GcpDataConnectorProperties.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DcrConfiguration; +import com.azure.resourcemanager.securityinsights.models.GcpAuthProperties; +import com.azure.resourcemanager.securityinsights.models.GcpRequestProperties; +import java.io.IOException; + +/** + * Google Cloud Platform data connector properties. + */ +@Fluent +public final class GcpDataConnectorProperties implements JsonSerializable { + /* + * The name of the connector definition that represents the UI config. + */ + private String connectorDefinitionName; + + /* + * The auth section of the connector. + */ + private GcpAuthProperties auth; + + /* + * The request section of the connector. + */ + private GcpRequestProperties request; + + /* + * The configuration of the destination of the data. + */ + private DcrConfiguration dcrConfig; + + /** + * Creates an instance of GcpDataConnectorProperties class. + */ + public GcpDataConnectorProperties() { + } + + /** + * Get the connectorDefinitionName property: The name of the connector definition that represents the UI config. + * + * @return the connectorDefinitionName value. + */ + public String connectorDefinitionName() { + return this.connectorDefinitionName; + } + + /** + * Set the connectorDefinitionName property: The name of the connector definition that represents the UI config. + * + * @param connectorDefinitionName the connectorDefinitionName value to set. + * @return the GcpDataConnectorProperties object itself. + */ + public GcpDataConnectorProperties withConnectorDefinitionName(String connectorDefinitionName) { + this.connectorDefinitionName = connectorDefinitionName; + return this; + } + + /** + * Get the auth property: The auth section of the connector. + * + * @return the auth value. + */ + public GcpAuthProperties auth() { + return this.auth; + } + + /** + * Set the auth property: The auth section of the connector. + * + * @param auth the auth value to set. + * @return the GcpDataConnectorProperties object itself. + */ + public GcpDataConnectorProperties withAuth(GcpAuthProperties auth) { + this.auth = auth; + return this; + } + + /** + * Get the request property: The request section of the connector. + * + * @return the request value. + */ + public GcpRequestProperties request() { + return this.request; + } + + /** + * Set the request property: The request section of the connector. + * + * @param request the request value to set. + * @return the GcpDataConnectorProperties object itself. + */ + public GcpDataConnectorProperties withRequest(GcpRequestProperties request) { + this.request = request; + return this; + } + + /** + * Get the dcrConfig property: The configuration of the destination of the data. + * + * @return the dcrConfig value. + */ + public DcrConfiguration dcrConfig() { + return this.dcrConfig; + } + + /** + * Set the dcrConfig property: The configuration of the destination of the data. + * + * @param dcrConfig the dcrConfig value to set. + * @return the GcpDataConnectorProperties object itself. + */ + public GcpDataConnectorProperties withDcrConfig(DcrConfiguration dcrConfig) { + this.dcrConfig = dcrConfig; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectorDefinitionName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectorDefinitionName in model GcpDataConnectorProperties")); + } + if (auth() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property auth in model GcpDataConnectorProperties")); + } else { + auth().validate(); + } + if (request() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property request in model GcpDataConnectorProperties")); + } else { + request().validate(); + } + if (dcrConfig() != null) { + dcrConfig().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GcpDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectorDefinitionName", this.connectorDefinitionName); + jsonWriter.writeJsonField("auth", this.auth); + jsonWriter.writeJsonField("request", this.request); + jsonWriter.writeJsonField("dcrConfig", this.dcrConfig); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpDataConnectorProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GcpDataConnectorProperties. + */ + public static GcpDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpDataConnectorProperties deserializedGcpDataConnectorProperties = new GcpDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectorDefinitionName".equals(fieldName)) { + deserializedGcpDataConnectorProperties.connectorDefinitionName = reader.getString(); + } else if ("auth".equals(fieldName)) { + deserializedGcpDataConnectorProperties.auth = GcpAuthProperties.fromJson(reader); + } else if ("request".equals(fieldName)) { + deserializedGcpDataConnectorProperties.request = GcpRequestProperties.fromJson(reader); + } else if ("dcrConfig".equals(fieldName)) { + deserializedGcpDataConnectorProperties.dcrConfig = DcrConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntCommentInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntCommentInner.java new file mode 100644 index 000000000000..0c172168f7cd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntCommentInner.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; + +/** + * Represents a Hunt Comment in Azure Security Insights. + */ +@Fluent +public final class HuntCommentInner extends ResourceWithEtag { + /* + * Hunt Comment properties + */ + private HuntCommentProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of HuntCommentInner class. + */ + public HuntCommentInner() { + } + + /** + * Get the innerProperties property: Hunt Comment properties. + * + * @return the innerProperties value. + */ + private HuntCommentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public HuntCommentInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the message property: The message for the comment. + * + * @return the message value. + */ + public String message() { + return this.innerProperties() == null ? null : this.innerProperties().message(); + } + + /** + * Set the message property: The message for the comment. + * + * @param message the message value to set. + * @return the HuntCommentInner object itself. + */ + public HuntCommentInner withMessage(String message) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntCommentProperties(); + } + this.innerProperties().withMessage(message); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntCommentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntCommentInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntCommentInner. + */ + public static HuntCommentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntCommentInner deserializedHuntCommentInner = new HuntCommentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedHuntCommentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedHuntCommentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedHuntCommentInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedHuntCommentInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedHuntCommentInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedHuntCommentInner.innerProperties = HuntCommentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntCommentInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntCommentProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntCommentProperties.java new file mode 100644 index 000000000000..f7a2358f4272 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntCommentProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes a hunt comment properties. + */ +@Fluent +public final class HuntCommentProperties implements JsonSerializable { + /* + * The message for the comment + */ + private String message; + + /** + * Creates an instance of HuntCommentProperties class. + */ + public HuntCommentProperties() { + } + + /** + * Get the message property: The message for the comment. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message for the comment. + * + * @param message the message value to set. + * @return the HuntCommentProperties object itself. + */ + public HuntCommentProperties withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (message() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property message in model HuntCommentProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HuntCommentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntCommentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntCommentProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntCommentProperties. + */ + public static HuntCommentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntCommentProperties deserializedHuntCommentProperties = new HuntCommentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedHuntCommentProperties.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntCommentProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntInner.java new file mode 100644 index 000000000000..006cc6124e2e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntInner.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.HuntOwner; +import com.azure.resourcemanager.securityinsights.models.HypothesisStatus; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import com.azure.resourcemanager.securityinsights.models.Status; +import java.io.IOException; +import java.util.List; + +/** + * Represents a Hunt in Azure Security Insights. + */ +@Fluent +public final class HuntInner extends ResourceWithEtag { + /* + * Hunt properties + */ + private HuntProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of HuntInner class. + */ + public HuntInner() { + } + + /** + * Get the innerProperties property: Hunt properties. + * + * @return the innerProperties value. + */ + private HuntProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public HuntInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the displayName property: The display name of the hunt. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the hunt. + * + * @param displayName the displayName value to set. + * @return the HuntInner object itself. + */ + public HuntInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: The description of the hunt. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the hunt. + * + * @param description the description value to set. + * @return the HuntInner object itself. + */ + public HuntInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the status property: The status of the hunt. + * + * @return the status value. + */ + public Status status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The status of the hunt. + * + * @param status the status value to set. + * @return the HuntInner object itself. + */ + public HuntInner withStatus(Status status) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the hypothesisStatus property: The hypothesis status of the hunt. + * + * @return the hypothesisStatus value. + */ + public HypothesisStatus hypothesisStatus() { + return this.innerProperties() == null ? null : this.innerProperties().hypothesisStatus(); + } + + /** + * Set the hypothesisStatus property: The hypothesis status of the hunt. + * + * @param hypothesisStatus the hypothesisStatus value to set. + * @return the HuntInner object itself. + */ + public HuntInner withHypothesisStatus(HypothesisStatus hypothesisStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withHypothesisStatus(hypothesisStatus); + return this; + } + + /** + * Get the attackTactics property: A list of mitre attack tactics the hunt is associated with. + * + * @return the attackTactics value. + */ + public List attackTactics() { + return this.innerProperties() == null ? null : this.innerProperties().attackTactics(); + } + + /** + * Set the attackTactics property: A list of mitre attack tactics the hunt is associated with. + * + * @param attackTactics the attackTactics value to set. + * @return the HuntInner object itself. + */ + public HuntInner withAttackTactics(List attackTactics) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withAttackTactics(attackTactics); + return this; + } + + /** + * Get the attackTechniques property: A list of a mitre attack techniques the hunt is associated with. + * + * @return the attackTechniques value. + */ + public List attackTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().attackTechniques(); + } + + /** + * Set the attackTechniques property: A list of a mitre attack techniques the hunt is associated with. + * + * @param attackTechniques the attackTechniques value to set. + * @return the HuntInner object itself. + */ + public HuntInner withAttackTechniques(List attackTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withAttackTechniques(attackTechniques); + return this; + } + + /** + * Get the labels property: List of labels relevant to this hunt. + * + * @return the labels value. + */ + public List labels() { + return this.innerProperties() == null ? null : this.innerProperties().labels(); + } + + /** + * Set the labels property: List of labels relevant to this hunt. + * + * @param labels the labels value to set. + * @return the HuntInner object itself. + */ + public HuntInner withLabels(List labels) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withLabels(labels); + return this; + } + + /** + * Get the owner property: Describes a user that the hunt is assigned to. + * + * @return the owner value. + */ + public HuntOwner owner() { + return this.innerProperties() == null ? null : this.innerProperties().owner(); + } + + /** + * Set the owner property: Describes a user that the hunt is assigned to. + * + * @param owner the owner value to set. + * @return the HuntInner object itself. + */ + public HuntInner withOwner(HuntOwner owner) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntProperties(); + } + this.innerProperties().withOwner(owner); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntInner. + */ + public static HuntInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntInner deserializedHuntInner = new HuntInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedHuntInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedHuntInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedHuntInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedHuntInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedHuntInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedHuntInner.innerProperties = HuntProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntProperties.java new file mode 100644 index 000000000000..fe75fa98e7ae --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntProperties.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.HuntOwner; +import com.azure.resourcemanager.securityinsights.models.HypothesisStatus; +import com.azure.resourcemanager.securityinsights.models.Status; +import java.io.IOException; +import java.util.List; + +/** + * Describes hunt properties. + */ +@Fluent +public final class HuntProperties implements JsonSerializable { + /* + * The display name of the hunt + */ + private String displayName; + + /* + * The description of the hunt + */ + private String description; + + /* + * The status of the hunt. + */ + private Status status; + + /* + * The hypothesis status of the hunt. + */ + private HypothesisStatus hypothesisStatus; + + /* + * A list of mitre attack tactics the hunt is associated with + */ + private List attackTactics; + + /* + * A list of a mitre attack techniques the hunt is associated with + */ + private List attackTechniques; + + /* + * List of labels relevant to this hunt + */ + private List labels; + + /* + * Describes a user that the hunt is assigned to + */ + private HuntOwner owner; + + /** + * Creates an instance of HuntProperties class. + */ + public HuntProperties() { + } + + /** + * Get the displayName property: The display name of the hunt. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the hunt. + * + * @param displayName the displayName value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The description of the hunt. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the hunt. + * + * @param description the description value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: The status of the hunt. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: The status of the hunt. + * + * @param status the status value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Get the hypothesisStatus property: The hypothesis status of the hunt. + * + * @return the hypothesisStatus value. + */ + public HypothesisStatus hypothesisStatus() { + return this.hypothesisStatus; + } + + /** + * Set the hypothesisStatus property: The hypothesis status of the hunt. + * + * @param hypothesisStatus the hypothesisStatus value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withHypothesisStatus(HypothesisStatus hypothesisStatus) { + this.hypothesisStatus = hypothesisStatus; + return this; + } + + /** + * Get the attackTactics property: A list of mitre attack tactics the hunt is associated with. + * + * @return the attackTactics value. + */ + public List attackTactics() { + return this.attackTactics; + } + + /** + * Set the attackTactics property: A list of mitre attack tactics the hunt is associated with. + * + * @param attackTactics the attackTactics value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withAttackTactics(List attackTactics) { + this.attackTactics = attackTactics; + return this; + } + + /** + * Get the attackTechniques property: A list of a mitre attack techniques the hunt is associated with. + * + * @return the attackTechniques value. + */ + public List attackTechniques() { + return this.attackTechniques; + } + + /** + * Set the attackTechniques property: A list of a mitre attack techniques the hunt is associated with. + * + * @param attackTechniques the attackTechniques value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withAttackTechniques(List attackTechniques) { + this.attackTechniques = attackTechniques; + return this; + } + + /** + * Get the labels property: List of labels relevant to this hunt. + * + * @return the labels value. + */ + public List labels() { + return this.labels; + } + + /** + * Set the labels property: List of labels relevant to this hunt. + * + * @param labels the labels value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withLabels(List labels) { + this.labels = labels; + return this; + } + + /** + * Get the owner property: Describes a user that the hunt is assigned to. + * + * @return the owner value. + */ + public HuntOwner owner() { + return this.owner; + } + + /** + * Set the owner property: Describes a user that the hunt is assigned to. + * + * @param owner the owner value to set. + * @return the HuntProperties object itself. + */ + public HuntProperties withOwner(HuntOwner owner) { + this.owner = owner; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property displayName in model HuntProperties")); + } + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property description in model HuntProperties")); + } + if (owner() != null) { + owner().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HuntProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("hypothesisStatus", + this.hypothesisStatus == null ? null : this.hypothesisStatus.toString()); + jsonWriter.writeArrayField("attackTactics", this.attackTactics, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("attackTechniques", this.attackTechniques, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("owner", this.owner); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntProperties. + */ + public static HuntProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntProperties deserializedHuntProperties = new HuntProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedHuntProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedHuntProperties.description = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedHuntProperties.status = Status.fromString(reader.getString()); + } else if ("hypothesisStatus".equals(fieldName)) { + deserializedHuntProperties.hypothesisStatus = HypothesisStatus.fromString(reader.getString()); + } else if ("attackTactics".equals(fieldName)) { + List attackTactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedHuntProperties.attackTactics = attackTactics; + } else if ("attackTechniques".equals(fieldName)) { + List attackTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedHuntProperties.attackTechniques = attackTechniques; + } else if ("labels".equals(fieldName)) { + List labels = reader.readArray(reader1 -> reader1.getString()); + deserializedHuntProperties.labels = labels; + } else if ("owner".equals(fieldName)) { + deserializedHuntProperties.owner = HuntOwner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntRelationInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntRelationInner.java new file mode 100644 index 000000000000..087711ca144e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntRelationInner.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.util.List; + +/** + * Represents a Hunt Relation in Azure Security Insights. + */ +@Fluent +public final class HuntRelationInner extends ResourceWithEtag { + /* + * Hunt Relation properties + */ + private HuntRelationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of HuntRelationInner class. + */ + public HuntRelationInner() { + } + + /** + * Get the innerProperties property: Hunt Relation properties. + * + * @return the innerProperties value. + */ + private HuntRelationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public HuntRelationInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the relatedResourceId property: The id of the related resource. + * + * @return the relatedResourceId value. + */ + public String relatedResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().relatedResourceId(); + } + + /** + * Set the relatedResourceId property: The id of the related resource. + * + * @param relatedResourceId the relatedResourceId value to set. + * @return the HuntRelationInner object itself. + */ + public HuntRelationInner withRelatedResourceId(String relatedResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntRelationProperties(); + } + this.innerProperties().withRelatedResourceId(relatedResourceId); + return this; + } + + /** + * Get the relatedResourceName property: The name of the related resource. + * + * @return the relatedResourceName value. + */ + public String relatedResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().relatedResourceName(); + } + + /** + * Get the relationType property: The type of the hunt relation. + * + * @return the relationType value. + */ + public String relationType() { + return this.innerProperties() == null ? null : this.innerProperties().relationType(); + } + + /** + * Get the relatedResourceKind property: The resource that the relation is related to. + * + * @return the relatedResourceKind value. + */ + public String relatedResourceKind() { + return this.innerProperties() == null ? null : this.innerProperties().relatedResourceKind(); + } + + /** + * Get the labels property: List of labels relevant to this hunt. + * + * @return the labels value. + */ + public List labels() { + return this.innerProperties() == null ? null : this.innerProperties().labels(); + } + + /** + * Set the labels property: List of labels relevant to this hunt. + * + * @param labels the labels value to set. + * @return the HuntRelationInner object itself. + */ + public HuntRelationInner withLabels(List labels) { + if (this.innerProperties() == null) { + this.innerProperties = new HuntRelationProperties(); + } + this.innerProperties().withLabels(labels); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntRelationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntRelationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntRelationInner. + */ + public static HuntRelationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntRelationInner deserializedHuntRelationInner = new HuntRelationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedHuntRelationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedHuntRelationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedHuntRelationInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedHuntRelationInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedHuntRelationInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedHuntRelationInner.innerProperties = HuntRelationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntRelationInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntRelationProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntRelationProperties.java new file mode 100644 index 000000000000..6d08d18e308c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/HuntRelationProperties.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes hunt relation properties. + */ +@Fluent +public final class HuntRelationProperties implements JsonSerializable { + /* + * The id of the related resource + */ + private String relatedResourceId; + + /* + * The name of the related resource + */ + private String relatedResourceName; + + /* + * The type of the hunt relation + */ + private String relationType; + + /* + * The resource that the relation is related to + */ + private String relatedResourceKind; + + /* + * List of labels relevant to this hunt + */ + private List labels; + + /** + * Creates an instance of HuntRelationProperties class. + */ + public HuntRelationProperties() { + } + + /** + * Get the relatedResourceId property: The id of the related resource. + * + * @return the relatedResourceId value. + */ + public String relatedResourceId() { + return this.relatedResourceId; + } + + /** + * Set the relatedResourceId property: The id of the related resource. + * + * @param relatedResourceId the relatedResourceId value to set. + * @return the HuntRelationProperties object itself. + */ + public HuntRelationProperties withRelatedResourceId(String relatedResourceId) { + this.relatedResourceId = relatedResourceId; + return this; + } + + /** + * Get the relatedResourceName property: The name of the related resource. + * + * @return the relatedResourceName value. + */ + public String relatedResourceName() { + return this.relatedResourceName; + } + + /** + * Get the relationType property: The type of the hunt relation. + * + * @return the relationType value. + */ + public String relationType() { + return this.relationType; + } + + /** + * Get the relatedResourceKind property: The resource that the relation is related to. + * + * @return the relatedResourceKind value. + */ + public String relatedResourceKind() { + return this.relatedResourceKind; + } + + /** + * Get the labels property: List of labels relevant to this hunt. + * + * @return the labels value. + */ + public List labels() { + return this.labels; + } + + /** + * Set the labels property: List of labels relevant to this hunt. + * + * @param labels the labels value to set. + * @return the HuntRelationProperties object itself. + */ + public HuntRelationProperties withLabels(List labels) { + this.labels = labels; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (relatedResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property relatedResourceId in model HuntRelationProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HuntRelationProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("relatedResourceId", this.relatedResourceId); + jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntRelationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntRelationProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntRelationProperties. + */ + public static HuntRelationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntRelationProperties deserializedHuntRelationProperties = new HuntRelationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("relatedResourceId".equals(fieldName)) { + deserializedHuntRelationProperties.relatedResourceId = reader.getString(); + } else if ("relatedResourceName".equals(fieldName)) { + deserializedHuntRelationProperties.relatedResourceName = reader.getString(); + } else if ("relationType".equals(fieldName)) { + deserializedHuntRelationProperties.relationType = reader.getString(); + } else if ("relatedResourceKind".equals(fieldName)) { + deserializedHuntRelationProperties.relatedResourceKind = reader.getString(); + } else if ("labels".equals(fieldName)) { + List labels = reader.readArray(reader1 -> reader1.getString()); + deserializedHuntRelationProperties.labels = labels; + } else { + reader.skipChildren(); + } + } + + return deserializedHuntRelationProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentInner.java index 173e56cbf8da..5830a68dc3c6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentInner.java @@ -108,24 +108,6 @@ public IncidentCommentInner withEtag(String etag) { return this; } - /** - * Get the createdTimeUtc property: The time the comment was created. - * - * @return the createdTimeUtc value. - */ - public OffsetDateTime createdTimeUtc() { - return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); - } - - /** - * Get the lastModifiedTimeUtc property: The time the comment was updated. - * - * @return the lastModifiedTimeUtc value. - */ - public OffsetDateTime lastModifiedTimeUtc() { - return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); - } - /** * Get the message property: The comment message. * @@ -149,6 +131,24 @@ public IncidentCommentInner withMessage(String message) { return this; } + /** + * Get the createdTimeUtc property: The time the comment was created. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); + } + + /** + * Get the lastModifiedTimeUtc property: The time the comment was updated. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); + } + /** * Get the author property: Describes the client that created the comment. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentProperties.java index b9da1b6b8e22..858bdfeede30 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentCommentProperties.java @@ -20,6 +20,11 @@ */ @Fluent public final class IncidentCommentProperties implements JsonSerializable { + /* + * The comment message + */ + private String message; + /* * The time the comment was created */ @@ -30,11 +35,6 @@ public final class IncidentCommentProperties implements JsonSerializable entities; + private List entities; /* * The metadata from the incident related entities results. @@ -40,7 +39,7 @@ public IncidentEntitiesResponseInner() { * * @return the entities value. */ - public List entities() { + public List entities() { return this.entities; } @@ -50,7 +49,7 @@ public List entities() { * @param entities the entities value to set. * @return the IncidentEntitiesResponseInner object itself. */ - public IncidentEntitiesResponseInner withEntities(List entities) { + public IncidentEntitiesResponseInner withEntities(List entities) { this.entities = entities; return this; } @@ -117,7 +116,7 @@ public static IncidentEntitiesResponseInner fromJson(JsonReader jsonReader) thro reader.nextToken(); if ("entities".equals(fieldName)) { - List entities = reader.readArray(reader1 -> Entity.fromJson(reader1)); + List entities = reader.readArray(reader1 -> EntityInner.fromJson(reader1)); deserializedIncidentEntitiesResponseInner.entities = entities; } else if ("metaData".equals(fieldName)) { List metadata diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentInner.java index 5f7ee3ad33d4..c0d78cd3ee93 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentInner.java @@ -17,17 +17,18 @@ import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; import com.azure.resourcemanager.securityinsights.models.IncidentStatus; import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import com.azure.resourcemanager.securityinsights.models.TeamInformation; import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; /** - * Represents an incident in Azure Security Insights. + * The Incident model. */ @Fluent public final class IncidentInner extends ResourceWithEtag { /* - * Incident properties + * The properties property. */ private IncidentProperties innerProperties; @@ -58,7 +59,7 @@ public IncidentInner() { } /** - * Get the innerProperties property: Incident properties. + * Get the innerProperties property: The properties property. * * @return the innerProperties value. */ @@ -116,154 +117,187 @@ public IncidentInner withEtag(String etag) { } /** - * Get the additionalData property: Additional data on the incident. + * Get the title property: The title of the incident. * - * @return the additionalData value. + * @return the title value. */ - public IncidentAdditionalData additionalData() { - return this.innerProperties() == null ? null : this.innerProperties().additionalData(); + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); } /** - * Get the classification property: The reason the incident was closed. + * Set the title property: The title of the incident. * - * @return the classification value. + * @param title the title value to set. + * @return the IncidentInner object itself. */ - public IncidentClassification classification() { - return this.innerProperties() == null ? null : this.innerProperties().classification(); + public IncidentInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentProperties(); + } + this.innerProperties().withTitle(title); + return this; } /** - * Set the classification property: The reason the incident was closed. + * Get the description property: The description of the incident. * - * @param classification the classification value to set. + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the incident. + * + * @param description the description value to set. * @return the IncidentInner object itself. */ - public IncidentInner withClassification(IncidentClassification classification) { + public IncidentInner withDescription(String description) { if (this.innerProperties() == null) { this.innerProperties = new IncidentProperties(); } - this.innerProperties().withClassification(classification); + this.innerProperties().withDescription(description); return this; } /** - * Get the classificationComment property: Describes the reason the incident was closed. + * Get the severity property: The severity of the incident. * - * @return the classificationComment value. + * @return the severity value. */ - public String classificationComment() { - return this.innerProperties() == null ? null : this.innerProperties().classificationComment(); + public IncidentSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); } /** - * Set the classificationComment property: Describes the reason the incident was closed. + * Set the severity property: The severity of the incident. * - * @param classificationComment the classificationComment value to set. + * @param severity the severity value to set. * @return the IncidentInner object itself. */ - public IncidentInner withClassificationComment(String classificationComment) { + public IncidentInner withSeverity(IncidentSeverity severity) { if (this.innerProperties() == null) { this.innerProperties = new IncidentProperties(); } - this.innerProperties().withClassificationComment(classificationComment); + this.innerProperties().withSeverity(severity); return this; } /** - * Get the classificationReason property: The classification reason the incident was closed with. + * Get the status property: The status of the incident. * - * @return the classificationReason value. + * @return the status value. */ - public IncidentClassificationReason classificationReason() { - return this.innerProperties() == null ? null : this.innerProperties().classificationReason(); + public IncidentStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); } /** - * Set the classificationReason property: The classification reason the incident was closed with. + * Set the status property: The status of the incident. * - * @param classificationReason the classificationReason value to set. + * @param status the status value to set. * @return the IncidentInner object itself. */ - public IncidentInner withClassificationReason(IncidentClassificationReason classificationReason) { + public IncidentInner withStatus(IncidentStatus status) { if (this.innerProperties() == null) { this.innerProperties = new IncidentProperties(); } - this.innerProperties().withClassificationReason(classificationReason); + this.innerProperties().withStatus(status); return this; } /** - * Get the createdTimeUtc property: The time the incident was created. + * Get the classification property: The reason the incident was closed. * - * @return the createdTimeUtc value. + * @return the classification value. */ - public OffsetDateTime createdTimeUtc() { - return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); + public IncidentClassification classification() { + return this.innerProperties() == null ? null : this.innerProperties().classification(); } /** - * Get the description property: The description of the incident. + * Set the classification property: The reason the incident was closed. * - * @return the description value. + * @param classification the classification value to set. + * @return the IncidentInner object itself. */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); + public IncidentInner withClassification(IncidentClassification classification) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentProperties(); + } + this.innerProperties().withClassification(classification); + return this; } /** - * Set the description property: The description of the incident. + * Get the classificationReason property: The classification reason the incident was closed with. * - * @param description the description value to set. + * @return the classificationReason value. + */ + public IncidentClassificationReason classificationReason() { + return this.innerProperties() == null ? null : this.innerProperties().classificationReason(); + } + + /** + * Set the classificationReason property: The classification reason the incident was closed with. + * + * @param classificationReason the classificationReason value to set. * @return the IncidentInner object itself. */ - public IncidentInner withDescription(String description) { + public IncidentInner withClassificationReason(IncidentClassificationReason classificationReason) { if (this.innerProperties() == null) { this.innerProperties = new IncidentProperties(); } - this.innerProperties().withDescription(description); + this.innerProperties().withClassificationReason(classificationReason); return this; } /** - * Get the firstActivityTimeUtc property: The time of the first activity in the incident. + * Get the classificationComment property: Describes the reason the incident was closed. * - * @return the firstActivityTimeUtc value. + * @return the classificationComment value. */ - public OffsetDateTime firstActivityTimeUtc() { - return this.innerProperties() == null ? null : this.innerProperties().firstActivityTimeUtc(); + public String classificationComment() { + return this.innerProperties() == null ? null : this.innerProperties().classificationComment(); } /** - * Set the firstActivityTimeUtc property: The time of the first activity in the incident. + * Set the classificationComment property: Describes the reason the incident was closed. * - * @param firstActivityTimeUtc the firstActivityTimeUtc value to set. + * @param classificationComment the classificationComment value to set. * @return the IncidentInner object itself. */ - public IncidentInner withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) { + public IncidentInner withClassificationComment(String classificationComment) { if (this.innerProperties() == null) { this.innerProperties = new IncidentProperties(); } - this.innerProperties().withFirstActivityTimeUtc(firstActivityTimeUtc); + this.innerProperties().withClassificationComment(classificationComment); return this; } /** - * Get the incidentUrl property: The deep-link url to the incident in Azure portal. + * Get the owner property: Describes a user that the incident is assigned to. * - * @return the incidentUrl value. + * @return the owner value. */ - public String incidentUrl() { - return this.innerProperties() == null ? null : this.innerProperties().incidentUrl(); + public IncidentOwnerInfo owner() { + return this.innerProperties() == null ? null : this.innerProperties().owner(); } /** - * Get the incidentNumber property: A sequential number. + * Set the owner property: Describes a user that the incident is assigned to. * - * @return the incidentNumber value. + * @param owner the owner value to set. + * @return the IncidentInner object itself. */ - public Integer incidentNumber() { - return this.innerProperties() == null ? null : this.innerProperties().incidentNumber(); + public IncidentInner withOwner(IncidentOwnerInfo owner) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentProperties(); + } + this.innerProperties().withOwner(owner); + return this; } /** @@ -289,6 +323,29 @@ public IncidentInner withLabels(List labels) { return this; } + /** + * Get the firstActivityTimeUtc property: The time of the first activity in the incident. + * + * @return the firstActivityTimeUtc value. + */ + public OffsetDateTime firstActivityTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().firstActivityTimeUtc(); + } + + /** + * Set the firstActivityTimeUtc property: The time of the first activity in the incident. + * + * @param firstActivityTimeUtc the firstActivityTimeUtc value to set. + * @return the IncidentInner object itself. + */ + public IncidentInner withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentProperties(); + } + this.innerProperties().withFirstActivityTimeUtc(firstActivityTimeUtc); + return this; + } + /** * Get the lastActivityTimeUtc property: The time of the last activity in the incident. * @@ -322,103 +379,88 @@ public OffsetDateTime lastModifiedTimeUtc() { } /** - * Get the owner property: Describes a user that the incident is assigned to. + * Get the createdTimeUtc property: The time the incident was created. * - * @return the owner value. + * @return the createdTimeUtc value. */ - public IncidentOwnerInfo owner() { - return this.innerProperties() == null ? null : this.innerProperties().owner(); + public OffsetDateTime createdTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); } /** - * Set the owner property: Describes a user that the incident is assigned to. + * Get the incidentNumber property: A sequential number. * - * @param owner the owner value to set. - * @return the IncidentInner object itself. + * @return the incidentNumber value. */ - public IncidentInner withOwner(IncidentOwnerInfo owner) { - if (this.innerProperties() == null) { - this.innerProperties = new IncidentProperties(); - } - this.innerProperties().withOwner(owner); - return this; + public Integer incidentNumber() { + return this.innerProperties() == null ? null : this.innerProperties().incidentNumber(); } /** - * Get the relatedAnalyticRuleIds property: List of resource ids of Analytic rules related to the incident. + * Get the additionalData property: Additional data on the incident. * - * @return the relatedAnalyticRuleIds value. + * @return the additionalData value. */ - public List relatedAnalyticRuleIds() { - return this.innerProperties() == null ? null : this.innerProperties().relatedAnalyticRuleIds(); + public IncidentAdditionalData additionalData() { + return this.innerProperties() == null ? null : this.innerProperties().additionalData(); } /** - * Get the severity property: The severity of the incident. + * Get the relatedAnalyticRuleIds property: List of resource ids of Analytic rules related to the incident. * - * @return the severity value. + * @return the relatedAnalyticRuleIds value. */ - public IncidentSeverity severity() { - return this.innerProperties() == null ? null : this.innerProperties().severity(); + public List relatedAnalyticRuleIds() { + return this.innerProperties() == null ? null : this.innerProperties().relatedAnalyticRuleIds(); } /** - * Set the severity property: The severity of the incident. + * Get the incidentUrl property: The deep-link url to the incident in Azure portal. * - * @param severity the severity value to set. - * @return the IncidentInner object itself. + * @return the incidentUrl value. */ - public IncidentInner withSeverity(IncidentSeverity severity) { - if (this.innerProperties() == null) { - this.innerProperties = new IncidentProperties(); - } - this.innerProperties().withSeverity(severity); - return this; + public String incidentUrl() { + return this.innerProperties() == null ? null : this.innerProperties().incidentUrl(); } /** - * Get the status property: The status of the incident. + * Get the providerName property: The name of the source provider that generated the incident. * - * @return the status value. + * @return the providerName value. */ - public IncidentStatus status() { - return this.innerProperties() == null ? null : this.innerProperties().status(); + public String providerName() { + return this.innerProperties() == null ? null : this.innerProperties().providerName(); } /** - * Set the status property: The status of the incident. + * Get the providerIncidentId property: The incident ID assigned by the incident provider. * - * @param status the status value to set. - * @return the IncidentInner object itself. + * @return the providerIncidentId value. */ - public IncidentInner withStatus(IncidentStatus status) { - if (this.innerProperties() == null) { - this.innerProperties = new IncidentProperties(); - } - this.innerProperties().withStatus(status); - return this; + public String providerIncidentId() { + return this.innerProperties() == null ? null : this.innerProperties().providerIncidentId(); } /** - * Get the title property: The title of the incident. + * Get the teamInformation property: Describes a team for the incident. * - * @return the title value. + * @return the teamInformation value. */ - public String title() { - return this.innerProperties() == null ? null : this.innerProperties().title(); + public TeamInformation teamInformation() { + return this.innerProperties() == null ? null : this.innerProperties().teamInformation(); } /** - * Set the title property: The title of the incident. + * Set the teamInformation property: Describes a team for the incident. * - * @param title the title value to set. + * @param teamInformation the teamInformation value to set. * @return the IncidentInner object itself. */ - public IncidentInner withTitle(String title) { + public IncidentInner withTeamInformation(TeamInformation teamInformation) { if (this.innerProperties() == null) { this.innerProperties = new IncidentProperties(); } - this.innerProperties().withTitle(title); + this.innerProperties().withTeamInformation(teamInformation); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentProperties.java index 5345982b0317..437a9e00ab13 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentProperties.java @@ -18,65 +18,66 @@ import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; import com.azure.resourcemanager.securityinsights.models.IncidentStatus; +import com.azure.resourcemanager.securityinsights.models.TeamInformation; import java.io.IOException; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.List; /** - * Describes incident properties. + * The IncidentProperties model. */ @Fluent public final class IncidentProperties implements JsonSerializable { /* - * Additional data on the incident + * The title of the incident */ - private IncidentAdditionalData additionalData; + private String title; /* - * The reason the incident was closed + * The description of the incident */ - private IncidentClassification classification; + private String description; /* - * Describes the reason the incident was closed + * The severity of the incident */ - private String classificationComment; + private IncidentSeverity severity; /* - * The classification reason the incident was closed with + * The status of the incident */ - private IncidentClassificationReason classificationReason; + private IncidentStatus status; /* - * The time the incident was created + * The reason the incident was closed */ - private OffsetDateTime createdTimeUtc; + private IncidentClassification classification; /* - * The description of the incident + * The classification reason the incident was closed with */ - private String description; + private IncidentClassificationReason classificationReason; /* - * The time of the first activity in the incident + * Describes the reason the incident was closed */ - private OffsetDateTime firstActivityTimeUtc; + private String classificationComment; /* - * The deep-link url to the incident in Azure portal + * Describes a user that the incident is assigned to */ - private String incidentUrl; + private IncidentOwnerInfo owner; /* - * A sequential number + * List of labels relevant to this incident */ - private Integer incidentNumber; + private List labels; /* - * List of labels relevant to this incident + * The time of the first activity in the incident */ - private List labels; + private OffsetDateTime firstActivityTimeUtc; /* * The time of the last activity in the incident @@ -89,9 +90,19 @@ public final class IncidentProperties implements JsonSerializable relatedAnalyticRuleIds; /* - * The severity of the incident + * The deep-link url to the incident in Azure portal */ - private IncidentSeverity severity; + private String incidentUrl; /* - * The status of the incident + * The name of the source provider that generated the incident */ - private IncidentStatus status; + private String providerName; /* - * The title of the incident + * The incident ID assigned by the incident provider */ - private String title; + private String providerIncidentId; + + /* + * Describes a team for the incident + */ + private TeamInformation teamInformation; /** * Creates an instance of IncidentProperties class. @@ -120,139 +136,163 @@ public IncidentProperties() { } /** - * Get the additionalData property: Additional data on the incident. + * Get the title property: The title of the incident. * - * @return the additionalData value. + * @return the title value. */ - public IncidentAdditionalData additionalData() { - return this.additionalData; + public String title() { + return this.title; } /** - * Get the classification property: The reason the incident was closed. + * Set the title property: The title of the incident. * - * @return the classification value. + * @param title the title value to set. + * @return the IncidentProperties object itself. */ - public IncidentClassification classification() { - return this.classification; + public IncidentProperties withTitle(String title) { + this.title = title; + return this; } /** - * Set the classification property: The reason the incident was closed. + * Get the description property: The description of the incident. * - * @param classification the classification value to set. + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the incident. + * + * @param description the description value to set. * @return the IncidentProperties object itself. */ - public IncidentProperties withClassification(IncidentClassification classification) { - this.classification = classification; + public IncidentProperties withDescription(String description) { + this.description = description; return this; } /** - * Get the classificationComment property: Describes the reason the incident was closed. + * Get the severity property: The severity of the incident. * - * @return the classificationComment value. + * @return the severity value. */ - public String classificationComment() { - return this.classificationComment; + public IncidentSeverity severity() { + return this.severity; } /** - * Set the classificationComment property: Describes the reason the incident was closed. + * Set the severity property: The severity of the incident. * - * @param classificationComment the classificationComment value to set. + * @param severity the severity value to set. * @return the IncidentProperties object itself. */ - public IncidentProperties withClassificationComment(String classificationComment) { - this.classificationComment = classificationComment; + public IncidentProperties withSeverity(IncidentSeverity severity) { + this.severity = severity; return this; } /** - * Get the classificationReason property: The classification reason the incident was closed with. + * Get the status property: The status of the incident. * - * @return the classificationReason value. + * @return the status value. */ - public IncidentClassificationReason classificationReason() { - return this.classificationReason; + public IncidentStatus status() { + return this.status; } /** - * Set the classificationReason property: The classification reason the incident was closed with. + * Set the status property: The status of the incident. * - * @param classificationReason the classificationReason value to set. + * @param status the status value to set. * @return the IncidentProperties object itself. */ - public IncidentProperties withClassificationReason(IncidentClassificationReason classificationReason) { - this.classificationReason = classificationReason; + public IncidentProperties withStatus(IncidentStatus status) { + this.status = status; return this; } /** - * Get the createdTimeUtc property: The time the incident was created. + * Get the classification property: The reason the incident was closed. * - * @return the createdTimeUtc value. + * @return the classification value. */ - public OffsetDateTime createdTimeUtc() { - return this.createdTimeUtc; + public IncidentClassification classification() { + return this.classification; } /** - * Get the description property: The description of the incident. + * Set the classification property: The reason the incident was closed. * - * @return the description value. + * @param classification the classification value to set. + * @return the IncidentProperties object itself. */ - public String description() { - return this.description; + public IncidentProperties withClassification(IncidentClassification classification) { + this.classification = classification; + return this; } /** - * Set the description property: The description of the incident. + * Get the classificationReason property: The classification reason the incident was closed with. * - * @param description the description value to set. + * @return the classificationReason value. + */ + public IncidentClassificationReason classificationReason() { + return this.classificationReason; + } + + /** + * Set the classificationReason property: The classification reason the incident was closed with. + * + * @param classificationReason the classificationReason value to set. * @return the IncidentProperties object itself. */ - public IncidentProperties withDescription(String description) { - this.description = description; + public IncidentProperties withClassificationReason(IncidentClassificationReason classificationReason) { + this.classificationReason = classificationReason; return this; } /** - * Get the firstActivityTimeUtc property: The time of the first activity in the incident. + * Get the classificationComment property: Describes the reason the incident was closed. * - * @return the firstActivityTimeUtc value. + * @return the classificationComment value. */ - public OffsetDateTime firstActivityTimeUtc() { - return this.firstActivityTimeUtc; + public String classificationComment() { + return this.classificationComment; } /** - * Set the firstActivityTimeUtc property: The time of the first activity in the incident. + * Set the classificationComment property: Describes the reason the incident was closed. * - * @param firstActivityTimeUtc the firstActivityTimeUtc value to set. + * @param classificationComment the classificationComment value to set. * @return the IncidentProperties object itself. */ - public IncidentProperties withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) { - this.firstActivityTimeUtc = firstActivityTimeUtc; + public IncidentProperties withClassificationComment(String classificationComment) { + this.classificationComment = classificationComment; return this; } /** - * Get the incidentUrl property: The deep-link url to the incident in Azure portal. + * Get the owner property: Describes a user that the incident is assigned to. * - * @return the incidentUrl value. + * @return the owner value. */ - public String incidentUrl() { - return this.incidentUrl; + public IncidentOwnerInfo owner() { + return this.owner; } /** - * Get the incidentNumber property: A sequential number. + * Set the owner property: Describes a user that the incident is assigned to. * - * @return the incidentNumber value. + * @param owner the owner value to set. + * @return the IncidentProperties object itself. */ - public Integer incidentNumber() { - return this.incidentNumber; + public IncidentProperties withOwner(IncidentOwnerInfo owner) { + this.owner = owner; + return this; } /** @@ -275,6 +315,26 @@ public IncidentProperties withLabels(List labels) { return this; } + /** + * Get the firstActivityTimeUtc property: The time of the first activity in the incident. + * + * @return the firstActivityTimeUtc value. + */ + public OffsetDateTime firstActivityTimeUtc() { + return this.firstActivityTimeUtc; + } + + /** + * Set the firstActivityTimeUtc property: The time of the first activity in the incident. + * + * @param firstActivityTimeUtc the firstActivityTimeUtc value to set. + * @return the IncidentProperties object itself. + */ + public IncidentProperties withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) { + this.firstActivityTimeUtc = firstActivityTimeUtc; + return this; + } + /** * Get the lastActivityTimeUtc property: The time of the last activity in the incident. * @@ -305,91 +365,85 @@ public OffsetDateTime lastModifiedTimeUtc() { } /** - * Get the owner property: Describes a user that the incident is assigned to. + * Get the createdTimeUtc property: The time the incident was created. * - * @return the owner value. + * @return the createdTimeUtc value. */ - public IncidentOwnerInfo owner() { - return this.owner; + public OffsetDateTime createdTimeUtc() { + return this.createdTimeUtc; } /** - * Set the owner property: Describes a user that the incident is assigned to. + * Get the incidentNumber property: A sequential number. * - * @param owner the owner value to set. - * @return the IncidentProperties object itself. + * @return the incidentNumber value. */ - public IncidentProperties withOwner(IncidentOwnerInfo owner) { - this.owner = owner; - return this; + public Integer incidentNumber() { + return this.incidentNumber; } /** - * Get the relatedAnalyticRuleIds property: List of resource ids of Analytic rules related to the incident. + * Get the additionalData property: Additional data on the incident. * - * @return the relatedAnalyticRuleIds value. + * @return the additionalData value. */ - public List relatedAnalyticRuleIds() { - return this.relatedAnalyticRuleIds; + public IncidentAdditionalData additionalData() { + return this.additionalData; } /** - * Get the severity property: The severity of the incident. + * Get the relatedAnalyticRuleIds property: List of resource ids of Analytic rules related to the incident. * - * @return the severity value. + * @return the relatedAnalyticRuleIds value. */ - public IncidentSeverity severity() { - return this.severity; + public List relatedAnalyticRuleIds() { + return this.relatedAnalyticRuleIds; } /** - * Set the severity property: The severity of the incident. + * Get the incidentUrl property: The deep-link url to the incident in Azure portal. * - * @param severity the severity value to set. - * @return the IncidentProperties object itself. + * @return the incidentUrl value. */ - public IncidentProperties withSeverity(IncidentSeverity severity) { - this.severity = severity; - return this; + public String incidentUrl() { + return this.incidentUrl; } /** - * Get the status property: The status of the incident. + * Get the providerName property: The name of the source provider that generated the incident. * - * @return the status value. + * @return the providerName value. */ - public IncidentStatus status() { - return this.status; + public String providerName() { + return this.providerName; } /** - * Set the status property: The status of the incident. + * Get the providerIncidentId property: The incident ID assigned by the incident provider. * - * @param status the status value to set. - * @return the IncidentProperties object itself. + * @return the providerIncidentId value. */ - public IncidentProperties withStatus(IncidentStatus status) { - this.status = status; - return this; + public String providerIncidentId() { + return this.providerIncidentId; } /** - * Get the title property: The title of the incident. + * Get the teamInformation property: Describes a team for the incident. * - * @return the title value. + * @return the teamInformation value. */ - public String title() { - return this.title; + public TeamInformation teamInformation() { + return this.teamInformation; } /** - * Set the title property: The title of the incident. + * Set the teamInformation property: Describes a team for the incident. * - * @param title the title value to set. + * @param teamInformation the teamInformation value to set. * @return the IncidentProperties object itself. */ - public IncidentProperties withTitle(String title) { - this.title = title; + public IncidentProperties withTeamInformation(TeamInformation teamInformation) { + this.teamInformation = teamInformation; return this; } @@ -399,14 +453,9 @@ public IncidentProperties withTitle(String title) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (additionalData() != null) { - additionalData().validate(); - } - if (labels() != null) { - labels().forEach(e -> e.validate()); - } - if (owner() != null) { - owner().validate(); + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property title in model IncidentProperties")); } if (severity() == null) { throw LOGGER.atError() @@ -416,9 +465,17 @@ public void validate() { throw LOGGER.atError() .log(new IllegalArgumentException("Missing required property status in model IncidentProperties")); } - if (title() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property title in model IncidentProperties")); + if (owner() != null) { + owner().validate(); + } + if (labels() != null) { + labels().forEach(e -> e.validate()); + } + if (additionalData() != null) { + additionalData().validate(); + } + if (teamInformation() != null) { + teamInformation().validate(); } } @@ -430,25 +487,26 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); jsonWriter.writeStringField("classification", this.classification == null ? null : this.classification.toString()); - jsonWriter.writeStringField("classificationComment", this.classificationComment); jsonWriter.writeStringField("classificationReason", this.classificationReason == null ? null : this.classificationReason.toString()); - jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("classificationComment", this.classificationComment); + jsonWriter.writeJsonField("owner", this.owner); + jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("firstActivityTimeUtc", this.firstActivityTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.firstActivityTimeUtc)); - jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("lastActivityTimeUtc", this.lastActivityTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastActivityTimeUtc)); - jsonWriter.writeJsonField("owner", this.owner); + jsonWriter.writeJsonField("teamInformation", this.teamInformation); return jsonWriter.writeEndObject(); } @@ -468,48 +526,54 @@ public static IncidentProperties fromJson(JsonReader jsonReader) throws IOExcept String fieldName = reader.getFieldName(); reader.nextToken(); - if ("severity".equals(fieldName)) { + if ("title".equals(fieldName)) { + deserializedIncidentProperties.title = reader.getString(); + } else if ("severity".equals(fieldName)) { deserializedIncidentProperties.severity = IncidentSeverity.fromString(reader.getString()); } else if ("status".equals(fieldName)) { deserializedIncidentProperties.status = IncidentStatus.fromString(reader.getString()); - } else if ("title".equals(fieldName)) { - deserializedIncidentProperties.title = reader.getString(); - } else if ("additionalData".equals(fieldName)) { - deserializedIncidentProperties.additionalData = IncidentAdditionalData.fromJson(reader); + } else if ("description".equals(fieldName)) { + deserializedIncidentProperties.description = reader.getString(); } else if ("classification".equals(fieldName)) { deserializedIncidentProperties.classification = IncidentClassification.fromString(reader.getString()); - } else if ("classificationComment".equals(fieldName)) { - deserializedIncidentProperties.classificationComment = reader.getString(); } else if ("classificationReason".equals(fieldName)) { deserializedIncidentProperties.classificationReason = IncidentClassificationReason.fromString(reader.getString()); - } else if ("createdTimeUtc".equals(fieldName)) { - deserializedIncidentProperties.createdTimeUtc = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("description".equals(fieldName)) { - deserializedIncidentProperties.description = reader.getString(); - } else if ("firstActivityTimeUtc".equals(fieldName)) { - deserializedIncidentProperties.firstActivityTimeUtc = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("incidentUrl".equals(fieldName)) { - deserializedIncidentProperties.incidentUrl = reader.getString(); - } else if ("incidentNumber".equals(fieldName)) { - deserializedIncidentProperties.incidentNumber = reader.getNullable(JsonReader::getInt); + } else if ("classificationComment".equals(fieldName)) { + deserializedIncidentProperties.classificationComment = reader.getString(); + } else if ("owner".equals(fieldName)) { + deserializedIncidentProperties.owner = IncidentOwnerInfo.fromJson(reader); } else if ("labels".equals(fieldName)) { List labels = reader.readArray(reader1 -> IncidentLabel.fromJson(reader1)); deserializedIncidentProperties.labels = labels; + } else if ("firstActivityTimeUtc".equals(fieldName)) { + deserializedIncidentProperties.firstActivityTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastActivityTimeUtc".equals(fieldName)) { deserializedIncidentProperties.lastActivityTimeUtc = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastModifiedTimeUtc".equals(fieldName)) { deserializedIncidentProperties.lastModifiedTimeUtc = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("owner".equals(fieldName)) { - deserializedIncidentProperties.owner = IncidentOwnerInfo.fromJson(reader); + } else if ("createdTimeUtc".equals(fieldName)) { + deserializedIncidentProperties.createdTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("incidentNumber".equals(fieldName)) { + deserializedIncidentProperties.incidentNumber = reader.getNullable(JsonReader::getInt); + } else if ("additionalData".equals(fieldName)) { + deserializedIncidentProperties.additionalData = IncidentAdditionalData.fromJson(reader); } else if ("relatedAnalyticRuleIds".equals(fieldName)) { List relatedAnalyticRuleIds = reader.readArray(reader1 -> reader1.getString()); deserializedIncidentProperties.relatedAnalyticRuleIds = relatedAnalyticRuleIds; + } else if ("incidentUrl".equals(fieldName)) { + deserializedIncidentProperties.incidentUrl = reader.getString(); + } else if ("providerName".equals(fieldName)) { + deserializedIncidentProperties.providerName = reader.getString(); + } else if ("providerIncidentId".equals(fieldName)) { + deserializedIncidentProperties.providerIncidentId = reader.getString(); + } else if ("teamInformation".equals(fieldName)) { + deserializedIncidentProperties.teamInformation = TeamInformation.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentTaskInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentTaskInner.java new file mode 100644 index 000000000000..edc78e706d24 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentTaskInner.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ClientInfo; +import com.azure.resourcemanager.securityinsights.models.IncidentTaskStatus; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The IncidentTask model. + */ +@Fluent +public final class IncidentTaskInner extends ResourceWithEtag { + /* + * The properties property. + */ + private IncidentTaskProperties innerProperties = new IncidentTaskProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of IncidentTaskInner class. + */ + public IncidentTaskInner() { + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private IncidentTaskProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public IncidentTaskInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the title property: The title of the task. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: The title of the task. + * + * @param title the title value to set. + * @return the IncidentTaskInner object itself. + */ + public IncidentTaskInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentTaskProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the description property: The description of the task. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the task. + * + * @param description the description value to set. + * @return the IncidentTaskInner object itself. + */ + public IncidentTaskInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentTaskProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + public IncidentTaskStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The status property. + * + * @param status the status value to set. + * @return the IncidentTaskInner object itself. + */ + public IncidentTaskInner withStatus(IncidentTaskStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentTaskProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the createdTimeUtc property: The time the task was created. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); + } + + /** + * Get the lastModifiedTimeUtc property: The last time the task was updated. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); + } + + /** + * Get the createdBy property: Information on the client (user or application) that made some action. + * + * @return the createdBy value. + */ + public ClientInfo createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Set the createdBy property: Information on the client (user or application) that made some action. + * + * @param createdBy the createdBy value to set. + * @return the IncidentTaskInner object itself. + */ + public IncidentTaskInner withCreatedBy(ClientInfo createdBy) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentTaskProperties(); + } + this.innerProperties().withCreatedBy(createdBy); + return this; + } + + /** + * Get the lastModifiedBy property: Information on the client (user or application) that made some action. + * + * @return the lastModifiedBy value. + */ + public ClientInfo lastModifiedBy() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy(); + } + + /** + * Set the lastModifiedBy property: Information on the client (user or application) that made some action. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the IncidentTaskInner object itself. + */ + public IncidentTaskInner withLastModifiedBy(ClientInfo lastModifiedBy) { + if (this.innerProperties() == null) { + this.innerProperties = new IncidentTaskProperties(); + } + this.innerProperties().withLastModifiedBy(lastModifiedBy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model IncidentTaskInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IncidentTaskInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IncidentTaskInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IncidentTaskInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IncidentTaskInner. + */ + public static IncidentTaskInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IncidentTaskInner deserializedIncidentTaskInner = new IncidentTaskInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIncidentTaskInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIncidentTaskInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIncidentTaskInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedIncidentTaskInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedIncidentTaskInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedIncidentTaskInner.innerProperties = IncidentTaskProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIncidentTaskInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentTaskProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentTaskProperties.java new file mode 100644 index 000000000000..b999b928e8ef --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IncidentTaskProperties.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ClientInfo; +import com.azure.resourcemanager.securityinsights.models.IncidentTaskStatus; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The IncidentTaskProperties model. + */ +@Fluent +public final class IncidentTaskProperties implements JsonSerializable { + /* + * The title of the task + */ + private String title; + + /* + * The description of the task + */ + private String description; + + /* + * The status property. + */ + private IncidentTaskStatus status; + + /* + * The time the task was created + */ + private OffsetDateTime createdTimeUtc; + + /* + * The last time the task was updated + */ + private OffsetDateTime lastModifiedTimeUtc; + + /* + * Information on the client (user or application) that made some action + */ + private ClientInfo createdBy; + + /* + * Information on the client (user or application) that made some action + */ + private ClientInfo lastModifiedBy; + + /** + * Creates an instance of IncidentTaskProperties class. + */ + public IncidentTaskProperties() { + } + + /** + * Get the title property: The title of the task. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The title of the task. + * + * @param title the title value to set. + * @return the IncidentTaskProperties object itself. + */ + public IncidentTaskProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: The description of the task. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the task. + * + * @param description the description value to set. + * @return the IncidentTaskProperties object itself. + */ + public IncidentTaskProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + public IncidentTaskStatus status() { + return this.status; + } + + /** + * Set the status property: The status property. + * + * @param status the status value to set. + * @return the IncidentTaskProperties object itself. + */ + public IncidentTaskProperties withStatus(IncidentTaskStatus status) { + this.status = status; + return this; + } + + /** + * Get the createdTimeUtc property: The time the task was created. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.createdTimeUtc; + } + + /** + * Get the lastModifiedTimeUtc property: The last time the task was updated. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.lastModifiedTimeUtc; + } + + /** + * Get the createdBy property: Information on the client (user or application) that made some action. + * + * @return the createdBy value. + */ + public ClientInfo createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: Information on the client (user or application) that made some action. + * + * @param createdBy the createdBy value to set. + * @return the IncidentTaskProperties object itself. + */ + public IncidentTaskProperties withCreatedBy(ClientInfo createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the lastModifiedBy property: Information on the client (user or application) that made some action. + * + * @return the lastModifiedBy value. + */ + public ClientInfo lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the lastModifiedBy property: Information on the client (user or application) that made some action. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the IncidentTaskProperties object itself. + */ + public IncidentTaskProperties withLastModifiedBy(ClientInfo lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property title in model IncidentTaskProperties")); + } + if (status() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property status in model IncidentTaskProperties")); + } + if (createdBy() != null) { + createdBy().validate(); + } + if (lastModifiedBy() != null) { + lastModifiedBy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IncidentTaskProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("createdBy", this.createdBy); + jsonWriter.writeJsonField("lastModifiedBy", this.lastModifiedBy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IncidentTaskProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IncidentTaskProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IncidentTaskProperties. + */ + public static IncidentTaskProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IncidentTaskProperties deserializedIncidentTaskProperties = new IncidentTaskProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedIncidentTaskProperties.title = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedIncidentTaskProperties.status = IncidentTaskStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedIncidentTaskProperties.description = reader.getString(); + } else if ("createdTimeUtc".equals(fieldName)) { + deserializedIncidentTaskProperties.createdTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedTimeUtc".equals(fieldName)) { + deserializedIncidentTaskProperties.lastModifiedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedIncidentTaskProperties.createdBy = ClientInfo.fromJson(reader); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedIncidentTaskProperties.lastModifiedBy = ClientInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIncidentTaskProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTCheckRequirementsProperties.java new file mode 100644 index 000000000000..9e4a5b5029a5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTCheckRequirementsProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * IoT requirements check properties. + */ +@Fluent +public final class IoTCheckRequirementsProperties implements JsonSerializable { + /* + * The subscription id to connect to, and get the data from. + */ + private String subscriptionId; + + /** + * Creates an instance of IoTCheckRequirementsProperties class. + */ + public IoTCheckRequirementsProperties() { + } + + /** + * Get the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the IoTCheckRequirementsProperties object itself. + */ + public IoTCheckRequirementsProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTCheckRequirementsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IoTCheckRequirementsProperties. + */ + public static IoTCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTCheckRequirementsProperties deserializedIoTCheckRequirementsProperties + = new IoTCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionId".equals(fieldName)) { + deserializedIoTCheckRequirementsProperties.subscriptionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIoTCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTDataConnectorProperties.java new file mode 100644 index 000000000000..a7a711c8a9e3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTDataConnectorProperties.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; +import com.azure.resourcemanager.securityinsights.models.DataConnectorWithAlertsProperties; +import java.io.IOException; + +/** + * IoT data connector properties. + */ +@Fluent +public final class IoTDataConnectorProperties extends DataConnectorWithAlertsProperties { + /* + * The subscription id to connect to, and get the data from. + */ + private String subscriptionId; + + /** + * Creates an instance of IoTDataConnectorProperties class. + */ + public IoTDataConnectorProperties() { + } + + /** + * Get the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the IoTDataConnectorProperties object itself. + */ + public IoTDataConnectorProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public IoTDataConnectorProperties withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + super.withDataTypes(dataTypes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() != null) { + dataTypes().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("dataTypes", dataTypes()); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTDataConnectorProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IoTDataConnectorProperties. + */ + public static IoTDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTDataConnectorProperties deserializedIoTDataConnectorProperties = new IoTDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataTypes".equals(fieldName)) { + deserializedIoTDataConnectorProperties + .withDataTypes(AlertsDataTypeOfDataConnector.fromJson(reader)); + } else if ("subscriptionId".equals(fieldName)) { + deserializedIoTDataConnectorProperties.subscriptionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIoTDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTDeviceEntityProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTDeviceEntityProperties.java index 7f4b66868f1b..0fd8e8637fba 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTDeviceEntityProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/IoTDeviceEntityProperties.java @@ -4,10 +4,11 @@ package com.azure.resourcemanager.securityinsights.fluent.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DeviceImportance; import com.azure.resourcemanager.securityinsights.models.EntityCommonProperties; import com.azure.resourcemanager.securityinsights.models.ThreatIntelligence; import java.io.IOException; @@ -18,7 +19,7 @@ /** * IoTDevice entity property bag. */ -@Immutable +@Fluent public final class IoTDeviceEntityProperties extends EntityCommonProperties { /* * The ID of the IoT Device in the IoT Hub @@ -105,6 +106,61 @@ public final class IoTDeviceEntityProperties extends EntityCommonProperties { */ private List protocols; + /* + * A list of owners of the IoTDevice entity. + */ + private List owners; + + /* + * A list of Nic entity ids of the IoTDevice entity. + */ + private List nicEntityIds; + + /* + * The site of the device + */ + private String site; + + /* + * The zone location of the device within a site + */ + private String zone; + + /* + * The sensor the device is monitored by + */ + private String sensor; + + /* + * The subType of the device ('PLC', 'HMI', 'EWS', etc.) + */ + private String deviceSubType; + + /* + * Device importance, determines if the device classified as 'crown jewel' + */ + private DeviceImportance importance; + + /* + * The Purdue Layer of the device + */ + private String purdueLayer; + + /* + * Determines whether the device classified as authorized device + */ + private Boolean isAuthorized; + + /* + * Determines whether the device classified as programming device + */ + private Boolean isProgramming; + + /* + * Is the device classified as a scanner device + */ + private Boolean isScanner; + /* * The graph item display name which is a short humanly readable description of the graph item instance. This * property is optional and might be system generated. @@ -275,6 +331,116 @@ public List protocols() { return this.protocols; } + /** + * Get the owners property: A list of owners of the IoTDevice entity. + * + * @return the owners value. + */ + public List owners() { + return this.owners; + } + + /** + * Get the nicEntityIds property: A list of Nic entity ids of the IoTDevice entity. + * + * @return the nicEntityIds value. + */ + public List nicEntityIds() { + return this.nicEntityIds; + } + + /** + * Get the site property: The site of the device. + * + * @return the site value. + */ + public String site() { + return this.site; + } + + /** + * Get the zone property: The zone location of the device within a site. + * + * @return the zone value. + */ + public String zone() { + return this.zone; + } + + /** + * Get the sensor property: The sensor the device is monitored by. + * + * @return the sensor value. + */ + public String sensor() { + return this.sensor; + } + + /** + * Get the deviceSubType property: The subType of the device ('PLC', 'HMI', 'EWS', etc.). + * + * @return the deviceSubType value. + */ + public String deviceSubType() { + return this.deviceSubType; + } + + /** + * Get the importance property: Device importance, determines if the device classified as 'crown jewel'. + * + * @return the importance value. + */ + public DeviceImportance importance() { + return this.importance; + } + + /** + * Set the importance property: Device importance, determines if the device classified as 'crown jewel'. + * + * @param importance the importance value to set. + * @return the IoTDeviceEntityProperties object itself. + */ + public IoTDeviceEntityProperties withImportance(DeviceImportance importance) { + this.importance = importance; + return this; + } + + /** + * Get the purdueLayer property: The Purdue Layer of the device. + * + * @return the purdueLayer value. + */ + public String purdueLayer() { + return this.purdueLayer; + } + + /** + * Get the isAuthorized property: Determines whether the device classified as authorized device. + * + * @return the isAuthorized value. + */ + public Boolean isAuthorized() { + return this.isAuthorized; + } + + /** + * Get the isProgramming property: Determines whether the device classified as programming device. + * + * @return the isProgramming value. + */ + public Boolean isProgramming() { + return this.isProgramming; + } + + /** + * Get the isScanner property: Is the device classified as a scanner device. + * + * @return the isScanner value. + */ + public Boolean isScanner() { + return this.isScanner; + } + /** * Get the friendlyName property: The graph item display name which is a short humanly readable description of the * graph item instance. This property is optional and might be system generated. @@ -315,6 +481,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeStringField("importance", this.importance == null ? null : this.importance.toString()); return jsonWriter.writeEndObject(); } @@ -376,6 +543,30 @@ public static IoTDeviceEntityProperties fromJson(JsonReader jsonReader) throws I } else if ("protocols".equals(fieldName)) { List protocols = reader.readArray(reader1 -> reader1.getString()); deserializedIoTDeviceEntityProperties.protocols = protocols; + } else if ("owners".equals(fieldName)) { + List owners = reader.readArray(reader1 -> reader1.getString()); + deserializedIoTDeviceEntityProperties.owners = owners; + } else if ("nicEntityIds".equals(fieldName)) { + List nicEntityIds = reader.readArray(reader1 -> reader1.getString()); + deserializedIoTDeviceEntityProperties.nicEntityIds = nicEntityIds; + } else if ("site".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.site = reader.getString(); + } else if ("zone".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.zone = reader.getString(); + } else if ("sensor".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.sensor = reader.getString(); + } else if ("deviceSubType".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.deviceSubType = reader.getString(); + } else if ("importance".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.importance = DeviceImportance.fromString(reader.getString()); + } else if ("purdueLayer".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.purdueLayer = reader.getString(); + } else if ("isAuthorized".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.isAuthorized = reader.getNullable(JsonReader::getBoolean); + } else if ("isProgramming".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.isProgramming = reader.getNullable(JsonReader::getBoolean); + } else if ("isScanner".equals(fieldName)) { + deserializedIoTDeviceEntityProperties.isScanner = reader.getNullable(JsonReader::getBoolean); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/JobInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/JobInner.java new file mode 100644 index 000000000000..e315f6123c85 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/JobInner.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.JobItem; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The assignment job. + */ +@Fluent +public final class JobInner extends ResourceWithEtag { + /* + * The job object + */ + private JobProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of JobInner class. + */ + public JobInner() { + } + + /** + * Get the innerProperties property: The job object. + * + * @return the innerProperties value. + */ + private JobProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JobInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the endTime property: The time the job completed. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the items property: List of items published by the job. + * + * @return the items value. + */ + public List items() { + return this.innerProperties() == null ? null : this.innerProperties().items(); + } + + /** + * Set the items property: List of items published by the job. + * + * @param items the items value to set. + * @return the JobInner object itself. + */ + public JobInner withItems(List items) { + if (this.innerProperties() == null) { + this.innerProperties = new JobProperties(); + } + this.innerProperties().withItems(items); + return this; + } + + /** + * Get the provisioningState property: State of the job. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the startTime property: The time the job started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the errorMessage property: Message to describe error, if an error exists. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobInner. + */ + public static JobInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobInner deserializedJobInner = new JobInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedJobInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedJobInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedJobInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedJobInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedJobInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedJobInner.innerProperties = JobProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedJobInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/JobProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/JobProperties.java new file mode 100644 index 000000000000..f1fbd3552040 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/JobProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.JobItem; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The job properties. + */ +@Fluent +public final class JobProperties implements JsonSerializable { + /* + * The time the job completed + */ + private OffsetDateTime endTime; + + /* + * List of items published by the job + */ + private List items; + + /* + * State of the job + */ + private ProvisioningState provisioningState; + + /* + * The time the job started + */ + private OffsetDateTime startTime; + + /* + * Message to describe error, if an error exists + */ + private String errorMessage; + + /** + * Creates an instance of JobProperties class. + */ + public JobProperties() { + } + + /** + * Get the endTime property: The time the job completed. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the items property: List of items published by the job. + * + * @return the items value. + */ + public List items() { + return this.items; + } + + /** + * Set the items property: List of items published by the job. + * + * @param items the items value to set. + * @return the JobProperties object itself. + */ + public JobProperties withItems(List items) { + this.items = items; + return this; + } + + /** + * Get the provisioningState property: State of the job. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the startTime property: The time the job started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the errorMessage property: Message to describe error, if an error exists. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (items() != null) { + items().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("items", this.items, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the JobProperties. + */ + public static JobProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobProperties deserializedJobProperties = new JobProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endTime".equals(fieldName)) { + deserializedJobProperties.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("items".equals(fieldName)) { + List items = reader.readArray(reader1 -> JobItem.fromJson(reader1)); + deserializedJobProperties.items = items; + } else if ("provisioningState".equals(fieldName)) { + deserializedJobProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedJobProperties.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("errorMessage".equals(fieldName)) { + deserializedJobProperties.errorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MLBehaviorAnalyticsAlertRuleProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MLBehaviorAnalyticsAlertRuleProperties.java new file mode 100644 index 000000000000..926a1d582da6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MLBehaviorAnalyticsAlertRuleProperties.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertSeverity; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * MLBehaviorAnalytics alert rule base property bag. + */ +@Fluent +public final class MLBehaviorAnalyticsAlertRuleProperties + implements JsonSerializable { + /* + * The Name of the alert rule template used to create this rule. + */ + private String alertRuleTemplateName; + + /* + * The description of the alert rule. + */ + private String description; + + /* + * The display name for alerts created by this alert rule. + */ + private String displayName; + + /* + * Determines whether this alert rule is enabled or disabled. + */ + private boolean enabled; + + /* + * The last time that this alert rule has been modified. + */ + private OffsetDateTime lastModifiedUtc; + + /* + * The severity for alerts created by this alert rule. + */ + private AlertSeverity severity; + + /* + * The tactics of the alert rule + */ + private List tactics; + + /* + * The techniques of the alert rule + */ + private List techniques; + + /* + * The sub-techniques of the alert rule + */ + private List subTechniques; + + /** + * Creates an instance of MLBehaviorAnalyticsAlertRuleProperties class. + */ + public MLBehaviorAnalyticsAlertRuleProperties() { + } + + /** + * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @return the alertRuleTemplateName value. + */ + public String alertRuleTemplateName() { + return this.alertRuleTemplateName; + } + + /** + * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @param alertRuleTemplateName the alertRuleTemplateName value to set. + * @return the MLBehaviorAnalyticsAlertRuleProperties object itself. + */ + public MLBehaviorAnalyticsAlertRuleProperties withAlertRuleTemplateName(String alertRuleTemplateName) { + this.alertRuleTemplateName = alertRuleTemplateName; + return this; + } + + /** + * Get the description property: The description of the alert rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the displayName property: The display name for alerts created by this alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the MLBehaviorAnalyticsAlertRuleProperties object itself. + */ + public MLBehaviorAnalyticsAlertRuleProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the lastModifiedUtc property: The last time that this alert rule has been modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.tactics; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.subTechniques; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (alertRuleTemplateName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property alertRuleTemplateName in model MLBehaviorAnalyticsAlertRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MLBehaviorAnalyticsAlertRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("alertRuleTemplateName", this.alertRuleTemplateName); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MLBehaviorAnalyticsAlertRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MLBehaviorAnalyticsAlertRuleProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MLBehaviorAnalyticsAlertRuleProperties. + */ + public static MLBehaviorAnalyticsAlertRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MLBehaviorAnalyticsAlertRuleProperties deserializedMLBehaviorAnalyticsAlertRuleProperties + = new MLBehaviorAnalyticsAlertRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertRuleTemplateName".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleProperties.alertRuleTemplateName = reader.getString(); + } else if ("enabled".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleProperties.enabled = reader.getBoolean(); + } else if ("description".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleProperties.description = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleProperties.displayName = reader.getString(); + } else if ("lastModifiedUtc".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleProperties.lastModifiedUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("severity".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleProperties.severity + = AlertSeverity.fromString(reader.getString()); + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedMLBehaviorAnalyticsAlertRuleProperties.tactics = tactics; + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedMLBehaviorAnalyticsAlertRuleProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedMLBehaviorAnalyticsAlertRuleProperties.subTechniques = subTechniques; + } else { + reader.skipChildren(); + } + } + + return deserializedMLBehaviorAnalyticsAlertRuleProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MLBehaviorAnalyticsAlertRuleTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MLBehaviorAnalyticsAlertRuleTemplateProperties.java new file mode 100644 index 000000000000..073754c32f1e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MLBehaviorAnalyticsAlertRuleTemplateProperties.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; +import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateWithMitreProperties; +import com.azure.resourcemanager.securityinsights.models.AlertSeverity; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.TemplateStatus; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * MLBehaviorAnalytics alert rule template properties. + */ +@Fluent +public final class MLBehaviorAnalyticsAlertRuleTemplateProperties extends AlertRuleTemplateWithMitreProperties { + /* + * The severity for alerts created by this alert rule. + */ + private AlertSeverity severity; + + /* + * The time that this alert rule template has been added. + */ + private OffsetDateTime createdDateUtc; + + /* + * The last time that this alert rule template has been updated. + */ + private OffsetDateTime lastUpdatedDateUtc; + + /** + * Creates an instance of MLBehaviorAnalyticsAlertRuleTemplateProperties class. + */ + public MLBehaviorAnalyticsAlertRuleTemplateProperties() { + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplateProperties object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplateProperties withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + @Override + public OffsetDateTime createdDateUtc() { + return this.createdDateUtc; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + @Override + public OffsetDateTime lastUpdatedDateUtc() { + return this.lastUpdatedDateUtc; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRuleTemplateProperties withTactics(List tactics) { + super.withTactics(tactics); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRuleTemplateProperties withTechniques(List techniques) { + super.withTechniques(techniques); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRuleTemplateProperties + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + super.withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRuleTemplateProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRuleTemplateProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRuleTemplateProperties + withRequiredDataConnectors(List requiredDataConnectors) { + super.withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRuleTemplateProperties withStatus(TemplateStatus status) { + super.withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (severity() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property severity in model MLBehaviorAnalyticsAlertRuleTemplateProperties")); + } + if (requiredDataConnectors() != null) { + requiredDataConnectors().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MLBehaviorAnalyticsAlertRuleTemplateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", alertRulesCreatedByTemplateCount()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeArrayField("requiredDataConnectors", requiredDataConnectors(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("status", status() == null ? null : status().toString()); + jsonWriter.writeArrayField("tactics", tactics(), + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("techniques", techniques(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MLBehaviorAnalyticsAlertRuleTemplateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MLBehaviorAnalyticsAlertRuleTemplateProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MLBehaviorAnalyticsAlertRuleTemplateProperties. + */ + public static MLBehaviorAnalyticsAlertRuleTemplateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MLBehaviorAnalyticsAlertRuleTemplateProperties deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties + = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertRulesCreatedByTemplateCount".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties + .withAlertRulesCreatedByTemplateCount(reader.getNullable(JsonReader::getInt)); + } else if ("lastUpdatedDateUTC".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties.lastUpdatedDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateUTC".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties.createdDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("description".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties.withDescription(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties.withDisplayName(reader.getString()); + } else if ("requiredDataConnectors".equals(fieldName)) { + List requiredDataConnectors + = reader.readArray(reader1 -> AlertRuleTemplateDataSource.fromJson(reader1)); + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties + .withRequiredDataConnectors(requiredDataConnectors); + } else if ("status".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties + .withStatus(TemplateStatus.fromString(reader.getString())); + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties.withTactics(tactics); + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties.withTechniques(techniques); + } else if ("severity".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties.severity + = AlertSeverity.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMLBehaviorAnalyticsAlertRuleTemplateProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/McasCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/McasCheckRequirementsProperties.java new file mode 100644 index 000000000000..e10cd8832bf0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/McasCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * MCAS (Microsoft Cloud App Security) requirements check properties. + */ +@Fluent +public final class McasCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of McasCheckRequirementsProperties class. + */ + public McasCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public McasCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model McasCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(McasCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of McasCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of McasCheckRequirementsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the McasCheckRequirementsProperties. + */ + public static McasCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + McasCheckRequirementsProperties deserializedMcasCheckRequirementsProperties + = new McasCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMcasCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMcasCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/McasDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/McasDataConnectorProperties.java index 1a31247f621e..6f3d749ae437 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/McasDataConnectorProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/McasDataConnectorProperties.java @@ -5,10 +5,11 @@ package com.azure.resourcemanager.securityinsights.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; import com.azure.resourcemanager.securityinsights.models.McasDataConnectorDataTypes; import java.io.IOException; @@ -16,12 +17,7 @@ * MCAS (Microsoft Cloud App Security) data connector properties. */ @Fluent -public final class McasDataConnectorProperties implements JsonSerializable { - /* - * The tenant id to connect to, and get the data from. - */ - private String tenantId; - +public final class McasDataConnectorProperties extends DataConnectorTenantId { /* * The available data types for the connector. */ @@ -33,26 +29,6 @@ public final class McasDataConnectorProperties implements JsonSerializable { + MdatpCheckRequirementsProperties deserializedMdatpCheckRequirementsProperties + = new MdatpCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMdatpCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMdatpCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MdatpDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MdatpDataConnectorProperties.java index 96c17372eca8..56d79cd2ca17 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MdatpDataConnectorProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MdatpDataConnectorProperties.java @@ -5,23 +5,19 @@ package com.azure.resourcemanager.securityinsights.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; import java.io.IOException; /** * MDATP (Microsoft Defender Advanced Threat Protection) data connector properties. */ @Fluent -public final class MdatpDataConnectorProperties implements JsonSerializable { - /* - * The tenant id to connect to, and get the data from. - */ - private String tenantId; - +public final class MdatpDataConnectorProperties extends DataConnectorTenantId { /* * The available data types for the connector. */ @@ -33,26 +29,6 @@ public final class MdatpDataConnectorProperties implements JsonSerializable providers() { + return this.innerProperties() == null ? null : this.innerProperties().providers(); + } + + /** + * Set the providers property: Providers for the solution content item. + * + * @param providers the providers value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withProviders(List providers) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withProviders(providers); + return this; + } + + /** + * Get the firstPublishDate property: first publish date solution content item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().firstPublishDate(); + } + + /** + * Set the firstPublishDate property: first publish date solution content item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withFirstPublishDate(LocalDate firstPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the solution content item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastPublishDate(); + } + + /** + * Set the lastPublishDate property: last publish date for the solution content item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withLastPublishDate(LocalDate lastPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withLastPublishDate(lastPublishDate); + return this; + } + + /** + * Get the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + public String customVersion() { + return this.innerProperties() == null ? null : this.innerProperties().customVersion(); + } + + /** + * Set the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion the customVersion value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withCustomVersion(String customVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withCustomVersion(customVersion); + return this; + } + + /** + * Get the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.innerProperties() == null ? null : this.innerProperties().contentSchemaVersion(); + } + + /** + * Set the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withContentSchemaVersion(String contentSchemaVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @return the icon value. + */ + public String icon() { + return this.innerProperties() == null ? null : this.innerProperties().icon(); + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @param icon the icon value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withIcon(String icon) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withIcon(icon); + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTactics(); + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withThreatAnalysisTactics(List threatAnalysisTactics) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTechniques(); + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withThreatAnalysisTechniques(List threatAnalysisTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * Get the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + public List previewImages() { + return this.innerProperties() == null ? null : this.innerProperties().previewImages(); + } + + /** + * Set the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @param previewImages the previewImages value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withPreviewImages(List previewImages) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withPreviewImages(previewImages); + return this; + } + + /** + * Get the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + public List previewImagesDark() { + return this.innerProperties() == null ? null : this.innerProperties().previewImagesDark(); + } + + /** + * Set the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @param previewImagesDark the previewImagesDark value to set. + * @return the MetadataModelInner object itself. + */ + public MetadataModelInner withPreviewImagesDark(List previewImagesDark) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataProperties(); + } + this.innerProperties().withPreviewImagesDark(previewImagesDark); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataModelInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetadataModelInner. + */ + public static MetadataModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataModelInner deserializedMetadataModelInner = new MetadataModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMetadataModelInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMetadataModelInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMetadataModelInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedMetadataModelInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedMetadataModelInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedMetadataModelInner.innerProperties = MetadataProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataModelInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MetadataProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MetadataProperties.java new file mode 100644 index 000000000000..c3debbd74a46 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MetadataProperties.java @@ -0,0 +1,668 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Metadata property bag. + */ +@Fluent +public final class MetadataProperties implements JsonSerializable { + /* + * Static ID for the content. Used to identify dependencies and content from solutions or community. + * Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the resource name + */ + private String contentId; + + /* + * Full parent resource ID of the content item the metadata is for. This is the full resource ID including the scope + * (subscription and resource group) + */ + private String parentId; + + /* + * Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM + * template best practices. Can also be any string, but then we cannot guarantee any version checks + */ + private String version; + + /* + * The kind of content the metadata is for. + */ + private String kind; + + /* + * Source of the content. This is where/how it was created. + */ + private MetadataSource source; + + /* + * The creator of the content item. + */ + private MetadataAuthor author; + + /* + * Support information for the metadata - type, name, contact information + */ + private MetadataSupport support; + + /* + * Dependencies for the content item, what other content items it requires to work. Can describe more complex + * dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or + * operator/criteria for complex formats. + */ + private MetadataDependencies dependencies; + + /* + * Categories for the solution content item + */ + private MetadataCategories categories; + + /* + * Providers for the solution content item + */ + private List providers; + + /* + * first publish date solution content item + */ + private LocalDate firstPublishDate; + + /* + * last publish date for the solution content item + */ + private LocalDate lastPublishDate; + + /* + * The custom version of the content. A optional free text + */ + private String customVersion; + + /* + * Schema version of the content. Can be used to distinguish between different flow based on the schema version + */ + private String contentSchemaVersion; + + /* + * the icon identifier. this id can later be fetched from the solution template + */ + private String icon; + + /* + * the tactics the resource covers + */ + private List threatAnalysisTactics; + + /* + * the techniques the resource covers, these have to be aligned with the tactics being used + */ + private List threatAnalysisTechniques; + + /* + * preview image file names. These will be taken from the solution artifacts + */ + private List previewImages; + + /* + * preview image file names. These will be taken from the solution artifacts. used for dark theme support + */ + private List previewImagesDark; + + /** + * Creates an instance of MetadataProperties class. + */ + public MetadataProperties() { + } + + /** + * Get the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + public String contentId() { + return this.contentId; + } + + /** + * Set the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @param contentId the contentId value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withContentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Get the parentId property: Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * + * @return the parentId value. + */ + public String parentId() { + return this.parentId; + } + + /** + * Set the parentId property: Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * + * @param parentId the parentId value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withParentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * Get the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @param version the version value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the kind property: The kind of content the metadata is for. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of content the metadata is for. + * + * @param kind the kind value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + public MetadataSource source() { + return this.source; + } + + /** + * Set the source property: Source of the content. This is where/how it was created. + * + * @param source the source value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withSource(MetadataSource source) { + this.source = source; + return this; + } + + /** + * Get the author property: The creator of the content item. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.author; + } + + /** + * Set the author property: The creator of the content item. + * + * @param author the author value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withAuthor(MetadataAuthor author) { + this.author = author; + return this; + } + + /** + * Get the support property: Support information for the metadata - type, name, contact information. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.support; + } + + /** + * Set the support property: Support information for the metadata - type, name, contact information. + * + * @param support the support value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withSupport(MetadataSupport support) { + this.support = support; + return this; + } + + /** + * Get the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.dependencies; + } + + /** + * Set the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @param dependencies the dependencies value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withDependencies(MetadataDependencies dependencies) { + this.dependencies = dependencies; + return this; + } + + /** + * Get the categories property: Categories for the solution content item. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.categories; + } + + /** + * Set the categories property: Categories for the solution content item. + * + * @param categories the categories value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withCategories(MetadataCategories categories) { + this.categories = categories; + return this; + } + + /** + * Get the providers property: Providers for the solution content item. + * + * @return the providers value. + */ + public List providers() { + return this.providers; + } + + /** + * Set the providers property: Providers for the solution content item. + * + * @param providers the providers value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withProviders(List providers) { + this.providers = providers; + return this; + } + + /** + * Get the firstPublishDate property: first publish date solution content item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.firstPublishDate; + } + + /** + * Set the firstPublishDate property: first publish date solution content item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withFirstPublishDate(LocalDate firstPublishDate) { + this.firstPublishDate = firstPublishDate; + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the solution content item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.lastPublishDate; + } + + /** + * Set the lastPublishDate property: last publish date for the solution content item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withLastPublishDate(LocalDate lastPublishDate) { + this.lastPublishDate = lastPublishDate; + return this; + } + + /** + * Get the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + public String customVersion() { + return this.customVersion; + } + + /** + * Set the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion the customVersion value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withCustomVersion(String customVersion) { + this.customVersion = customVersion; + return this; + } + + /** + * Get the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.contentSchemaVersion; + } + + /** + * Set the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withContentSchemaVersion(String contentSchemaVersion) { + this.contentSchemaVersion = contentSchemaVersion; + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @return the icon value. + */ + public String icon() { + return this.icon; + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @param icon the icon value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withIcon(String icon) { + this.icon = icon; + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.threatAnalysisTactics; + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withThreatAnalysisTactics(List threatAnalysisTactics) { + this.threatAnalysisTactics = threatAnalysisTactics; + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.threatAnalysisTechniques; + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withThreatAnalysisTechniques(List threatAnalysisTechniques) { + this.threatAnalysisTechniques = threatAnalysisTechniques; + return this; + } + + /** + * Get the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + public List previewImages() { + return this.previewImages; + } + + /** + * Set the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @param previewImages the previewImages value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withPreviewImages(List previewImages) { + this.previewImages = previewImages; + return this; + } + + /** + * Get the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + public List previewImagesDark() { + return this.previewImagesDark; + } + + /** + * Set the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @param previewImagesDark the previewImagesDark value to set. + * @return the MetadataProperties object itself. + */ + public MetadataProperties withPreviewImagesDark(List previewImagesDark) { + this.previewImagesDark = previewImagesDark; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parentId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property parentId in model MetadataProperties")); + } + if (kind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property kind in model MetadataProperties")); + } + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetadataProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("parentId", this.parentId); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("contentId", this.contentId); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeJsonField("source", this.source); + jsonWriter.writeJsonField("author", this.author); + jsonWriter.writeJsonField("support", this.support); + jsonWriter.writeJsonField("dependencies", this.dependencies); + jsonWriter.writeJsonField("categories", this.categories); + jsonWriter.writeArrayField("providers", this.providers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(this.firstPublishDate, null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(this.lastPublishDate, null)); + jsonWriter.writeStringField("customVersion", this.customVersion); + jsonWriter.writeStringField("contentSchemaVersion", this.contentSchemaVersion); + jsonWriter.writeStringField("icon", this.icon); + jsonWriter.writeArrayField("threatAnalysisTactics", this.threatAnalysisTactics, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", this.threatAnalysisTechniques, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImages", this.previewImages, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImagesDark", this.previewImagesDark, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetadataProperties. + */ + public static MetadataProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataProperties deserializedMetadataProperties = new MetadataProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("parentId".equals(fieldName)) { + deserializedMetadataProperties.parentId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedMetadataProperties.kind = reader.getString(); + } else if ("contentId".equals(fieldName)) { + deserializedMetadataProperties.contentId = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedMetadataProperties.version = reader.getString(); + } else if ("source".equals(fieldName)) { + deserializedMetadataProperties.source = MetadataSource.fromJson(reader); + } else if ("author".equals(fieldName)) { + deserializedMetadataProperties.author = MetadataAuthor.fromJson(reader); + } else if ("support".equals(fieldName)) { + deserializedMetadataProperties.support = MetadataSupport.fromJson(reader); + } else if ("dependencies".equals(fieldName)) { + deserializedMetadataProperties.dependencies = MetadataDependencies.fromJson(reader); + } else if ("categories".equals(fieldName)) { + deserializedMetadataProperties.categories = MetadataCategories.fromJson(reader); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataProperties.providers = providers; + } else if ("firstPublishDate".equals(fieldName)) { + deserializedMetadataProperties.firstPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedMetadataProperties.lastPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("customVersion".equals(fieldName)) { + deserializedMetadataProperties.customVersion = reader.getString(); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedMetadataProperties.contentSchemaVersion = reader.getString(); + } else if ("icon".equals(fieldName)) { + deserializedMetadataProperties.icon = reader.getString(); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataProperties.threatAnalysisTactics = threatAnalysisTactics; + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataProperties.threatAnalysisTechniques = threatAnalysisTechniques; + } else if ("previewImages".equals(fieldName)) { + List previewImages = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataProperties.previewImages = previewImages; + } else if ("previewImagesDark".equals(fieldName)) { + List previewImagesDark = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataProperties.previewImagesDark = previewImagesDark; + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MetadataPropertiesPatch.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MetadataPropertiesPatch.java new file mode 100644 index 000000000000..71982af74a84 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MetadataPropertiesPatch.java @@ -0,0 +1,656 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Metadata property bag for patch requests. This is the same as the MetadataProperties, but with nothing required. + */ +@Fluent +public final class MetadataPropertiesPatch implements JsonSerializable { + /* + * Static ID for the content. Used to identify dependencies and content from solutions or community. + * Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the resource name + */ + private String contentId; + + /* + * Full parent resource ID of the content item the metadata is for. This is the full resource ID including the scope + * (subscription and resource group) + */ + private String parentId; + + /* + * Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM + * template best practices. Can also be any string, but then we cannot guarantee any version checks + */ + private String version; + + /* + * The kind of content the metadata is for. + */ + private String kind; + + /* + * Source of the content. This is where/how it was created. + */ + private MetadataSource source; + + /* + * The creator of the content item. + */ + private MetadataAuthor author; + + /* + * Support information for the metadata - type, name, contact information + */ + private MetadataSupport support; + + /* + * Dependencies for the content item, what other content items it requires to work. Can describe more complex + * dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or + * operator/criteria for complex formats. + */ + private MetadataDependencies dependencies; + + /* + * Categories for the solution content item + */ + private MetadataCategories categories; + + /* + * Providers for the solution content item + */ + private List providers; + + /* + * first publish date solution content item + */ + private LocalDate firstPublishDate; + + /* + * last publish date for the solution content item + */ + private LocalDate lastPublishDate; + + /* + * The custom version of the content. A optional free text + */ + private String customVersion; + + /* + * Schema version of the content. Can be used to distinguish between different flow based on the schema version + */ + private String contentSchemaVersion; + + /* + * the icon identifier. this id can later be fetched from the solution template + */ + private String icon; + + /* + * the tactics the resource covers + */ + private List threatAnalysisTactics; + + /* + * the techniques the resource covers, these have to be aligned with the tactics being used + */ + private List threatAnalysisTechniques; + + /* + * preview image file names. These will be taken from the solution artifacts + */ + private List previewImages; + + /* + * preview image file names. These will be taken from the solution artifacts. used for dark theme support + */ + private List previewImagesDark; + + /** + * Creates an instance of MetadataPropertiesPatch class. + */ + public MetadataPropertiesPatch() { + } + + /** + * Get the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + public String contentId() { + return this.contentId; + } + + /** + * Set the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @param contentId the contentId value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withContentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Get the parentId property: Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * + * @return the parentId value. + */ + public String parentId() { + return this.parentId; + } + + /** + * Set the parentId property: Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * + * @param parentId the parentId value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withParentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * Get the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @param version the version value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the kind property: The kind of content the metadata is for. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of content the metadata is for. + * + * @param kind the kind value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + public MetadataSource source() { + return this.source; + } + + /** + * Set the source property: Source of the content. This is where/how it was created. + * + * @param source the source value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withSource(MetadataSource source) { + this.source = source; + return this; + } + + /** + * Get the author property: The creator of the content item. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.author; + } + + /** + * Set the author property: The creator of the content item. + * + * @param author the author value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withAuthor(MetadataAuthor author) { + this.author = author; + return this; + } + + /** + * Get the support property: Support information for the metadata - type, name, contact information. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.support; + } + + /** + * Set the support property: Support information for the metadata - type, name, contact information. + * + * @param support the support value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withSupport(MetadataSupport support) { + this.support = support; + return this; + } + + /** + * Get the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.dependencies; + } + + /** + * Set the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @param dependencies the dependencies value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withDependencies(MetadataDependencies dependencies) { + this.dependencies = dependencies; + return this; + } + + /** + * Get the categories property: Categories for the solution content item. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.categories; + } + + /** + * Set the categories property: Categories for the solution content item. + * + * @param categories the categories value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withCategories(MetadataCategories categories) { + this.categories = categories; + return this; + } + + /** + * Get the providers property: Providers for the solution content item. + * + * @return the providers value. + */ + public List providers() { + return this.providers; + } + + /** + * Set the providers property: Providers for the solution content item. + * + * @param providers the providers value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withProviders(List providers) { + this.providers = providers; + return this; + } + + /** + * Get the firstPublishDate property: first publish date solution content item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.firstPublishDate; + } + + /** + * Set the firstPublishDate property: first publish date solution content item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withFirstPublishDate(LocalDate firstPublishDate) { + this.firstPublishDate = firstPublishDate; + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the solution content item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.lastPublishDate; + } + + /** + * Set the lastPublishDate property: last publish date for the solution content item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withLastPublishDate(LocalDate lastPublishDate) { + this.lastPublishDate = lastPublishDate; + return this; + } + + /** + * Get the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + public String customVersion() { + return this.customVersion; + } + + /** + * Set the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion the customVersion value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withCustomVersion(String customVersion) { + this.customVersion = customVersion; + return this; + } + + /** + * Get the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.contentSchemaVersion; + } + + /** + * Set the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withContentSchemaVersion(String contentSchemaVersion) { + this.contentSchemaVersion = contentSchemaVersion; + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @return the icon value. + */ + public String icon() { + return this.icon; + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @param icon the icon value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withIcon(String icon) { + this.icon = icon; + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.threatAnalysisTactics; + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withThreatAnalysisTactics(List threatAnalysisTactics) { + this.threatAnalysisTactics = threatAnalysisTactics; + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.threatAnalysisTechniques; + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withThreatAnalysisTechniques(List threatAnalysisTechniques) { + this.threatAnalysisTechniques = threatAnalysisTechniques; + return this; + } + + /** + * Get the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + public List previewImages() { + return this.previewImages; + } + + /** + * Set the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @param previewImages the previewImages value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withPreviewImages(List previewImages) { + this.previewImages = previewImages; + return this; + } + + /** + * Get the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + public List previewImagesDark() { + return this.previewImagesDark; + } + + /** + * Set the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @param previewImagesDark the previewImagesDark value to set. + * @return the MetadataPropertiesPatch object itself. + */ + public MetadataPropertiesPatch withPreviewImagesDark(List previewImagesDark) { + this.previewImagesDark = previewImagesDark; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", this.contentId); + jsonWriter.writeStringField("parentId", this.parentId); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeJsonField("source", this.source); + jsonWriter.writeJsonField("author", this.author); + jsonWriter.writeJsonField("support", this.support); + jsonWriter.writeJsonField("dependencies", this.dependencies); + jsonWriter.writeJsonField("categories", this.categories); + jsonWriter.writeArrayField("providers", this.providers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(this.firstPublishDate, null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(this.lastPublishDate, null)); + jsonWriter.writeStringField("customVersion", this.customVersion); + jsonWriter.writeStringField("contentSchemaVersion", this.contentSchemaVersion); + jsonWriter.writeStringField("icon", this.icon); + jsonWriter.writeArrayField("threatAnalysisTactics", this.threatAnalysisTactics, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", this.threatAnalysisTechniques, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImages", this.previewImages, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImagesDark", this.previewImagesDark, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataPropertiesPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataPropertiesPatch if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MetadataPropertiesPatch. + */ + public static MetadataPropertiesPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataPropertiesPatch deserializedMetadataPropertiesPatch = new MetadataPropertiesPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedMetadataPropertiesPatch.contentId = reader.getString(); + } else if ("parentId".equals(fieldName)) { + deserializedMetadataPropertiesPatch.parentId = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedMetadataPropertiesPatch.version = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedMetadataPropertiesPatch.kind = reader.getString(); + } else if ("source".equals(fieldName)) { + deserializedMetadataPropertiesPatch.source = MetadataSource.fromJson(reader); + } else if ("author".equals(fieldName)) { + deserializedMetadataPropertiesPatch.author = MetadataAuthor.fromJson(reader); + } else if ("support".equals(fieldName)) { + deserializedMetadataPropertiesPatch.support = MetadataSupport.fromJson(reader); + } else if ("dependencies".equals(fieldName)) { + deserializedMetadataPropertiesPatch.dependencies = MetadataDependencies.fromJson(reader); + } else if ("categories".equals(fieldName)) { + deserializedMetadataPropertiesPatch.categories = MetadataCategories.fromJson(reader); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataPropertiesPatch.providers = providers; + } else if ("firstPublishDate".equals(fieldName)) { + deserializedMetadataPropertiesPatch.firstPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedMetadataPropertiesPatch.lastPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("customVersion".equals(fieldName)) { + deserializedMetadataPropertiesPatch.customVersion = reader.getString(); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedMetadataPropertiesPatch.contentSchemaVersion = reader.getString(); + } else if ("icon".equals(fieldName)) { + deserializedMetadataPropertiesPatch.icon = reader.getString(); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataPropertiesPatch.threatAnalysisTactics = threatAnalysisTactics; + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataPropertiesPatch.threatAnalysisTechniques = threatAnalysisTechniques; + } else if ("previewImages".equals(fieldName)) { + List previewImages = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataPropertiesPatch.previewImages = previewImages; + } else if ("previewImagesDark".equals(fieldName)) { + List previewImagesDark = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataPropertiesPatch.previewImagesDark = previewImagesDark; + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataPropertiesPatch; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftPurviewInformationProtectionCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftPurviewInformationProtectionCheckRequirementsProperties.java new file mode 100644 index 000000000000..cd7b71db1280 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftPurviewInformationProtectionCheckRequirementsProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * MicrosoftPurviewInformationProtection requirements check properties. + */ +@Fluent +public final class MicrosoftPurviewInformationProtectionCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of MicrosoftPurviewInformationProtectionCheckRequirementsProperties class. + */ + public MicrosoftPurviewInformationProtectionCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftPurviewInformationProtectionCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model MicrosoftPurviewInformationProtectionCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(MicrosoftPurviewInformationProtectionCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftPurviewInformationProtectionCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftPurviewInformationProtectionCheckRequirementsProperties if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the + * MicrosoftPurviewInformationProtectionCheckRequirementsProperties. + */ + public static MicrosoftPurviewInformationProtectionCheckRequirementsProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftPurviewInformationProtectionCheckRequirementsProperties deserializedMicrosoftPurviewInformationProtectionCheckRequirementsProperties + = new MicrosoftPurviewInformationProtectionCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionCheckRequirementsProperties + .withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftPurviewInformationProtectionCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftPurviewInformationProtectionDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftPurviewInformationProtectionDataConnectorProperties.java new file mode 100644 index 000000000000..4042da08591c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftPurviewInformationProtectionDataConnectorProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionConnectorDataTypes; +import java.io.IOException; + +/** + * Microsoft Purview Information Protection data connector properties. + */ +@Fluent +public final class MicrosoftPurviewInformationProtectionDataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private MicrosoftPurviewInformationProtectionConnectorDataTypes dataTypes; + + /** + * Creates an instance of MicrosoftPurviewInformationProtectionDataConnectorProperties class. + */ + public MicrosoftPurviewInformationProtectionDataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public MicrosoftPurviewInformationProtectionConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the MicrosoftPurviewInformationProtectionDataConnectorProperties object itself. + */ + public MicrosoftPurviewInformationProtectionDataConnectorProperties + withDataTypes(MicrosoftPurviewInformationProtectionConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftPurviewInformationProtectionDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model MicrosoftPurviewInformationProtectionDataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model MicrosoftPurviewInformationProtectionDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(MicrosoftPurviewInformationProtectionDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftPurviewInformationProtectionDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftPurviewInformationProtectionDataConnectorProperties if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the + * MicrosoftPurviewInformationProtectionDataConnectorProperties. + */ + public static MicrosoftPurviewInformationProtectionDataConnectorProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftPurviewInformationProtectionDataConnectorProperties deserializedMicrosoftPurviewInformationProtectionDataConnectorProperties + = new MicrosoftPurviewInformationProtectionDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnectorProperties + .withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnectorProperties.dataTypes + = MicrosoftPurviewInformationProtectionConnectorDataTypes.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftPurviewInformationProtectionDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.java index 3c26c7967755..c7fc9f4fd3d2 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.java @@ -6,12 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; +import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplatePropertiesBase; import com.azure.resourcemanager.securityinsights.models.AlertSeverity; import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; import com.azure.resourcemanager.securityinsights.models.TemplateStatus; @@ -24,42 +23,7 @@ */ @Fluent public final class MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties - implements JsonSerializable { - /* - * the number of alert rules that were created by this template - */ - private Integer alertRulesCreatedByTemplateCount; - - /* - * The time that this alert rule template has been added. - */ - private OffsetDateTime createdDateUtc; - - /* - * The time that this alert rule template was last updated. - */ - private OffsetDateTime lastUpdatedDateUtc; - - /* - * The description of the alert rule template. - */ - private String description; - - /* - * The display name for alert rule template. - */ - private String displayName; - - /* - * The required data connectors for this template - */ - private List requiredDataConnectors; - - /* - * The alert rule template status. - */ - private TemplateStatus status; - + extends AlertRuleTemplatePropertiesBase { /* * the alerts' displayNames on which the cases will be generated */ @@ -80,130 +44,20 @@ public final class MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties */ private List severitiesFilter; - /** - * Creates an instance of MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties class. - */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties() { - } - - /** - * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. - * - * @return the alertRulesCreatedByTemplateCount value. - */ - public Integer alertRulesCreatedByTemplateCount() { - return this.alertRulesCreatedByTemplateCount; - } - - /** - * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. - * - * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set. - * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties object itself. - */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties - withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { - this.alertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; - return this; - } - - /** - * Get the createdDateUtc property: The time that this alert rule template has been added. - * - * @return the createdDateUtc value. - */ - public OffsetDateTime createdDateUtc() { - return this.createdDateUtc; - } - - /** - * Get the lastUpdatedDateUtc property: The time that this alert rule template was last updated. - * - * @return the lastUpdatedDateUtc value. - */ - public OffsetDateTime lastUpdatedDateUtc() { - return this.lastUpdatedDateUtc; - } - - /** - * Get the description property: The description of the alert rule template. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of the alert rule template. - * - * @param description the description value to set. - * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties object itself. - */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the displayName property: The display name for alert rule template. - * - * @return the displayName value. - */ - public String displayName() { - return this.displayName; - } - - /** - * Set the displayName property: The display name for alert rule template. - * - * @param displayName the displayName value to set. - * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties object itself. - */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties withDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Get the requiredDataConnectors property: The required data connectors for this template. - * - * @return the requiredDataConnectors value. - */ - public List requiredDataConnectors() { - return this.requiredDataConnectors; - } - - /** - * Set the requiredDataConnectors property: The required data connectors for this template. - * - * @param requiredDataConnectors the requiredDataConnectors value to set. - * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties object itself. + /* + * The time that this alert rule template has been added. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties - withRequiredDataConnectors(List requiredDataConnectors) { - this.requiredDataConnectors = requiredDataConnectors; - return this; - } + private OffsetDateTime createdDateUtc; - /** - * Get the status property: The alert rule template status. - * - * @return the status value. + /* + * The last time that this alert rule template has been updated. */ - public TemplateStatus status() { - return this.status; - } + private OffsetDateTime lastUpdatedDateUtc; /** - * Set the status property: The alert rule template status. - * - * @param status the status value to set. - * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties object itself. + * Creates an instance of MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties class. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties withStatus(TemplateStatus status) { - this.status = status; - return this; + public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties() { } /** @@ -290,42 +144,102 @@ public List severitiesFilter() { return this; } + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + @Override + public OffsetDateTime createdDateUtc() { + return this.createdDateUtc; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + @Override + public OffsetDateTime lastUpdatedDateUtc() { + return this.lastUpdatedDateUtc; + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + super.withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + withRequiredDataConnectors(List requiredDataConnectors) { + super.withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties withStatus(TemplateStatus status) { + super.withStatus(status); + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { if (requiredDataConnectors() != null) { requiredDataConnectors().forEach(e -> e.validate()); } - if (productFilter() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property productFilter in model MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties")); - } } - private static final ClientLogger LOGGER - = new ClientLogger(MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.class); - /** * {@inheritDoc} */ @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("productFilter", this.productFilter == null ? null : this.productFilter.toString()); - jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", this.alertRulesCreatedByTemplateCount); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeStringField("displayName", this.displayName); - jsonWriter.writeArrayField("requiredDataConnectors", this.requiredDataConnectors, + jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", alertRulesCreatedByTemplateCount()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeArrayField("requiredDataConnectors", requiredDataConnectors(), (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("status", status() == null ? null : status().toString()); jsonWriter.writeArrayField("displayNamesFilter", this.displayNamesFilter, (writer, element) -> writer.writeString(element)); jsonWriter.writeArrayField("displayNamesExcludeFilter", this.displayNamesExcludeFilter, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("productFilter", this.productFilter == null ? null : this.productFilter.toString()); jsonWriter.writeArrayField("severitiesFilter", this.severitiesFilter, (writer, element) -> writer.writeString(element == null ? null : element.toString())); return jsonWriter.writeEndObject(); @@ -337,7 +251,6 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties if the JsonReader was * pointing to an instance of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the * MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. */ @@ -350,32 +263,29 @@ public static MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties fromJ String fieldName = reader.getFieldName(); reader.nextToken(); - if ("productFilter".equals(fieldName)) { - deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.productFilter - = MicrosoftSecurityProductName.fromString(reader.getString()); - } else if ("alertRulesCreatedByTemplateCount".equals(fieldName)) { - deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.alertRulesCreatedByTemplateCount - = reader.getNullable(JsonReader::getInt); - } else if ("createdDateUTC".equals(fieldName)) { - deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.createdDateUtc = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + if ("alertRulesCreatedByTemplateCount".equals(fieldName)) { + deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + .withAlertRulesCreatedByTemplateCount(reader.getNullable(JsonReader::getInt)); } else if ("lastUpdatedDateUTC".equals(fieldName)) { deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.lastUpdatedDateUtc = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateUTC".equals(fieldName)) { + deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.createdDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("description".equals(fieldName)) { - deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.description - = reader.getString(); + deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + .withDescription(reader.getString()); } else if ("displayName".equals(fieldName)) { - deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.displayName - = reader.getString(); + deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + .withDisplayName(reader.getString()); } else if ("requiredDataConnectors".equals(fieldName)) { List requiredDataConnectors = reader.readArray(reader1 -> AlertRuleTemplateDataSource.fromJson(reader1)); - deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.requiredDataConnectors - = requiredDataConnectors; + deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + .withRequiredDataConnectors(requiredDataConnectors); } else if ("status".equals(fieldName)) { - deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.status - = TemplateStatus.fromString(reader.getString()); + deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + .withStatus(TemplateStatus.fromString(reader.getString())); } else if ("displayNamesFilter".equals(fieldName)) { List displayNamesFilter = reader.readArray(reader1 -> reader1.getString()); deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.displayNamesFilter @@ -384,6 +294,9 @@ public static MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties fromJ List displayNamesExcludeFilter = reader.readArray(reader1 -> reader1.getString()); deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.displayNamesExcludeFilter = displayNamesExcludeFilter; + } else if ("productFilter".equals(fieldName)) { + deserializedMicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.productFilter + = MicrosoftSecurityProductName.fromString(reader.getString()); } else if ("severitiesFilter".equals(fieldName)) { List severitiesFilter = reader.readArray(reader1 -> AlertSeverity.fromString(reader1.getString())); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MstiCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MstiCheckRequirementsProperties.java new file mode 100644 index 000000000000..feb48a30b4a6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MstiCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * Microsoft Threat Intelligence requirements check properties. + */ +@Fluent +public final class MstiCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of MstiCheckRequirementsProperties class. + */ + public MstiCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public MstiCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model MstiCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MstiCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MstiCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MstiCheckRequirementsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MstiCheckRequirementsProperties. + */ + public static MstiCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MstiCheckRequirementsProperties deserializedMstiCheckRequirementsProperties + = new MstiCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMstiCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMstiCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MstiDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MstiDataConnectorProperties.java new file mode 100644 index 000000000000..a57f1d270d5e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MstiDataConnectorProperties.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnectorDataTypes; +import java.io.IOException; + +/** + * Microsoft Threat Intelligence data connector properties. + */ +@Fluent +public final class MstiDataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private MstiDataConnectorDataTypes dataTypes; + + /** + * Creates an instance of MstiDataConnectorProperties class. + */ + public MstiDataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public MstiDataConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the MstiDataConnectorProperties object itself. + */ + public MstiDataConnectorProperties withDataTypes(MstiDataConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MstiDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model MstiDataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model MstiDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MstiDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MstiDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MstiDataConnectorProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MstiDataConnectorProperties. + */ + public static MstiDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MstiDataConnectorProperties deserializedMstiDataConnectorProperties = new MstiDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMstiDataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedMstiDataConnectorProperties.dataTypes = MstiDataConnectorDataTypes.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMstiDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MtpCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MtpCheckRequirementsProperties.java new file mode 100644 index 000000000000..c4f70f3ac010 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MtpCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * MTP (Microsoft Threat Protection) requirements check properties. + */ +@Fluent +public final class MtpCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of MtpCheckRequirementsProperties class. + */ + public MtpCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public MtpCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model MtpCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MtpCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpCheckRequirementsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MtpCheckRequirementsProperties. + */ + public static MtpCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpCheckRequirementsProperties deserializedMtpCheckRequirementsProperties + = new MtpCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMtpCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMtpCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MtpDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MtpDataConnectorProperties.java new file mode 100644 index 000000000000..873eea7d79d9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/MtpDataConnectorProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.MtpFilteredProviders; +import java.io.IOException; + +/** + * MTP (Microsoft Threat Protection) data connector properties. + */ +@Fluent +public final class MtpDataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private MtpDataConnectorDataTypes dataTypes; + + /* + * The available filtered providers for the connector. + */ + private MtpFilteredProviders filteredProviders; + + /** + * Creates an instance of MtpDataConnectorProperties class. + */ + public MtpDataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public MtpDataConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the MtpDataConnectorProperties object itself. + */ + public MtpDataConnectorProperties withDataTypes(MtpDataConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * Get the filteredProviders property: The available filtered providers for the connector. + * + * @return the filteredProviders value. + */ + public MtpFilteredProviders filteredProviders() { + return this.filteredProviders; + } + + /** + * Set the filteredProviders property: The available filtered providers for the connector. + * + * @param filteredProviders the filteredProviders value to set. + * @return the MtpDataConnectorProperties object itself. + */ + public MtpDataConnectorProperties withFilteredProviders(MtpFilteredProviders filteredProviders) { + this.filteredProviders = filteredProviders; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MtpDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model MtpDataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (filteredProviders() != null) { + filteredProviders().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model MtpDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MtpDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + jsonWriter.writeJsonField("filteredProviders", this.filteredProviders); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpDataConnectorProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MtpDataConnectorProperties. + */ + public static MtpDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpDataConnectorProperties deserializedMtpDataConnectorProperties = new MtpDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedMtpDataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedMtpDataConnectorProperties.dataTypes = MtpDataConnectorDataTypes.fromJson(reader); + } else if ("filteredProviders".equals(fieldName)) { + deserializedMtpDataConnectorProperties.filteredProviders = MtpFilteredProviders.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMtpDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NicEntityProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NicEntityProperties.java new file mode 100644 index 000000000000..a2d3ba3be77a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NicEntityProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.EntityCommonProperties; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Nic entity property bag. + */ +@Immutable +public final class NicEntityProperties extends EntityCommonProperties { + /* + * The MAC address of this network interface + */ + private String macAddress; + + /* + * The IP entity id of this network interface + */ + private String ipAddressEntityId; + + /* + * A list of VLANs of the network interface entity. + */ + private List vlans; + + /* + * The graph item display name which is a short humanly readable description of the graph item instance. This + * property is optional and might be system generated. + */ + private String friendlyName; + + /* + * A bag of custom fields that should be part of the entity and will be presented to the user. + */ + private Map additionalData; + + /** + * Creates an instance of NicEntityProperties class. + */ + public NicEntityProperties() { + } + + /** + * Get the macAddress property: The MAC address of this network interface. + * + * @return the macAddress value. + */ + public String macAddress() { + return this.macAddress; + } + + /** + * Get the ipAddressEntityId property: The IP entity id of this network interface. + * + * @return the ipAddressEntityId value. + */ + public String ipAddressEntityId() { + return this.ipAddressEntityId; + } + + /** + * Get the vlans property: A list of VLANs of the network interface entity. + * + * @return the vlans value. + */ + public List vlans() { + return this.vlans; + } + + /** + * Get the friendlyName property: The graph item display name which is a short humanly readable description of the + * graph item instance. This property is optional and might be system generated. + * + * @return the friendlyName value. + */ + @Override + public String friendlyName() { + return this.friendlyName; + } + + /** + * Get the additionalData property: A bag of custom fields that should be part of the entity and will be presented + * to the user. + * + * @return the additionalData value. + */ + @Override + public Map additionalData() { + return this.additionalData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NicEntityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NicEntityProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the NicEntityProperties. + */ + public static NicEntityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NicEntityProperties deserializedNicEntityProperties = new NicEntityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("additionalData".equals(fieldName)) { + Map additionalData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedNicEntityProperties.additionalData = additionalData; + } else if ("friendlyName".equals(fieldName)) { + deserializedNicEntityProperties.friendlyName = reader.getString(); + } else if ("macAddress".equals(fieldName)) { + deserializedNicEntityProperties.macAddress = reader.getString(); + } else if ("ipAddressEntityId".equals(fieldName)) { + deserializedNicEntityProperties.ipAddressEntityId = reader.getString(); + } else if ("vlans".equals(fieldName)) { + List vlans = reader.readArray(reader1 -> reader1.getString()); + deserializedNicEntityProperties.vlans = vlans; + } else { + reader.skipChildren(); + } + } + + return deserializedNicEntityProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NrtAlertRuleProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NrtAlertRuleProperties.java new file mode 100644 index 000000000000..ee732cb796bc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NrtAlertRuleProperties.java @@ -0,0 +1,659 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; +import com.azure.resourcemanager.securityinsights.models.AlertSeverity; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.EntityMapping; +import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; +import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; +import com.azure.resourcemanager.securityinsights.models.SentinelEntityMapping; +import java.io.IOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Nrt alert rule base property bag. + */ +@Fluent +public final class NrtAlertRuleProperties implements JsonSerializable { + /* + * The Name of the alert rule template used to create this rule. + */ + private String alertRuleTemplateName; + + /* + * The version of the alert rule template used to create this rule - in format , where all are numbers, for + * example 0 <1.0.2> + */ + private String templateVersion; + + /* + * The description of the alert rule. + */ + private String description; + + /* + * The query that creates alerts for this rule. + */ + private String query; + + /* + * The tactics of the alert rule + */ + private List tactics; + + /* + * The techniques of the alert rule + */ + private List techniques; + + /* + * The sub-techniques of the alert rule + */ + private List subTechniques; + + /* + * The display name for alerts created by this alert rule. + */ + private String displayName; + + /* + * Determines whether this alert rule is enabled or disabled. + */ + private boolean enabled; + + /* + * The last time that this alert rule has been modified. + */ + private OffsetDateTime lastModifiedUtc; + + /* + * The suppression (in ISO 8601 duration format) to wait since last time this alert rule been triggered. + */ + private Duration suppressionDuration; + + /* + * Determines whether the suppression for this alert rule is enabled or disabled. + */ + private boolean suppressionEnabled; + + /* + * The severity for alerts created by this alert rule. + */ + private AlertSeverity severity; + + /* + * The settings of the incidents that created from alerts triggered by this analytics rule + */ + private IncidentConfiguration incidentConfiguration; + + /* + * Dictionary of string key-value pairs of columns to be attached to the alert + */ + private Map customDetails; + + /* + * Array of the entity mappings of the alert rule + */ + private List entityMappings; + + /* + * The alert details override settings + */ + private AlertDetailsOverride alertDetailsOverride; + + /* + * The event grouping settings. + */ + private EventGroupingSettings eventGroupingSettings; + + /* + * Array of the sentinel entity mappings of the alert rule + */ + private List sentinelEntitiesMappings; + + /** + * Creates an instance of NrtAlertRuleProperties class. + */ + public NrtAlertRuleProperties() { + } + + /** + * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @return the alertRuleTemplateName value. + */ + public String alertRuleTemplateName() { + return this.alertRuleTemplateName; + } + + /** + * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @param alertRuleTemplateName the alertRuleTemplateName value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withAlertRuleTemplateName(String alertRuleTemplateName) { + this.alertRuleTemplateName = alertRuleTemplateName; + return this; + } + + /** + * Get the templateVersion property: The version of the alert rule template used to create this rule - in format + * <a.b.c>, where all are numbers, for example 0 <1.0.2>. + * + * @return the templateVersion value. + */ + public String templateVersion() { + return this.templateVersion; + } + + /** + * Set the templateVersion property: The version of the alert rule template used to create this rule - in format + * <a.b.c>, where all are numbers, for example 0 <1.0.2>. + * + * @param templateVersion the templateVersion value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withTemplateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Get the description property: The description of the alert rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the alert rule. + * + * @param description the description value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the query property: The query that creates alerts for this rule. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The query that creates alerts for this rule. + * + * @param query the query value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.tactics; + } + + /** + * Set the tactics property: The tactics of the alert rule. + * + * @param tactics the tactics value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withTactics(List tactics) { + this.tactics = tactics; + return this; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Set the techniques property: The techniques of the alert rule. + * + * @param techniques the techniques value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withTechniques(List techniques) { + this.techniques = techniques; + return this; + } + + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.subTechniques; + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withSubTechniques(List subTechniques) { + this.subTechniques = subTechniques; + return this; + } + + /** + * Get the displayName property: The display name for alerts created by this alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name for alerts created by this alert rule. + * + * @param displayName the displayName value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the lastModifiedUtc property: The last time that this alert rule has been modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Get the suppressionDuration property: The suppression (in ISO 8601 duration format) to wait since last time this + * alert rule been triggered. + * + * @return the suppressionDuration value. + */ + public Duration suppressionDuration() { + return this.suppressionDuration; + } + + /** + * Set the suppressionDuration property: The suppression (in ISO 8601 duration format) to wait since last time this + * alert rule been triggered. + * + * @param suppressionDuration the suppressionDuration value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withSuppressionDuration(Duration suppressionDuration) { + this.suppressionDuration = suppressionDuration; + return this; + } + + /** + * Get the suppressionEnabled property: Determines whether the suppression for this alert rule is enabled or + * disabled. + * + * @return the suppressionEnabled value. + */ + public boolean suppressionEnabled() { + return this.suppressionEnabled; + } + + /** + * Set the suppressionEnabled property: Determines whether the suppression for this alert rule is enabled or + * disabled. + * + * @param suppressionEnabled the suppressionEnabled value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withSuppressionEnabled(boolean suppressionEnabled) { + this.suppressionEnabled = suppressionEnabled; + return this; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this + * analytics rule. + * + * @return the incidentConfiguration value. + */ + public IncidentConfiguration incidentConfiguration() { + return this.incidentConfiguration; + } + + /** + * Set the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this + * analytics rule. + * + * @param incidentConfiguration the incidentConfiguration value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withIncidentConfiguration(IncidentConfiguration incidentConfiguration) { + this.incidentConfiguration = incidentConfiguration; + return this; + } + + /** + * Get the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @return the customDetails value. + */ + public Map customDetails() { + return this.customDetails; + } + + /** + * Set the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @param customDetails the customDetails value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withCustomDetails(Map customDetails) { + this.customDetails = customDetails; + return this; + } + + /** + * Get the entityMappings property: Array of the entity mappings of the alert rule. + * + * @return the entityMappings value. + */ + public List entityMappings() { + return this.entityMappings; + } + + /** + * Set the entityMappings property: Array of the entity mappings of the alert rule. + * + * @param entityMappings the entityMappings value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withEntityMappings(List entityMappings) { + this.entityMappings = entityMappings; + return this; + } + + /** + * Get the alertDetailsOverride property: The alert details override settings. + * + * @return the alertDetailsOverride value. + */ + public AlertDetailsOverride alertDetailsOverride() { + return this.alertDetailsOverride; + } + + /** + * Set the alertDetailsOverride property: The alert details override settings. + * + * @param alertDetailsOverride the alertDetailsOverride value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withAlertDetailsOverride(AlertDetailsOverride alertDetailsOverride) { + this.alertDetailsOverride = alertDetailsOverride; + return this; + } + + /** + * Get the eventGroupingSettings property: The event grouping settings. + * + * @return the eventGroupingSettings value. + */ + public EventGroupingSettings eventGroupingSettings() { + return this.eventGroupingSettings; + } + + /** + * Set the eventGroupingSettings property: The event grouping settings. + * + * @param eventGroupingSettings the eventGroupingSettings value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withEventGroupingSettings(EventGroupingSettings eventGroupingSettings) { + this.eventGroupingSettings = eventGroupingSettings; + return this; + } + + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.sentinelEntitiesMappings; + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the NrtAlertRuleProperties object itself. + */ + public NrtAlertRuleProperties withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + this.sentinelEntitiesMappings = sentinelEntitiesMappings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (query() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property query in model NrtAlertRuleProperties")); + } + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property displayName in model NrtAlertRuleProperties")); + } + if (suppressionDuration() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property suppressionDuration in model NrtAlertRuleProperties")); + } + if (severity() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property severity in model NrtAlertRuleProperties")); + } + if (incidentConfiguration() != null) { + incidentConfiguration().validate(); + } + if (entityMappings() != null) { + entityMappings().forEach(e -> e.validate()); + } + if (alertDetailsOverride() != null) { + alertDetailsOverride().validate(); + } + if (eventGroupingSettings() != null) { + eventGroupingSettings().validate(); + } + if (sentinelEntitiesMappings() != null) { + sentinelEntitiesMappings().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NrtAlertRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("suppressionDuration", + CoreUtils.durationToStringWithDays(this.suppressionDuration)); + jsonWriter.writeBooleanField("suppressionEnabled", this.suppressionEnabled); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("alertRuleTemplateName", this.alertRuleTemplateName); + jsonWriter.writeStringField("templateVersion", this.templateVersion); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("tactics", this.tactics, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("subTechniques", this.subTechniques, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("incidentConfiguration", this.incidentConfiguration); + jsonWriter.writeMapField("customDetails", this.customDetails, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("entityMappings", this.entityMappings, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("alertDetailsOverride", this.alertDetailsOverride); + jsonWriter.writeJsonField("eventGroupingSettings", this.eventGroupingSettings); + jsonWriter.writeArrayField("sentinelEntitiesMappings", this.sentinelEntitiesMappings, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NrtAlertRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NrtAlertRuleProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NrtAlertRuleProperties. + */ + public static NrtAlertRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NrtAlertRuleProperties deserializedNrtAlertRuleProperties = new NrtAlertRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("query".equals(fieldName)) { + deserializedNrtAlertRuleProperties.query = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedNrtAlertRuleProperties.displayName = reader.getString(); + } else if ("enabled".equals(fieldName)) { + deserializedNrtAlertRuleProperties.enabled = reader.getBoolean(); + } else if ("suppressionDuration".equals(fieldName)) { + deserializedNrtAlertRuleProperties.suppressionDuration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("suppressionEnabled".equals(fieldName)) { + deserializedNrtAlertRuleProperties.suppressionEnabled = reader.getBoolean(); + } else if ("severity".equals(fieldName)) { + deserializedNrtAlertRuleProperties.severity = AlertSeverity.fromString(reader.getString()); + } else if ("alertRuleTemplateName".equals(fieldName)) { + deserializedNrtAlertRuleProperties.alertRuleTemplateName = reader.getString(); + } else if ("templateVersion".equals(fieldName)) { + deserializedNrtAlertRuleProperties.templateVersion = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedNrtAlertRuleProperties.description = reader.getString(); + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedNrtAlertRuleProperties.tactics = tactics; + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedNrtAlertRuleProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedNrtAlertRuleProperties.subTechniques = subTechniques; + } else if ("lastModifiedUtc".equals(fieldName)) { + deserializedNrtAlertRuleProperties.lastModifiedUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("incidentConfiguration".equals(fieldName)) { + deserializedNrtAlertRuleProperties.incidentConfiguration = IncidentConfiguration.fromJson(reader); + } else if ("customDetails".equals(fieldName)) { + Map customDetails = reader.readMap(reader1 -> reader1.getString()); + deserializedNrtAlertRuleProperties.customDetails = customDetails; + } else if ("entityMappings".equals(fieldName)) { + List entityMappings = reader.readArray(reader1 -> EntityMapping.fromJson(reader1)); + deserializedNrtAlertRuleProperties.entityMappings = entityMappings; + } else if ("alertDetailsOverride".equals(fieldName)) { + deserializedNrtAlertRuleProperties.alertDetailsOverride = AlertDetailsOverride.fromJson(reader); + } else if ("eventGroupingSettings".equals(fieldName)) { + deserializedNrtAlertRuleProperties.eventGroupingSettings = EventGroupingSettings.fromJson(reader); + } else if ("sentinelEntitiesMappings".equals(fieldName)) { + List sentinelEntitiesMappings + = reader.readArray(reader1 -> SentinelEntityMapping.fromJson(reader1)); + deserializedNrtAlertRuleProperties.sentinelEntitiesMappings = sentinelEntitiesMappings; + } else { + reader.skipChildren(); + } + } + + return deserializedNrtAlertRuleProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NrtAlertRuleTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NrtAlertRuleTemplateProperties.java new file mode 100644 index 000000000000..ffa8a2e7a17e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/NrtAlertRuleTemplateProperties.java @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; +import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; +import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateWithMitreProperties; +import com.azure.resourcemanager.securityinsights.models.AlertSeverity; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.EntityMapping; +import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; +import com.azure.resourcemanager.securityinsights.models.SentinelEntityMapping; +import com.azure.resourcemanager.securityinsights.models.TemplateStatus; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * NRT alert rule template properties. + */ +@Fluent +public final class NrtAlertRuleTemplateProperties extends AlertRuleTemplateWithMitreProperties { + /* + * The query that creates alerts for this rule. + */ + private String query; + + /* + * The severity for alerts created by this alert rule. + */ + private AlertSeverity severity; + + /* + * The version of this template - in format , where all are numbers. For example <1.0.2>. + */ + private String version; + + /* + * Dictionary of string key-value pairs of columns to be attached to the alert + */ + private Map customDetails; + + /* + * Array of the entity mappings of the alert rule + */ + private List entityMappings; + + /* + * The alert details override settings + */ + private AlertDetailsOverride alertDetailsOverride; + + /* + * The event grouping settings. + */ + private EventGroupingSettings eventGroupingSettings; + + /* + * Array of the sentinel entity mappings of the alert rule + */ + private List sentinelEntitiesMappings; + + /* + * The time that this alert rule template has been added. + */ + private OffsetDateTime createdDateUtc; + + /* + * The last time that this alert rule template has been updated. + */ + private OffsetDateTime lastUpdatedDateUtc; + + /** + * Creates an instance of NrtAlertRuleTemplateProperties class. + */ + public NrtAlertRuleTemplateProperties() { + } + + /** + * Get the query property: The query that creates alerts for this rule. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The query that creates alerts for this rule. + * + * @param query the query value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the version property: The version of this template - in format <a.b.c>, where all are numbers. For + * example <1.0.2>. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of this template - in format <a.b.c>, where all are numbers. For + * example <1.0.2>. + * + * @param version the version value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @return the customDetails value. + */ + public Map customDetails() { + return this.customDetails; + } + + /** + * Set the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @param customDetails the customDetails value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties withCustomDetails(Map customDetails) { + this.customDetails = customDetails; + return this; + } + + /** + * Get the entityMappings property: Array of the entity mappings of the alert rule. + * + * @return the entityMappings value. + */ + public List entityMappings() { + return this.entityMappings; + } + + /** + * Set the entityMappings property: Array of the entity mappings of the alert rule. + * + * @param entityMappings the entityMappings value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties withEntityMappings(List entityMappings) { + this.entityMappings = entityMappings; + return this; + } + + /** + * Get the alertDetailsOverride property: The alert details override settings. + * + * @return the alertDetailsOverride value. + */ + public AlertDetailsOverride alertDetailsOverride() { + return this.alertDetailsOverride; + } + + /** + * Set the alertDetailsOverride property: The alert details override settings. + * + * @param alertDetailsOverride the alertDetailsOverride value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties withAlertDetailsOverride(AlertDetailsOverride alertDetailsOverride) { + this.alertDetailsOverride = alertDetailsOverride; + return this; + } + + /** + * Get the eventGroupingSettings property: The event grouping settings. + * + * @return the eventGroupingSettings value. + */ + public EventGroupingSettings eventGroupingSettings() { + return this.eventGroupingSettings; + } + + /** + * Set the eventGroupingSettings property: The event grouping settings. + * + * @param eventGroupingSettings the eventGroupingSettings value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties withEventGroupingSettings(EventGroupingSettings eventGroupingSettings) { + this.eventGroupingSettings = eventGroupingSettings; + return this; + } + + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.sentinelEntitiesMappings; + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the NrtAlertRuleTemplateProperties object itself. + */ + public NrtAlertRuleTemplateProperties + withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + this.sentinelEntitiesMappings = sentinelEntitiesMappings; + return this; + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + @Override + public OffsetDateTime createdDateUtc() { + return this.createdDateUtc; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + @Override + public OffsetDateTime lastUpdatedDateUtc() { + return this.lastUpdatedDateUtc; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRuleTemplateProperties withTactics(List tactics) { + super.withTactics(tactics); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRuleTemplateProperties withTechniques(List techniques) { + super.withTechniques(techniques); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRuleTemplateProperties + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + super.withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRuleTemplateProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRuleTemplateProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRuleTemplateProperties + withRequiredDataConnectors(List requiredDataConnectors) { + super.withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRuleTemplateProperties withStatus(TemplateStatus status) { + super.withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (entityMappings() != null) { + entityMappings().forEach(e -> e.validate()); + } + if (alertDetailsOverride() != null) { + alertDetailsOverride().validate(); + } + if (eventGroupingSettings() != null) { + eventGroupingSettings().validate(); + } + if (sentinelEntitiesMappings() != null) { + sentinelEntitiesMappings().forEach(e -> e.validate()); + } + if (requiredDataConnectors() != null) { + requiredDataConnectors().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", alertRulesCreatedByTemplateCount()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeArrayField("requiredDataConnectors", requiredDataConnectors(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("status", status() == null ? null : status().toString()); + jsonWriter.writeArrayField("tactics", tactics(), + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("techniques", techniques(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeMapField("customDetails", this.customDetails, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("entityMappings", this.entityMappings, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("alertDetailsOverride", this.alertDetailsOverride); + jsonWriter.writeJsonField("eventGroupingSettings", this.eventGroupingSettings); + jsonWriter.writeArrayField("sentinelEntitiesMappings", this.sentinelEntitiesMappings, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NrtAlertRuleTemplateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NrtAlertRuleTemplateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NrtAlertRuleTemplateProperties. + */ + public static NrtAlertRuleTemplateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NrtAlertRuleTemplateProperties deserializedNrtAlertRuleTemplateProperties + = new NrtAlertRuleTemplateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertRulesCreatedByTemplateCount".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties + .withAlertRulesCreatedByTemplateCount(reader.getNullable(JsonReader::getInt)); + } else if ("lastUpdatedDateUTC".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.lastUpdatedDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateUTC".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.createdDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("description".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.withDescription(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.withDisplayName(reader.getString()); + } else if ("requiredDataConnectors".equals(fieldName)) { + List requiredDataConnectors + = reader.readArray(reader1 -> AlertRuleTemplateDataSource.fromJson(reader1)); + deserializedNrtAlertRuleTemplateProperties.withRequiredDataConnectors(requiredDataConnectors); + } else if ("status".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties + .withStatus(TemplateStatus.fromString(reader.getString())); + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedNrtAlertRuleTemplateProperties.withTactics(tactics); + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedNrtAlertRuleTemplateProperties.withTechniques(techniques); + } else if ("query".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.query = reader.getString(); + } else if ("severity".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.severity = AlertSeverity.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.version = reader.getString(); + } else if ("customDetails".equals(fieldName)) { + Map customDetails = reader.readMap(reader1 -> reader1.getString()); + deserializedNrtAlertRuleTemplateProperties.customDetails = customDetails; + } else if ("entityMappings".equals(fieldName)) { + List entityMappings = reader.readArray(reader1 -> EntityMapping.fromJson(reader1)); + deserializedNrtAlertRuleTemplateProperties.entityMappings = entityMappings; + } else if ("alertDetailsOverride".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.alertDetailsOverride + = AlertDetailsOverride.fromJson(reader); + } else if ("eventGroupingSettings".equals(fieldName)) { + deserializedNrtAlertRuleTemplateProperties.eventGroupingSettings + = EventGroupingSettings.fromJson(reader); + } else if ("sentinelEntitiesMappings".equals(fieldName)) { + List sentinelEntitiesMappings + = reader.readArray(reader1 -> SentinelEntityMapping.fromJson(reader1)); + deserializedNrtAlertRuleTemplateProperties.sentinelEntitiesMappings = sentinelEntitiesMappings; + } else { + reader.skipChildren(); + } + } + + return deserializedNrtAlertRuleTemplateProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Office365ProjectCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Office365ProjectCheckRequirementsProperties.java new file mode 100644 index 000000000000..6871ec25fa32 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Office365ProjectCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * Office365 Project requirements check properties. + */ +@Fluent +public final class Office365ProjectCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of Office365ProjectCheckRequirementsProperties class. + */ + public Office365ProjectCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public Office365ProjectCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model Office365ProjectCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Office365ProjectCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Office365ProjectCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Office365ProjectCheckRequirementsProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Office365ProjectCheckRequirementsProperties. + */ + public static Office365ProjectCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Office365ProjectCheckRequirementsProperties deserializedOffice365ProjectCheckRequirementsProperties + = new Office365ProjectCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOffice365ProjectCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOffice365ProjectCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Office365ProjectDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Office365ProjectDataConnectorProperties.java new file mode 100644 index 000000000000..ad4731683e39 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/Office365ProjectDataConnectorProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectConnectorDataTypes; +import java.io.IOException; + +/** + * Office Microsoft Project data connector properties. + */ +@Fluent +public final class Office365ProjectDataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private Office365ProjectConnectorDataTypes dataTypes; + + /** + * Creates an instance of Office365ProjectDataConnectorProperties class. + */ + public Office365ProjectDataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public Office365ProjectConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the Office365ProjectDataConnectorProperties object itself. + */ + public Office365ProjectDataConnectorProperties withDataTypes(Office365ProjectConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public Office365ProjectDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model Office365ProjectDataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model Office365ProjectDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Office365ProjectDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Office365ProjectDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Office365ProjectDataConnectorProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Office365ProjectDataConnectorProperties. + */ + public static Office365ProjectDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Office365ProjectDataConnectorProperties deserializedOffice365ProjectDataConnectorProperties + = new Office365ProjectDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOffice365ProjectDataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedOffice365ProjectDataConnectorProperties.dataTypes + = Office365ProjectConnectorDataTypes.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOffice365ProjectDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeAtpCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeAtpCheckRequirementsProperties.java new file mode 100644 index 000000000000..de3759390004 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeAtpCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * OfficeATP (Office 365 Advanced Threat Protection) requirements check properties. + */ +@Fluent +public final class OfficeAtpCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of OfficeAtpCheckRequirementsProperties class. + */ + public OfficeAtpCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public OfficeAtpCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model OfficeAtpCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficeAtpCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeAtpCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeAtpCheckRequirementsProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficeAtpCheckRequirementsProperties. + */ + public static OfficeAtpCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeAtpCheckRequirementsProperties deserializedOfficeAtpCheckRequirementsProperties + = new OfficeAtpCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOfficeAtpCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeAtpCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeAtpDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeAtpDataConnectorProperties.java new file mode 100644 index 000000000000..cf8127b9c6bc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeAtpDataConnectorProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * OfficeATP (Office 365 Advanced Threat Protection) data connector properties. + */ +@Fluent +public final class OfficeAtpDataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private AlertsDataTypeOfDataConnector dataTypes; + + /** + * Creates an instance of OfficeAtpDataConnectorProperties class. + */ + public OfficeAtpDataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public AlertsDataTypeOfDataConnector dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the OfficeAtpDataConnectorProperties object itself. + */ + public OfficeAtpDataConnectorProperties withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public OfficeAtpDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() != null) { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model OfficeAtpDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficeAtpDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeAtpDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeAtpDataConnectorProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficeAtpDataConnectorProperties. + */ + public static OfficeAtpDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeAtpDataConnectorProperties deserializedOfficeAtpDataConnectorProperties + = new OfficeAtpDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOfficeAtpDataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedOfficeAtpDataConnectorProperties.dataTypes + = AlertsDataTypeOfDataConnector.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeAtpDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeConsentInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeConsentInner.java new file mode 100644 index 000000000000..f0f7f5beeaae --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeConsentInner.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Consent for Office365 tenant that already made. + */ +@Fluent +public final class OfficeConsentInner extends ProxyResource { + /* + * Office consent properties + */ + private OfficeConsentProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OfficeConsentInner class. + */ + public OfficeConsentInner() { + } + + /** + * Get the innerProperties property: Office consent properties. + * + * @return the innerProperties value. + */ + private OfficeConsentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the tenantId property: The tenantId of the Office365 with the consent. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenantId of the Office365 with the consent. + * + * @param tenantId the tenantId value to set. + * @return the OfficeConsentInner object itself. + */ + public OfficeConsentInner withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeConsentProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the consentId property: Help to easily cascade among the data layers. + * + * @return the consentId value. + */ + public String consentId() { + return this.innerProperties() == null ? null : this.innerProperties().consentId(); + } + + /** + * Set the consentId property: Help to easily cascade among the data layers. + * + * @param consentId the consentId value to set. + * @return the OfficeConsentInner object itself. + */ + public OfficeConsentInner withConsentId(String consentId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeConsentProperties(); + } + this.innerProperties().withConsentId(consentId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeConsentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeConsentInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficeConsentInner. + */ + public static OfficeConsentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeConsentInner deserializedOfficeConsentInner = new OfficeConsentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOfficeConsentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOfficeConsentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOfficeConsentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedOfficeConsentInner.innerProperties = OfficeConsentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedOfficeConsentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeConsentInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeConsentProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeConsentProperties.java new file mode 100644 index 000000000000..1612475f5810 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeConsentProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Consent property bag. + */ +@Fluent +public final class OfficeConsentProperties implements JsonSerializable { + /* + * The tenantId of the Office365 with the consent. + */ + private String tenantId; + + /* + * Help to easily cascade among the data layers. + */ + private String consentId; + + /** + * Creates an instance of OfficeConsentProperties class. + */ + public OfficeConsentProperties() { + } + + /** + * Get the tenantId property: The tenantId of the Office365 with the consent. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenantId of the Office365 with the consent. + * + * @param tenantId the tenantId value to set. + * @return the OfficeConsentProperties object itself. + */ + public OfficeConsentProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the consentId property: Help to easily cascade among the data layers. + * + * @return the consentId value. + */ + public String consentId() { + return this.consentId; + } + + /** + * Set the consentId property: Help to easily cascade among the data layers. + * + * @param consentId the consentId value to set. + * @return the OfficeConsentProperties object itself. + */ + public OfficeConsentProperties withConsentId(String consentId) { + this.consentId = consentId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", this.tenantId); + jsonWriter.writeStringField("consentId", this.consentId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeConsentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeConsentProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the OfficeConsentProperties. + */ + public static OfficeConsentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeConsentProperties deserializedOfficeConsentProperties = new OfficeConsentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOfficeConsentProperties.tenantId = reader.getString(); + } else if ("consentId".equals(fieldName)) { + deserializedOfficeConsentProperties.consentId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeConsentProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeDataConnectorProperties.java index 17cd25dd494b..a7cd7700bd2f 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeDataConnectorProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeDataConnectorProperties.java @@ -5,10 +5,11 @@ package com.azure.resourcemanager.securityinsights.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypes; import java.io.IOException; @@ -16,12 +17,7 @@ * Office data connector properties. */ @Fluent -public final class OfficeDataConnectorProperties implements JsonSerializable { - /* - * The tenant id to connect to, and get the data from. - */ - private String tenantId; - +public final class OfficeDataConnectorProperties extends DataConnectorTenantId { /* * The available data types for the connector. */ @@ -33,26 +29,6 @@ public final class OfficeDataConnectorProperties implements JsonSerializable { + OfficeIrmCheckRequirementsProperties deserializedOfficeIrmCheckRequirementsProperties + = new OfficeIrmCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOfficeIrmCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeIrmCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeIrmDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeIrmDataConnectorProperties.java new file mode 100644 index 000000000000..5140d7be6505 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficeIrmDataConnectorProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * OfficeIRM (Microsoft Insider Risk Management) data connector properties. + */ +@Fluent +public final class OfficeIrmDataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private AlertsDataTypeOfDataConnector dataTypes; + + /** + * Creates an instance of OfficeIrmDataConnectorProperties class. + */ + public OfficeIrmDataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public AlertsDataTypeOfDataConnector dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the OfficeIrmDataConnectorProperties object itself. + */ + public OfficeIrmDataConnectorProperties withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public OfficeIrmDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() != null) { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model OfficeIrmDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficeIrmDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeIrmDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeIrmDataConnectorProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficeIrmDataConnectorProperties. + */ + public static OfficeIrmDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeIrmDataConnectorProperties deserializedOfficeIrmDataConnectorProperties + = new OfficeIrmDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOfficeIrmDataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedOfficeIrmDataConnectorProperties.dataTypes + = AlertsDataTypeOfDataConnector.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeIrmDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficePowerBICheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficePowerBICheckRequirementsProperties.java new file mode 100644 index 000000000000..5783d22aafc0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficePowerBICheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * Office PowerBI requirements check properties. + */ +@Fluent +public final class OfficePowerBICheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of OfficePowerBICheckRequirementsProperties class. + */ + public OfficePowerBICheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public OfficePowerBICheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model OfficePowerBICheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficePowerBICheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficePowerBICheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficePowerBICheckRequirementsProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficePowerBICheckRequirementsProperties. + */ + public static OfficePowerBICheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficePowerBICheckRequirementsProperties deserializedOfficePowerBICheckRequirementsProperties + = new OfficePowerBICheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOfficePowerBICheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficePowerBICheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficePowerBIDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficePowerBIDataConnectorProperties.java new file mode 100644 index 000000000000..e4a4a5b30f4d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/OfficePowerBIDataConnectorProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIConnectorDataTypes; +import java.io.IOException; + +/** + * Office Microsoft PowerBI data connector properties. + */ +@Fluent +public final class OfficePowerBIDataConnectorProperties extends DataConnectorTenantId { + /* + * The available data types for the connector. + */ + private OfficePowerBIConnectorDataTypes dataTypes; + + /** + * Creates an instance of OfficePowerBIDataConnectorProperties class. + */ + public OfficePowerBIDataConnectorProperties() { + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public OfficePowerBIConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the OfficePowerBIDataConnectorProperties object itself. + */ + public OfficePowerBIDataConnectorProperties withDataTypes(OfficePowerBIConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public OfficePowerBIDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model OfficePowerBIDataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model OfficePowerBIDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficePowerBIDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficePowerBIDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficePowerBIDataConnectorProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficePowerBIDataConnectorProperties. + */ + public static OfficePowerBIDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficePowerBIDataConnectorProperties deserializedOfficePowerBIDataConnectorProperties + = new OfficePowerBIDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOfficePowerBIDataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedOfficePowerBIDataConnectorProperties.dataTypes + = OfficePowerBIConnectorDataTypes.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficePowerBIDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PackageModelInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PackageModelInner.java new file mode 100644 index 000000000000..ad6b7cb25afb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PackageModelInner.java @@ -0,0 +1,710 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; + +/** + * Represents a Package in Azure Security Insights. + */ +@Fluent +public final class PackageModelInner extends ResourceWithEtag { + /* + * package properties + */ + private PackageProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PackageModelInner class. + */ + public PackageModelInner() { + } + + /** + * Get the innerProperties property: package properties. + * + * @return the innerProperties value. + */ + private PackageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageModelInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the contentId property: The content id of the package. + * + * @return the contentId value. + */ + public String contentId() { + return this.innerProperties() == null ? null : this.innerProperties().contentId(); + } + + /** + * Set the contentId property: The content id of the package. + * + * @param contentId the contentId value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withContentId(String contentId) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withContentId(contentId); + return this; + } + + /** + * Get the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @return the contentProductId value. + */ + public String contentProductId() { + return this.innerProperties() == null ? null : this.innerProperties().contentProductId(); + } + + /** + * Set the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @param contentProductId the contentProductId value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withContentProductId(String contentProductId) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withContentProductId(contentProductId); + return this; + } + + /** + * Get the contentKind property: The package kind. + * + * @return the contentKind value. + */ + public PackageKind contentKind() { + return this.innerProperties() == null ? null : this.innerProperties().contentKind(); + } + + /** + * Set the contentKind property: The package kind. + * + * @param contentKind the contentKind value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withContentKind(PackageKind contentKind) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withContentKind(contentKind); + return this; + } + + /** + * Get the contentSchemaVersion property: The version of the content schema. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.innerProperties() == null ? null : this.innerProperties().contentSchemaVersion(); + } + + /** + * Set the contentSchemaVersion property: The version of the content schema. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withContentSchemaVersion(String contentSchemaVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * Get the isNew property: Flag indicates if this is a newly published package. + * + * @return the isNew value. + */ + public Flag isNew() { + return this.innerProperties() == null ? null : this.innerProperties().isNew(); + } + + /** + * Set the isNew property: Flag indicates if this is a newly published package. + * + * @param isNew the isNew value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withIsNew(Flag isNew) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withIsNew(isNew); + return this; + } + + /** + * Get the isPreview property: Flag indicates if this package is in preview. + * + * @return the isPreview value. + */ + public Flag isPreview() { + return this.innerProperties() == null ? null : this.innerProperties().isPreview(); + } + + /** + * Set the isPreview property: Flag indicates if this package is in preview. + * + * @param isPreview the isPreview value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withIsPreview(Flag isPreview) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withIsPreview(isPreview); + return this; + } + + /** + * Get the isFeatured property: Flag indicates if this package is among the featured list. + * + * @return the isFeatured value. + */ + public Flag isFeatured() { + return this.innerProperties() == null ? null : this.innerProperties().isFeatured(); + } + + /** + * Set the isFeatured property: Flag indicates if this package is among the featured list. + * + * @param isFeatured the isFeatured value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withIsFeatured(Flag isFeatured) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withIsFeatured(isFeatured); + return this; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + public Flag isDeprecated() { + return this.innerProperties() == null ? null : this.innerProperties().isDeprecated(); + } + + /** + * Set the isDeprecated property: Flag indicates if this template is deprecated. + * + * @param isDeprecated the isDeprecated value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withIsDeprecated(Flag isDeprecated) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withIsDeprecated(isDeprecated); + return this; + } + + /** + * Get the version property: the latest version number of the package. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: the latest version number of the package. + * + * @param version the version value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the displayName property: The display name of the package. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the package. + * + * @param displayName the displayName value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: The description of the package. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the package. + * + * @param description the description value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the publisherDisplayName property: The publisher display name of the package. + * + * @return the publisherDisplayName value. + */ + public String publisherDisplayName() { + return this.innerProperties() == null ? null : this.innerProperties().publisherDisplayName(); + } + + /** + * Set the publisherDisplayName property: The publisher display name of the package. + * + * @param publisherDisplayName the publisherDisplayName value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withPublisherDisplayName(String publisherDisplayName) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withPublisherDisplayName(publisherDisplayName); + return this; + } + + /** + * Get the source property: The source of the package. + * + * @return the source value. + */ + public MetadataSource source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: The source of the package. + * + * @param source the source value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withSource(MetadataSource source) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the author property: The author of the package. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.innerProperties() == null ? null : this.innerProperties().author(); + } + + /** + * Set the author property: The author of the package. + * + * @param author the author value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withAuthor(MetadataAuthor author) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withAuthor(author); + return this; + } + + /** + * Get the support property: The support tier of the package. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.innerProperties() == null ? null : this.innerProperties().support(); + } + + /** + * Set the support property: The support tier of the package. + * + * @param support the support value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withSupport(MetadataSupport support) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withSupport(support); + return this; + } + + /** + * Get the dependencies property: The support tier of the package. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.innerProperties() == null ? null : this.innerProperties().dependencies(); + } + + /** + * Set the dependencies property: The support tier of the package. + * + * @param dependencies the dependencies value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withDependencies(MetadataDependencies dependencies) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withDependencies(dependencies); + return this; + } + + /** + * Get the providers property: Providers for the package item. + * + * @return the providers value. + */ + public List providers() { + return this.innerProperties() == null ? null : this.innerProperties().providers(); + } + + /** + * Set the providers property: Providers for the package item. + * + * @param providers the providers value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withProviders(List providers) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withProviders(providers); + return this; + } + + /** + * Get the firstPublishDate property: first publish date package item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().firstPublishDate(); + } + + /** + * Set the firstPublishDate property: first publish date package item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withFirstPublishDate(LocalDate firstPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the package item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastPublishDate(); + } + + /** + * Set the lastPublishDate property: last publish date for the package item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withLastPublishDate(LocalDate lastPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withLastPublishDate(lastPublishDate); + return this; + } + + /** + * Get the categories property: The categories of the package. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.innerProperties() == null ? null : this.innerProperties().categories(); + } + + /** + * Set the categories property: The categories of the package. + * + * @param categories the categories value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withCategories(MetadataCategories categories) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withCategories(categories); + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTactics(); + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withThreatAnalysisTactics(List threatAnalysisTactics) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTechniques(); + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withThreatAnalysisTechniques(List threatAnalysisTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + public String icon() { + return this.innerProperties() == null ? null : this.innerProperties().icon(); + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon value to set. + * @return the PackageModelInner object itself. + */ + public PackageModelInner withIcon(String icon) { + if (this.innerProperties() == null) { + this.innerProperties = new PackageProperties(); + } + this.innerProperties().withIcon(icon); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PackageModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PackageModelInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PackageModelInner. + */ + public static PackageModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PackageModelInner deserializedPackageModelInner = new PackageModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPackageModelInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPackageModelInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPackageModelInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedPackageModelInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedPackageModelInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedPackageModelInner.innerProperties = PackageProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPackageModelInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PackageProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PackageProperties.java new file mode 100644 index 000000000000..983b41f0580d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PackageProperties.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageBaseProperties; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Describes package properties. + */ +@Fluent +public final class PackageProperties extends PackageBaseProperties { + /** + * Creates an instance of PackageProperties class. + */ + public PackageProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withContentId(String contentId) { + super.withContentId(contentId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withContentProductId(String contentProductId) { + super.withContentProductId(contentProductId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withContentKind(PackageKind contentKind) { + super.withContentKind(contentKind); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withContentSchemaVersion(String contentSchemaVersion) { + super.withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withIsNew(Flag isNew) { + super.withIsNew(isNew); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withIsPreview(Flag isPreview) { + super.withIsPreview(isPreview); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withIsFeatured(Flag isFeatured) { + super.withIsFeatured(isFeatured); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withIsDeprecated(Flag isDeprecated) { + super.withIsDeprecated(isDeprecated); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withVersion(String version) { + super.withVersion(version); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withPublisherDisplayName(String publisherDisplayName) { + super.withPublisherDisplayName(publisherDisplayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withSource(MetadataSource source) { + super.withSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withAuthor(MetadataAuthor author) { + super.withAuthor(author); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withSupport(MetadataSupport support) { + super.withSupport(support); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withDependencies(MetadataDependencies dependencies) { + super.withDependencies(dependencies); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withProviders(List providers) { + super.withProviders(providers); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withFirstPublishDate(LocalDate firstPublishDate) { + super.withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withLastPublishDate(LocalDate lastPublishDate) { + super.withLastPublishDate(lastPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withCategories(MetadataCategories categories) { + super.withCategories(categories); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withThreatAnalysisTactics(List threatAnalysisTactics) { + super.withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withThreatAnalysisTechniques(List threatAnalysisTechniques) { + super.withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PackageProperties withIcon(String icon) { + super.withIcon(icon); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", contentId()); + jsonWriter.writeStringField("contentProductId", contentProductId()); + jsonWriter.writeStringField("contentKind", contentKind() == null ? null : contentKind().toString()); + jsonWriter.writeStringField("contentSchemaVersion", contentSchemaVersion()); + jsonWriter.writeStringField("isNew", isNew() == null ? null : isNew().toString()); + jsonWriter.writeStringField("isPreview", isPreview() == null ? null : isPreview().toString()); + jsonWriter.writeStringField("isFeatured", isFeatured() == null ? null : isFeatured().toString()); + jsonWriter.writeStringField("isDeprecated", isDeprecated() == null ? null : isDeprecated().toString()); + jsonWriter.writeStringField("version", version()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("publisherDisplayName", publisherDisplayName()); + jsonWriter.writeJsonField("source", source()); + jsonWriter.writeJsonField("author", author()); + jsonWriter.writeJsonField("support", support()); + jsonWriter.writeJsonField("dependencies", dependencies()); + jsonWriter.writeArrayField("providers", providers(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(firstPublishDate(), null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(lastPublishDate(), null)); + jsonWriter.writeJsonField("categories", categories()); + jsonWriter.writeArrayField("threatAnalysisTactics", threatAnalysisTactics(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", threatAnalysisTechniques(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("icon", icon()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PackageProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PackageProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PackageProperties. + */ + public static PackageProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PackageProperties deserializedPackageProperties = new PackageProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedPackageProperties.withContentId(reader.getString()); + } else if ("contentProductId".equals(fieldName)) { + deserializedPackageProperties.withContentProductId(reader.getString()); + } else if ("contentKind".equals(fieldName)) { + deserializedPackageProperties.withContentKind(PackageKind.fromString(reader.getString())); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedPackageProperties.withContentSchemaVersion(reader.getString()); + } else if ("isNew".equals(fieldName)) { + deserializedPackageProperties.withIsNew(Flag.fromString(reader.getString())); + } else if ("isPreview".equals(fieldName)) { + deserializedPackageProperties.withIsPreview(Flag.fromString(reader.getString())); + } else if ("isFeatured".equals(fieldName)) { + deserializedPackageProperties.withIsFeatured(Flag.fromString(reader.getString())); + } else if ("isDeprecated".equals(fieldName)) { + deserializedPackageProperties.withIsDeprecated(Flag.fromString(reader.getString())); + } else if ("version".equals(fieldName)) { + deserializedPackageProperties.withVersion(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedPackageProperties.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPackageProperties.withDescription(reader.getString()); + } else if ("publisherDisplayName".equals(fieldName)) { + deserializedPackageProperties.withPublisherDisplayName(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedPackageProperties.withSource(MetadataSource.fromJson(reader)); + } else if ("author".equals(fieldName)) { + deserializedPackageProperties.withAuthor(MetadataAuthor.fromJson(reader)); + } else if ("support".equals(fieldName)) { + deserializedPackageProperties.withSupport(MetadataSupport.fromJson(reader)); + } else if ("dependencies".equals(fieldName)) { + deserializedPackageProperties.withDependencies(MetadataDependencies.fromJson(reader)); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedPackageProperties.withProviders(providers); + } else if ("firstPublishDate".equals(fieldName)) { + deserializedPackageProperties.withFirstPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedPackageProperties.withLastPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("categories".equals(fieldName)) { + deserializedPackageProperties.withCategories(MetadataCategories.fromJson(reader)); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedPackageProperties.withThreatAnalysisTactics(threatAnalysisTactics); + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedPackageProperties.withThreatAnalysisTechniques(threatAnalysisTechniques); + } else if ("icon".equals(fieldName)) { + deserializedPackageProperties.withIcon(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPackageProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductPackageModelInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductPackageModelInner.java new file mode 100644 index 000000000000..bbaccb8a79ec --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductPackageModelInner.java @@ -0,0 +1,779 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; + +/** + * Represents a Package in Azure Security Insights. + */ +@Fluent +public final class ProductPackageModelInner extends ResourceWithEtag { + /* + * package properties + */ + private ProductPackageProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ProductPackageModelInner class. + */ + public ProductPackageModelInner() { + } + + /** + * Get the innerProperties property: package properties. + * + * @return the innerProperties value. + */ + private ProductPackageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageModelInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the installedVersion property: The version of the installed package, null or absent means not installed. + * + * @return the installedVersion value. + */ + public String installedVersion() { + return this.innerProperties() == null ? null : this.innerProperties().installedVersion(); + } + + /** + * Set the installedVersion property: The version of the installed package, null or absent means not installed. + * + * @param installedVersion the installedVersion value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withInstalledVersion(String installedVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withInstalledVersion(installedVersion); + return this; + } + + /** + * Get the metadataResourceId property: The metadata resource id. + * + * @return the metadataResourceId value. + */ + public String metadataResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().metadataResourceId(); + } + + /** + * Set the metadataResourceId property: The metadata resource id. + * + * @param metadataResourceId the metadataResourceId value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withMetadataResourceId(String metadataResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withMetadataResourceId(metadataResourceId); + return this; + } + + /** + * Get the packagedContent property: The json of the ARM template to deploy. Expandable. + * + * @return the packagedContent value. + */ + public Object packagedContent() { + return this.innerProperties() == null ? null : this.innerProperties().packagedContent(); + } + + /** + * Set the packagedContent property: The json of the ARM template to deploy. Expandable. + * + * @param packagedContent the packagedContent value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withPackagedContent(Object packagedContent) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withPackagedContent(packagedContent); + return this; + } + + /** + * Get the contentId property: The content id of the package. + * + * @return the contentId value. + */ + public String contentId() { + return this.innerProperties() == null ? null : this.innerProperties().contentId(); + } + + /** + * Set the contentId property: The content id of the package. + * + * @param contentId the contentId value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withContentId(String contentId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withContentId(contentId); + return this; + } + + /** + * Get the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @return the contentProductId value. + */ + public String contentProductId() { + return this.innerProperties() == null ? null : this.innerProperties().contentProductId(); + } + + /** + * Set the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @param contentProductId the contentProductId value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withContentProductId(String contentProductId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withContentProductId(contentProductId); + return this; + } + + /** + * Get the contentKind property: The package kind. + * + * @return the contentKind value. + */ + public PackageKind contentKind() { + return this.innerProperties() == null ? null : this.innerProperties().contentKind(); + } + + /** + * Set the contentKind property: The package kind. + * + * @param contentKind the contentKind value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withContentKind(PackageKind contentKind) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withContentKind(contentKind); + return this; + } + + /** + * Get the contentSchemaVersion property: The version of the content schema. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.innerProperties() == null ? null : this.innerProperties().contentSchemaVersion(); + } + + /** + * Set the contentSchemaVersion property: The version of the content schema. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withContentSchemaVersion(String contentSchemaVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * Get the isNew property: Flag indicates if this is a newly published package. + * + * @return the isNew value. + */ + public Flag isNew() { + return this.innerProperties() == null ? null : this.innerProperties().isNew(); + } + + /** + * Set the isNew property: Flag indicates if this is a newly published package. + * + * @param isNew the isNew value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withIsNew(Flag isNew) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withIsNew(isNew); + return this; + } + + /** + * Get the isPreview property: Flag indicates if this package is in preview. + * + * @return the isPreview value. + */ + public Flag isPreview() { + return this.innerProperties() == null ? null : this.innerProperties().isPreview(); + } + + /** + * Set the isPreview property: Flag indicates if this package is in preview. + * + * @param isPreview the isPreview value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withIsPreview(Flag isPreview) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withIsPreview(isPreview); + return this; + } + + /** + * Get the isFeatured property: Flag indicates if this package is among the featured list. + * + * @return the isFeatured value. + */ + public Flag isFeatured() { + return this.innerProperties() == null ? null : this.innerProperties().isFeatured(); + } + + /** + * Set the isFeatured property: Flag indicates if this package is among the featured list. + * + * @param isFeatured the isFeatured value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withIsFeatured(Flag isFeatured) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withIsFeatured(isFeatured); + return this; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + public Flag isDeprecated() { + return this.innerProperties() == null ? null : this.innerProperties().isDeprecated(); + } + + /** + * Set the isDeprecated property: Flag indicates if this template is deprecated. + * + * @param isDeprecated the isDeprecated value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withIsDeprecated(Flag isDeprecated) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withIsDeprecated(isDeprecated); + return this; + } + + /** + * Get the version property: the latest version number of the package. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: the latest version number of the package. + * + * @param version the version value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the displayName property: The display name of the package. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the package. + * + * @param displayName the displayName value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: The description of the package. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the package. + * + * @param description the description value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the publisherDisplayName property: The publisher display name of the package. + * + * @return the publisherDisplayName value. + */ + public String publisherDisplayName() { + return this.innerProperties() == null ? null : this.innerProperties().publisherDisplayName(); + } + + /** + * Set the publisherDisplayName property: The publisher display name of the package. + * + * @param publisherDisplayName the publisherDisplayName value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withPublisherDisplayName(String publisherDisplayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withPublisherDisplayName(publisherDisplayName); + return this; + } + + /** + * Get the source property: The source of the package. + * + * @return the source value. + */ + public MetadataSource source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: The source of the package. + * + * @param source the source value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withSource(MetadataSource source) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the author property: The author of the package. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.innerProperties() == null ? null : this.innerProperties().author(); + } + + /** + * Set the author property: The author of the package. + * + * @param author the author value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withAuthor(MetadataAuthor author) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withAuthor(author); + return this; + } + + /** + * Get the support property: The support tier of the package. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.innerProperties() == null ? null : this.innerProperties().support(); + } + + /** + * Set the support property: The support tier of the package. + * + * @param support the support value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withSupport(MetadataSupport support) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withSupport(support); + return this; + } + + /** + * Get the dependencies property: The support tier of the package. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.innerProperties() == null ? null : this.innerProperties().dependencies(); + } + + /** + * Set the dependencies property: The support tier of the package. + * + * @param dependencies the dependencies value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withDependencies(MetadataDependencies dependencies) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withDependencies(dependencies); + return this; + } + + /** + * Get the providers property: Providers for the package item. + * + * @return the providers value. + */ + public List providers() { + return this.innerProperties() == null ? null : this.innerProperties().providers(); + } + + /** + * Set the providers property: Providers for the package item. + * + * @param providers the providers value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withProviders(List providers) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withProviders(providers); + return this; + } + + /** + * Get the firstPublishDate property: first publish date package item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().firstPublishDate(); + } + + /** + * Set the firstPublishDate property: first publish date package item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withFirstPublishDate(LocalDate firstPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the package item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastPublishDate(); + } + + /** + * Set the lastPublishDate property: last publish date for the package item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withLastPublishDate(LocalDate lastPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withLastPublishDate(lastPublishDate); + return this; + } + + /** + * Get the categories property: The categories of the package. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.innerProperties() == null ? null : this.innerProperties().categories(); + } + + /** + * Set the categories property: The categories of the package. + * + * @param categories the categories value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withCategories(MetadataCategories categories) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withCategories(categories); + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTactics(); + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withThreatAnalysisTactics(List threatAnalysisTactics) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTechniques(); + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withThreatAnalysisTechniques(List threatAnalysisTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + public String icon() { + return this.innerProperties() == null ? null : this.innerProperties().icon(); + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon value to set. + * @return the ProductPackageModelInner object itself. + */ + public ProductPackageModelInner withIcon(String icon) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductPackageProperties(); + } + this.innerProperties().withIcon(icon); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductPackageModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductPackageModelInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProductPackageModelInner. + */ + public static ProductPackageModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductPackageModelInner deserializedProductPackageModelInner = new ProductPackageModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProductPackageModelInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProductPackageModelInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProductPackageModelInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedProductPackageModelInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedProductPackageModelInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedProductPackageModelInner.innerProperties = ProductPackageProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProductPackageModelInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductPackageProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductPackageProperties.java new file mode 100644 index 000000000000..19230a4904a9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductPackageProperties.java @@ -0,0 +1,458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageBaseProperties; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Describes package properties. + */ +@Fluent +public final class ProductPackageProperties extends PackageBaseProperties { + /* + * The version of the installed package, null or absent means not installed. + */ + private String installedVersion; + + /* + * The metadata resource id. + */ + private String metadataResourceId; + + /* + * The json of the ARM template to deploy. Expandable. + */ + private Object packagedContent; + + /** + * Creates an instance of ProductPackageProperties class. + */ + public ProductPackageProperties() { + } + + /** + * Get the installedVersion property: The version of the installed package, null or absent means not installed. + * + * @return the installedVersion value. + */ + public String installedVersion() { + return this.installedVersion; + } + + /** + * Set the installedVersion property: The version of the installed package, null or absent means not installed. + * + * @param installedVersion the installedVersion value to set. + * @return the ProductPackageProperties object itself. + */ + public ProductPackageProperties withInstalledVersion(String installedVersion) { + this.installedVersion = installedVersion; + return this; + } + + /** + * Get the metadataResourceId property: The metadata resource id. + * + * @return the metadataResourceId value. + */ + public String metadataResourceId() { + return this.metadataResourceId; + } + + /** + * Set the metadataResourceId property: The metadata resource id. + * + * @param metadataResourceId the metadataResourceId value to set. + * @return the ProductPackageProperties object itself. + */ + public ProductPackageProperties withMetadataResourceId(String metadataResourceId) { + this.metadataResourceId = metadataResourceId; + return this; + } + + /** + * Get the packagedContent property: The json of the ARM template to deploy. Expandable. + * + * @return the packagedContent value. + */ + public Object packagedContent() { + return this.packagedContent; + } + + /** + * Set the packagedContent property: The json of the ARM template to deploy. Expandable. + * + * @param packagedContent the packagedContent value to set. + * @return the ProductPackageProperties object itself. + */ + public ProductPackageProperties withPackagedContent(Object packagedContent) { + this.packagedContent = packagedContent; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withContentId(String contentId) { + super.withContentId(contentId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withContentProductId(String contentProductId) { + super.withContentProductId(contentProductId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withContentKind(PackageKind contentKind) { + super.withContentKind(contentKind); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withContentSchemaVersion(String contentSchemaVersion) { + super.withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withIsNew(Flag isNew) { + super.withIsNew(isNew); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withIsPreview(Flag isPreview) { + super.withIsPreview(isPreview); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withIsFeatured(Flag isFeatured) { + super.withIsFeatured(isFeatured); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withIsDeprecated(Flag isDeprecated) { + super.withIsDeprecated(isDeprecated); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withVersion(String version) { + super.withVersion(version); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withPublisherDisplayName(String publisherDisplayName) { + super.withPublisherDisplayName(publisherDisplayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withSource(MetadataSource source) { + super.withSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withAuthor(MetadataAuthor author) { + super.withAuthor(author); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withSupport(MetadataSupport support) { + super.withSupport(support); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withDependencies(MetadataDependencies dependencies) { + super.withDependencies(dependencies); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withProviders(List providers) { + super.withProviders(providers); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withFirstPublishDate(LocalDate firstPublishDate) { + super.withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withLastPublishDate(LocalDate lastPublishDate) { + super.withLastPublishDate(lastPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withCategories(MetadataCategories categories) { + super.withCategories(categories); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withThreatAnalysisTactics(List threatAnalysisTactics) { + super.withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withThreatAnalysisTechniques(List threatAnalysisTechniques) { + super.withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductPackageProperties withIcon(String icon) { + super.withIcon(icon); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", contentId()); + jsonWriter.writeStringField("contentProductId", contentProductId()); + jsonWriter.writeStringField("contentKind", contentKind() == null ? null : contentKind().toString()); + jsonWriter.writeStringField("contentSchemaVersion", contentSchemaVersion()); + jsonWriter.writeStringField("isNew", isNew() == null ? null : isNew().toString()); + jsonWriter.writeStringField("isPreview", isPreview() == null ? null : isPreview().toString()); + jsonWriter.writeStringField("isFeatured", isFeatured() == null ? null : isFeatured().toString()); + jsonWriter.writeStringField("isDeprecated", isDeprecated() == null ? null : isDeprecated().toString()); + jsonWriter.writeStringField("version", version()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("publisherDisplayName", publisherDisplayName()); + jsonWriter.writeJsonField("source", source()); + jsonWriter.writeJsonField("author", author()); + jsonWriter.writeJsonField("support", support()); + jsonWriter.writeJsonField("dependencies", dependencies()); + jsonWriter.writeArrayField("providers", providers(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(firstPublishDate(), null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(lastPublishDate(), null)); + jsonWriter.writeJsonField("categories", categories()); + jsonWriter.writeArrayField("threatAnalysisTactics", threatAnalysisTactics(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", threatAnalysisTechniques(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("icon", icon()); + jsonWriter.writeStringField("installedVersion", this.installedVersion); + jsonWriter.writeStringField("metadataResourceId", this.metadataResourceId); + jsonWriter.writeUntypedField("packagedContent", this.packagedContent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductPackageProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductPackageProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProductPackageProperties. + */ + public static ProductPackageProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductPackageProperties deserializedProductPackageProperties = new ProductPackageProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedProductPackageProperties.withContentId(reader.getString()); + } else if ("contentProductId".equals(fieldName)) { + deserializedProductPackageProperties.withContentProductId(reader.getString()); + } else if ("contentKind".equals(fieldName)) { + deserializedProductPackageProperties.withContentKind(PackageKind.fromString(reader.getString())); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedProductPackageProperties.withContentSchemaVersion(reader.getString()); + } else if ("isNew".equals(fieldName)) { + deserializedProductPackageProperties.withIsNew(Flag.fromString(reader.getString())); + } else if ("isPreview".equals(fieldName)) { + deserializedProductPackageProperties.withIsPreview(Flag.fromString(reader.getString())); + } else if ("isFeatured".equals(fieldName)) { + deserializedProductPackageProperties.withIsFeatured(Flag.fromString(reader.getString())); + } else if ("isDeprecated".equals(fieldName)) { + deserializedProductPackageProperties.withIsDeprecated(Flag.fromString(reader.getString())); + } else if ("version".equals(fieldName)) { + deserializedProductPackageProperties.withVersion(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedProductPackageProperties.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedProductPackageProperties.withDescription(reader.getString()); + } else if ("publisherDisplayName".equals(fieldName)) { + deserializedProductPackageProperties.withPublisherDisplayName(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedProductPackageProperties.withSource(MetadataSource.fromJson(reader)); + } else if ("author".equals(fieldName)) { + deserializedProductPackageProperties.withAuthor(MetadataAuthor.fromJson(reader)); + } else if ("support".equals(fieldName)) { + deserializedProductPackageProperties.withSupport(MetadataSupport.fromJson(reader)); + } else if ("dependencies".equals(fieldName)) { + deserializedProductPackageProperties.withDependencies(MetadataDependencies.fromJson(reader)); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedProductPackageProperties.withProviders(providers); + } else if ("firstPublishDate".equals(fieldName)) { + deserializedProductPackageProperties.withFirstPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedProductPackageProperties.withLastPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("categories".equals(fieldName)) { + deserializedProductPackageProperties.withCategories(MetadataCategories.fromJson(reader)); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedProductPackageProperties.withThreatAnalysisTactics(threatAnalysisTactics); + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedProductPackageProperties.withThreatAnalysisTechniques(threatAnalysisTechniques); + } else if ("icon".equals(fieldName)) { + deserializedProductPackageProperties.withIcon(reader.getString()); + } else if ("installedVersion".equals(fieldName)) { + deserializedProductPackageProperties.installedVersion = reader.getString(); + } else if ("metadataResourceId".equals(fieldName)) { + deserializedProductPackageProperties.metadataResourceId = reader.getString(); + } else if ("packagedContent".equals(fieldName)) { + deserializedProductPackageProperties.packagedContent = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductPackageProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductTemplateModelInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductTemplateModelInner.java new file mode 100644 index 000000000000..1a78e0f44191 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductTemplateModelInner.java @@ -0,0 +1,786 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; + +/** + * Template resource definition. + */ +@Fluent +public final class ProductTemplateModelInner extends ResourceWithEtag { + /* + * template properties + */ + private ProductTemplateProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ProductTemplateModelInner class. + */ + public ProductTemplateModelInner() { + } + + /** + * Get the innerProperties property: template properties. + * + * @return the innerProperties value. + */ + private ProductTemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateModelInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the packagedContent property: The json of the ARM template to deploy. + * + * @return the packagedContent value. + */ + public Object packagedContent() { + return this.innerProperties() == null ? null : this.innerProperties().packagedContent(); + } + + /** + * Set the packagedContent property: The json of the ARM template to deploy. + * + * @param packagedContent the packagedContent value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withPackagedContent(Object packagedContent) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withPackagedContent(packagedContent); + return this; + } + + /** + * Get the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + public String contentId() { + return this.innerProperties() == null ? null : this.innerProperties().contentId(); + } + + /** + * Set the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @param contentId the contentId value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withContentId(String contentId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withContentId(contentId); + return this; + } + + /** + * Get the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @return the contentProductId value. + */ + public String contentProductId() { + return this.innerProperties() == null ? null : this.innerProperties().contentProductId(); + } + + /** + * Set the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @param contentProductId the contentProductId value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withContentProductId(String contentProductId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withContentProductId(contentProductId); + return this; + } + + /** + * Get the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @return the packageVersion value. + */ + public String packageVersion() { + return this.innerProperties() == null ? null : this.innerProperties().packageVersion(); + } + + /** + * Set the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @param packageVersion the packageVersion value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withPackageVersion(String packageVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withPackageVersion(packageVersion); + return this; + } + + /** + * Get the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @param version the version value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the displayName property: The display name of the template. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the template. + * + * @param displayName the displayName value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the contentKind property: The kind of content the template is for. + * + * @return the contentKind value. + */ + public Kind contentKind() { + return this.innerProperties() == null ? null : this.innerProperties().contentKind(); + } + + /** + * Set the contentKind property: The kind of content the template is for. + * + * @param contentKind the contentKind value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withContentKind(Kind contentKind) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withContentKind(contentKind); + return this; + } + + /** + * Get the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + public MetadataSource source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: Source of the content. This is where/how it was created. + * + * @param source the source value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withSource(MetadataSource source) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the author property: The creator of the content item. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.innerProperties() == null ? null : this.innerProperties().author(); + } + + /** + * Set the author property: The creator of the content item. + * + * @param author the author value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withAuthor(MetadataAuthor author) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withAuthor(author); + return this; + } + + /** + * Get the support property: Support information for the template - type, name, contact information. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.innerProperties() == null ? null : this.innerProperties().support(); + } + + /** + * Set the support property: Support information for the template - type, name, contact information. + * + * @param support the support value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withSupport(MetadataSupport support) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withSupport(support); + return this; + } + + /** + * Get the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.innerProperties() == null ? null : this.innerProperties().dependencies(); + } + + /** + * Set the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @param dependencies the dependencies value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withDependencies(MetadataDependencies dependencies) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withDependencies(dependencies); + return this; + } + + /** + * Get the categories property: Categories for the item. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.innerProperties() == null ? null : this.innerProperties().categories(); + } + + /** + * Set the categories property: Categories for the item. + * + * @param categories the categories value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withCategories(MetadataCategories categories) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withCategories(categories); + return this; + } + + /** + * Get the providers property: Providers for the content item. + * + * @return the providers value. + */ + public List providers() { + return this.innerProperties() == null ? null : this.innerProperties().providers(); + } + + /** + * Set the providers property: Providers for the content item. + * + * @param providers the providers value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withProviders(List providers) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withProviders(providers); + return this; + } + + /** + * Get the firstPublishDate property: first publish date content item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().firstPublishDate(); + } + + /** + * Set the firstPublishDate property: first publish date content item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withFirstPublishDate(LocalDate firstPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the content item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastPublishDate(); + } + + /** + * Set the lastPublishDate property: last publish date for the content item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withLastPublishDate(LocalDate lastPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withLastPublishDate(lastPublishDate); + return this; + } + + /** + * Get the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + public String customVersion() { + return this.innerProperties() == null ? null : this.innerProperties().customVersion(); + } + + /** + * Set the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion the customVersion value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withCustomVersion(String customVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withCustomVersion(customVersion); + return this; + } + + /** + * Get the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.innerProperties() == null ? null : this.innerProperties().contentSchemaVersion(); + } + + /** + * Set the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withContentSchemaVersion(String contentSchemaVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + public String icon() { + return this.innerProperties() == null ? null : this.innerProperties().icon(); + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withIcon(String icon) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withIcon(icon); + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTactics(); + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withThreatAnalysisTactics(List threatAnalysisTactics) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTechniques(); + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withThreatAnalysisTechniques(List threatAnalysisTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * Get the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + public List previewImages() { + return this.innerProperties() == null ? null : this.innerProperties().previewImages(); + } + + /** + * Set the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @param previewImages the previewImages value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withPreviewImages(List previewImages) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withPreviewImages(previewImages); + return this; + } + + /** + * Get the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + public List previewImagesDark() { + return this.innerProperties() == null ? null : this.innerProperties().previewImagesDark(); + } + + /** + * Set the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @param previewImagesDark the previewImagesDark value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withPreviewImagesDark(List previewImagesDark) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withPreviewImagesDark(previewImagesDark); + return this; + } + + /** + * Get the packageId property: the package Id contains this template. + * + * @return the packageId value. + */ + public String packageId() { + return this.innerProperties() == null ? null : this.innerProperties().packageId(); + } + + /** + * Set the packageId property: the package Id contains this template. + * + * @param packageId the packageId value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withPackageId(String packageId) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withPackageId(packageId); + return this; + } + + /** + * Get the packageKind property: the packageKind of the package contains this template. + * + * @return the packageKind value. + */ + public PackageKind packageKind() { + return this.innerProperties() == null ? null : this.innerProperties().packageKind(); + } + + /** + * Set the packageKind property: the packageKind of the package contains this template. + * + * @param packageKind the packageKind value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withPackageKind(PackageKind packageKind) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withPackageKind(packageKind); + return this; + } + + /** + * Get the packageName property: the name of the package contains this template. + * + * @return the packageName value. + */ + public String packageName() { + return this.innerProperties() == null ? null : this.innerProperties().packageName(); + } + + /** + * Set the packageName property: the name of the package contains this template. + * + * @param packageName the packageName value to set. + * @return the ProductTemplateModelInner object itself. + */ + public ProductTemplateModelInner withPackageName(String packageName) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductTemplateProperties(); + } + this.innerProperties().withPackageName(packageName); + return this; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + public Flag isDeprecated() { + return this.innerProperties() == null ? null : this.innerProperties().isDeprecated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductTemplateModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductTemplateModelInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProductTemplateModelInner. + */ + public static ProductTemplateModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductTemplateModelInner deserializedProductTemplateModelInner = new ProductTemplateModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProductTemplateModelInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProductTemplateModelInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProductTemplateModelInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedProductTemplateModelInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedProductTemplateModelInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedProductTemplateModelInner.innerProperties = ProductTemplateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProductTemplateModelInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductTemplateProperties.java new file mode 100644 index 000000000000..9c87b2df255a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ProductTemplateProperties.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.TemplateBaseProperties; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Template property bag. + */ +@Fluent +public final class ProductTemplateProperties extends TemplateBaseProperties { + /* + * The json of the ARM template to deploy + */ + private Object packagedContent; + + /* + * Flag indicates if this template is deprecated + */ + private Flag isDeprecated; + + /** + * Creates an instance of ProductTemplateProperties class. + */ + public ProductTemplateProperties() { + } + + /** + * Get the packagedContent property: The json of the ARM template to deploy. + * + * @return the packagedContent value. + */ + public Object packagedContent() { + return this.packagedContent; + } + + /** + * Set the packagedContent property: The json of the ARM template to deploy. + * + * @param packagedContent the packagedContent value to set. + * @return the ProductTemplateProperties object itself. + */ + public ProductTemplateProperties withPackagedContent(Object packagedContent) { + this.packagedContent = packagedContent; + return this; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + @Override + public Flag isDeprecated() { + return this.isDeprecated; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withContentId(String contentId) { + super.withContentId(contentId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withContentProductId(String contentProductId) { + super.withContentProductId(contentProductId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withPackageVersion(String packageVersion) { + super.withPackageVersion(packageVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withVersion(String version) { + super.withVersion(version); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withContentKind(Kind contentKind) { + super.withContentKind(contentKind); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withSource(MetadataSource source) { + super.withSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withAuthor(MetadataAuthor author) { + super.withAuthor(author); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withSupport(MetadataSupport support) { + super.withSupport(support); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withDependencies(MetadataDependencies dependencies) { + super.withDependencies(dependencies); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withCategories(MetadataCategories categories) { + super.withCategories(categories); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withProviders(List providers) { + super.withProviders(providers); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withFirstPublishDate(LocalDate firstPublishDate) { + super.withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withLastPublishDate(LocalDate lastPublishDate) { + super.withLastPublishDate(lastPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withCustomVersion(String customVersion) { + super.withCustomVersion(customVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withContentSchemaVersion(String contentSchemaVersion) { + super.withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withIcon(String icon) { + super.withIcon(icon); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withThreatAnalysisTactics(List threatAnalysisTactics) { + super.withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withThreatAnalysisTechniques(List threatAnalysisTechniques) { + super.withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withPreviewImages(List previewImages) { + super.withPreviewImages(previewImages); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withPreviewImagesDark(List previewImagesDark) { + super.withPreviewImagesDark(previewImagesDark); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withPackageId(String packageId) { + super.withPackageId(packageId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withPackageKind(PackageKind packageKind) { + super.withPackageKind(packageKind); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProductTemplateProperties withPackageName(String packageName) { + super.withPackageName(packageName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", contentId()); + jsonWriter.writeStringField("contentProductId", contentProductId()); + jsonWriter.writeStringField("packageVersion", packageVersion()); + jsonWriter.writeStringField("version", version()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeStringField("contentKind", contentKind() == null ? null : contentKind().toString()); + jsonWriter.writeJsonField("source", source()); + jsonWriter.writeJsonField("author", author()); + jsonWriter.writeJsonField("support", support()); + jsonWriter.writeJsonField("dependencies", dependencies()); + jsonWriter.writeJsonField("categories", categories()); + jsonWriter.writeArrayField("providers", providers(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(firstPublishDate(), null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(lastPublishDate(), null)); + jsonWriter.writeStringField("customVersion", customVersion()); + jsonWriter.writeStringField("contentSchemaVersion", contentSchemaVersion()); + jsonWriter.writeStringField("icon", icon()); + jsonWriter.writeArrayField("threatAnalysisTactics", threatAnalysisTactics(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", threatAnalysisTechniques(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImages", previewImages(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImagesDark", previewImagesDark(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("packageId", packageId()); + jsonWriter.writeStringField("packageKind", packageKind() == null ? null : packageKind().toString()); + jsonWriter.writeStringField("packageName", packageName()); + jsonWriter.writeUntypedField("packagedContent", this.packagedContent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductTemplateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductTemplateProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProductTemplateProperties. + */ + public static ProductTemplateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductTemplateProperties deserializedProductTemplateProperties = new ProductTemplateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedProductTemplateProperties.withContentId(reader.getString()); + } else if ("contentProductId".equals(fieldName)) { + deserializedProductTemplateProperties.withContentProductId(reader.getString()); + } else if ("packageVersion".equals(fieldName)) { + deserializedProductTemplateProperties.withPackageVersion(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedProductTemplateProperties.withVersion(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedProductTemplateProperties.withDisplayName(reader.getString()); + } else if ("contentKind".equals(fieldName)) { + deserializedProductTemplateProperties.withContentKind(Kind.fromString(reader.getString())); + } else if ("source".equals(fieldName)) { + deserializedProductTemplateProperties.withSource(MetadataSource.fromJson(reader)); + } else if ("author".equals(fieldName)) { + deserializedProductTemplateProperties.withAuthor(MetadataAuthor.fromJson(reader)); + } else if ("support".equals(fieldName)) { + deserializedProductTemplateProperties.withSupport(MetadataSupport.fromJson(reader)); + } else if ("dependencies".equals(fieldName)) { + deserializedProductTemplateProperties.withDependencies(MetadataDependencies.fromJson(reader)); + } else if ("categories".equals(fieldName)) { + deserializedProductTemplateProperties.withCategories(MetadataCategories.fromJson(reader)); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedProductTemplateProperties.withProviders(providers); + } else if ("firstPublishDate".equals(fieldName)) { + deserializedProductTemplateProperties.withFirstPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedProductTemplateProperties.withLastPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("customVersion".equals(fieldName)) { + deserializedProductTemplateProperties.withCustomVersion(reader.getString()); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedProductTemplateProperties.withContentSchemaVersion(reader.getString()); + } else if ("icon".equals(fieldName)) { + deserializedProductTemplateProperties.withIcon(reader.getString()); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedProductTemplateProperties.withThreatAnalysisTactics(threatAnalysisTactics); + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedProductTemplateProperties.withThreatAnalysisTechniques(threatAnalysisTechniques); + } else if ("previewImages".equals(fieldName)) { + List previewImages = reader.readArray(reader1 -> reader1.getString()); + deserializedProductTemplateProperties.withPreviewImages(previewImages); + } else if ("previewImagesDark".equals(fieldName)) { + List previewImagesDark = reader.readArray(reader1 -> reader1.getString()); + deserializedProductTemplateProperties.withPreviewImagesDark(previewImagesDark); + } else if ("packageId".equals(fieldName)) { + deserializedProductTemplateProperties.withPackageId(reader.getString()); + } else if ("packageKind".equals(fieldName)) { + deserializedProductTemplateProperties.withPackageKind(PackageKind.fromString(reader.getString())); + } else if ("packageName".equals(fieldName)) { + deserializedProductTemplateProperties.withPackageName(reader.getString()); + } else if ("isDeprecated".equals(fieldName)) { + deserializedProductTemplateProperties.isDeprecated = Flag.fromString(reader.getString()); + } else if ("packagedContent".equals(fieldName)) { + deserializedProductTemplateProperties.packagedContent = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductTemplateProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PurviewAuditCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PurviewAuditCheckRequirementsProperties.java new file mode 100644 index 000000000000..e8cb08631d0b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PurviewAuditCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * PurviewAudit requirements check properties. + */ +@Fluent +public final class PurviewAuditCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of PurviewAuditCheckRequirementsProperties class. + */ + public PurviewAuditCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public PurviewAuditCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model PurviewAuditCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PurviewAuditCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PurviewAuditCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PurviewAuditCheckRequirementsProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PurviewAuditCheckRequirementsProperties. + */ + public static PurviewAuditCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PurviewAuditCheckRequirementsProperties deserializedPurviewAuditCheckRequirementsProperties + = new PurviewAuditCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedPurviewAuditCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPurviewAuditCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PurviewAuditDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PurviewAuditDataConnectorProperties.java new file mode 100644 index 000000000000..e2bcb31e7d3d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/PurviewAuditDataConnectorProperties.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.DcrConfiguration; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditConnectorDataTypes; +import java.io.IOException; + +/** + * PurviewAudit data connector properties. + */ +@Fluent +public final class PurviewAuditDataConnectorProperties extends DataConnectorTenantId { + /* + * The connector definition name (the dataConnectorDefinition resource id). + */ + private String connectorDefinitionName; + + /* + * The source type indicates which kind of data is relevant for this connector. + */ + private String sourceType; + + /* + * The DCR related properties. + */ + private DcrConfiguration dcrConfig; + + /* + * The available data types for the connector. + */ + private PurviewAuditConnectorDataTypes dataTypes; + + /** + * Creates an instance of PurviewAuditDataConnectorProperties class. + */ + public PurviewAuditDataConnectorProperties() { + } + + /** + * Get the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @return the connectorDefinitionName value. + */ + public String connectorDefinitionName() { + return this.connectorDefinitionName; + } + + /** + * Set the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @param connectorDefinitionName the connectorDefinitionName value to set. + * @return the PurviewAuditDataConnectorProperties object itself. + */ + public PurviewAuditDataConnectorProperties withConnectorDefinitionName(String connectorDefinitionName) { + this.connectorDefinitionName = connectorDefinitionName; + return this; + } + + /** + * Get the sourceType property: The source type indicates which kind of data is relevant for this connector. + * + * @return the sourceType value. + */ + public String sourceType() { + return this.sourceType; + } + + /** + * Set the sourceType property: The source type indicates which kind of data is relevant for this connector. + * + * @param sourceType the sourceType value to set. + * @return the PurviewAuditDataConnectorProperties object itself. + */ + public PurviewAuditDataConnectorProperties withSourceType(String sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get the dcrConfig property: The DCR related properties. + * + * @return the dcrConfig value. + */ + public DcrConfiguration dcrConfig() { + return this.dcrConfig; + } + + /** + * Set the dcrConfig property: The DCR related properties. + * + * @param dcrConfig the dcrConfig value to set. + * @return the PurviewAuditDataConnectorProperties object itself. + */ + public PurviewAuditDataConnectorProperties withDcrConfig(DcrConfiguration dcrConfig) { + this.dcrConfig = dcrConfig; + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public PurviewAuditConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the PurviewAuditDataConnectorProperties object itself. + */ + public PurviewAuditDataConnectorProperties withDataTypes(PurviewAuditConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PurviewAuditDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dcrConfig() != null) { + dcrConfig().validate(); + } + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model PurviewAuditDataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model PurviewAuditDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PurviewAuditDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + jsonWriter.writeStringField("connectorDefinitionName", this.connectorDefinitionName); + jsonWriter.writeStringField("sourceType", this.sourceType); + jsonWriter.writeJsonField("dcrConfig", this.dcrConfig); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PurviewAuditDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PurviewAuditDataConnectorProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PurviewAuditDataConnectorProperties. + */ + public static PurviewAuditDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PurviewAuditDataConnectorProperties deserializedPurviewAuditDataConnectorProperties + = new PurviewAuditDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedPurviewAuditDataConnectorProperties.withTenantId(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedPurviewAuditDataConnectorProperties.dataTypes + = PurviewAuditConnectorDataTypes.fromJson(reader); + } else if ("connectorDefinitionName".equals(fieldName)) { + deserializedPurviewAuditDataConnectorProperties.connectorDefinitionName = reader.getString(); + } else if ("sourceType".equals(fieldName)) { + deserializedPurviewAuditDataConnectorProperties.sourceType = reader.getString(); + } else if ("dcrConfig".equals(fieldName)) { + deserializedPurviewAuditDataConnectorProperties.dcrConfig = DcrConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPurviewAuditDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/QueryProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/QueryProperties.java new file mode 100644 index 000000000000..cd4d7a2eb142 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/QueryProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ConditionProperties; +import java.io.IOException; + +/** + * Describes the query properties. + */ +@Fluent +public final class QueryProperties implements JsonSerializable { + /* + * Represents a condition used to query for TI objects. + */ + private ConditionProperties condition; + + /** + * Creates an instance of QueryProperties class. + */ + public QueryProperties() { + } + + /** + * Get the condition property: Represents a condition used to query for TI objects. + * + * @return the condition value. + */ + public ConditionProperties condition() { + return this.condition; + } + + /** + * Set the condition property: Represents a condition used to query for TI objects. + * + * @param condition the condition value to set. + * @return the QueryProperties object itself. + */ + public QueryProperties withCondition(ConditionProperties condition) { + this.condition = condition; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (condition() != null) { + condition().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("condition", this.condition); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the QueryProperties. + */ + public static QueryProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryProperties deserializedQueryProperties = new QueryProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("condition".equals(fieldName)) { + deserializedQueryProperties.condition = ConditionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedQueryProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RecommendationInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RecommendationInner.java new file mode 100644 index 000000000000..e158538399ac --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RecommendationInner.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.RecommendedSuggestion; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import com.azure.resourcemanager.securityinsights.models.State; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Recommendation object. + */ +@Fluent +public final class RecommendationInner extends ResourceWithEtag { + /* + * Recommendation properties object. + */ + private RecommendationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RecommendationInner class. + */ + public RecommendationInner() { + } + + /** + * Get the innerProperties property: Recommendation properties object. + * + * @return the innerProperties value. + */ + private RecommendationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public RecommendationInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the recommendationTypeId property: Id of the recommendation type. + * + * @return the recommendationTypeId value. + */ + public String recommendationTypeId() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationTypeId(); + } + + /** + * Set the recommendationTypeId property: Id of the recommendation type. + * + * @param recommendationTypeId the recommendationTypeId value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withRecommendationTypeId(String recommendationTypeId) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withRecommendationTypeId(recommendationTypeId); + return this; + } + + /** + * Get the state property: State of the recommendation. + * + * @return the state value. + */ + public State state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: State of the recommendation. + * + * @param state the state value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withState(State state) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the title property: Title of the recommendation. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: Title of the recommendation. + * + * @param title the title value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the description property: Description of the recommendation. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the recommendation. + * + * @param description the description value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the creationTimeUtc property: The time stamp (UTC) when the recommendation was created. + * + * @return the creationTimeUtc value. + */ + public OffsetDateTime creationTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().creationTimeUtc(); + } + + /** + * Set the creationTimeUtc property: The time stamp (UTC) when the recommendation was created. + * + * @param creationTimeUtc the creationTimeUtc value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withCreationTimeUtc(OffsetDateTime creationTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withCreationTimeUtc(creationTimeUtc); + return this; + } + + /** + * Get the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @return the lastEvaluatedTimeUtc value. + */ + public OffsetDateTime lastEvaluatedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastEvaluatedTimeUtc(); + } + + /** + * Set the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @param lastEvaluatedTimeUtc the lastEvaluatedTimeUtc value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withLastEvaluatedTimeUtc(OffsetDateTime lastEvaluatedTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withLastEvaluatedTimeUtc(lastEvaluatedTimeUtc); + return this; + } + + /** + * Get the lastModifiedTimeUtc property: The time stamp (UTC) when the recommendation was last modified. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); + } + + /** + * Set the lastModifiedTimeUtc property: The time stamp (UTC) when the recommendation was last modified. + * + * @param lastModifiedTimeUtc the lastModifiedTimeUtc value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withLastModifiedTimeUtc(OffsetDateTime lastModifiedTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withLastModifiedTimeUtc(lastModifiedTimeUtc); + return this; + } + + /** + * Get the suggestions property: List of suggestions to take for this recommendation. + * + * @return the suggestions value. + */ + public List suggestions() { + return this.innerProperties() == null ? null : this.innerProperties().suggestions(); + } + + /** + * Set the suggestions property: List of suggestions to take for this recommendation. + * + * @param suggestions the suggestions value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withSuggestions(List suggestions) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withSuggestions(suggestions); + return this; + } + + /** + * Get the resourceId property: Id of the resource this recommendation refers to. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.innerProperties() == null ? null : this.innerProperties().resourceId(); + } + + /** + * Set the resourceId property: Id of the resource this recommendation refers to. + * + * @param resourceId the resourceId value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withResourceId(String resourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withResourceId(resourceId); + return this; + } + + /** + * Get the additionalProperties property: Collection of additional properties for the recommendation. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.innerProperties() == null ? null : this.innerProperties().additionalProperties(); + } + + /** + * Set the additionalProperties property: Collection of additional properties for the recommendation. + * + * @param additionalProperties the additionalProperties value to set. + * @return the RecommendationInner object itself. + */ + public RecommendationInner withAdditionalProperties(Map additionalProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withAdditionalProperties(additionalProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecommendationInner. + */ + public static RecommendationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationInner deserializedRecommendationInner = new RecommendationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRecommendationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRecommendationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRecommendationInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedRecommendationInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedRecommendationInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedRecommendationInner.innerProperties = RecommendationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RecommendationProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RecommendationProperties.java new file mode 100644 index 000000000000..890db034e34d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RecommendationProperties.java @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.RecommendedSuggestion; +import com.azure.resourcemanager.securityinsights.models.State; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * Recommendation properties object. + */ +@Fluent +public final class RecommendationProperties implements JsonSerializable { + /* + * Id of the recommendation type. + */ + private String recommendationTypeId; + + /* + * State of the recommendation. + */ + private State state; + + /* + * Title of the recommendation. + */ + private String title; + + /* + * Description of the recommendation. + */ + private String description; + + /* + * The time stamp (UTC) when the recommendation was created. + */ + private OffsetDateTime creationTimeUtc; + + /* + * The time stamp (UTC) when the recommendation was last evaluated. + */ + private OffsetDateTime lastEvaluatedTimeUtc; + + /* + * The time stamp (UTC) when the recommendation was last modified. + */ + private OffsetDateTime lastModifiedTimeUtc; + + /* + * List of suggestions to take for this recommendation. + */ + private List suggestions; + + /* + * Id of the resource this recommendation refers to. + */ + private String resourceId; + + /* + * Collection of additional properties for the recommendation. + */ + private Map additionalProperties; + + /** + * Creates an instance of RecommendationProperties class. + */ + public RecommendationProperties() { + } + + /** + * Get the recommendationTypeId property: Id of the recommendation type. + * + * @return the recommendationTypeId value. + */ + public String recommendationTypeId() { + return this.recommendationTypeId; + } + + /** + * Set the recommendationTypeId property: Id of the recommendation type. + * + * @param recommendationTypeId the recommendationTypeId value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withRecommendationTypeId(String recommendationTypeId) { + this.recommendationTypeId = recommendationTypeId; + return this; + } + + /** + * Get the state property: State of the recommendation. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: State of the recommendation. + * + * @param state the state value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withState(State state) { + this.state = state; + return this; + } + + /** + * Get the title property: Title of the recommendation. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Title of the recommendation. + * + * @param title the title value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Description of the recommendation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the recommendation. + * + * @param description the description value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the creationTimeUtc property: The time stamp (UTC) when the recommendation was created. + * + * @return the creationTimeUtc value. + */ + public OffsetDateTime creationTimeUtc() { + return this.creationTimeUtc; + } + + /** + * Set the creationTimeUtc property: The time stamp (UTC) when the recommendation was created. + * + * @param creationTimeUtc the creationTimeUtc value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withCreationTimeUtc(OffsetDateTime creationTimeUtc) { + this.creationTimeUtc = creationTimeUtc; + return this; + } + + /** + * Get the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @return the lastEvaluatedTimeUtc value. + */ + public OffsetDateTime lastEvaluatedTimeUtc() { + return this.lastEvaluatedTimeUtc; + } + + /** + * Set the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @param lastEvaluatedTimeUtc the lastEvaluatedTimeUtc value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withLastEvaluatedTimeUtc(OffsetDateTime lastEvaluatedTimeUtc) { + this.lastEvaluatedTimeUtc = lastEvaluatedTimeUtc; + return this; + } + + /** + * Get the lastModifiedTimeUtc property: The time stamp (UTC) when the recommendation was last modified. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.lastModifiedTimeUtc; + } + + /** + * Set the lastModifiedTimeUtc property: The time stamp (UTC) when the recommendation was last modified. + * + * @param lastModifiedTimeUtc the lastModifiedTimeUtc value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withLastModifiedTimeUtc(OffsetDateTime lastModifiedTimeUtc) { + this.lastModifiedTimeUtc = lastModifiedTimeUtc; + return this; + } + + /** + * Get the suggestions property: List of suggestions to take for this recommendation. + * + * @return the suggestions value. + */ + public List suggestions() { + return this.suggestions; + } + + /** + * Set the suggestions property: List of suggestions to take for this recommendation. + * + * @param suggestions the suggestions value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withSuggestions(List suggestions) { + this.suggestions = suggestions; + return this; + } + + /** + * Get the resourceId property: Id of the resource this recommendation refers to. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Id of the resource this recommendation refers to. + * + * @param resourceId the resourceId value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the additionalProperties property: Collection of additional properties for the recommendation. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Collection of additional properties for the recommendation. + * + * @param additionalProperties the additionalProperties value to set. + * @return the RecommendationProperties object itself. + */ + public RecommendationProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recommendationTypeId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property recommendationTypeId in model RecommendationProperties")); + } + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property state in model RecommendationProperties")); + } + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property title in model RecommendationProperties")); + } + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model RecommendationProperties")); + } + if (creationTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property creationTimeUtc in model RecommendationProperties")); + } + if (lastEvaluatedTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property lastEvaluatedTimeUtc in model RecommendationProperties")); + } + if (lastModifiedTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property lastModifiedTimeUtc in model RecommendationProperties")); + } + if (suggestions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property suggestions in model RecommendationProperties")); + } else { + suggestions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendationProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationTypeId", this.recommendationTypeId); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("creationTimeUtc", + this.creationTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.creationTimeUtc)); + jsonWriter.writeStringField("lastEvaluatedTimeUtc", + this.lastEvaluatedTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastEvaluatedTimeUtc)); + jsonWriter.writeStringField("lastModifiedTimeUtc", + this.lastModifiedTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedTimeUtc)); + jsonWriter.writeArrayField("suggestions", this.suggestions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeMapField("additionalProperties", this.additionalProperties, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecommendationProperties. + */ + public static RecommendationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationProperties deserializedRecommendationProperties = new RecommendationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationTypeId".equals(fieldName)) { + deserializedRecommendationProperties.recommendationTypeId = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedRecommendationProperties.state = State.fromString(reader.getString()); + } else if ("title".equals(fieldName)) { + deserializedRecommendationProperties.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedRecommendationProperties.description = reader.getString(); + } else if ("creationTimeUtc".equals(fieldName)) { + deserializedRecommendationProperties.creationTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastEvaluatedTimeUtc".equals(fieldName)) { + deserializedRecommendationProperties.lastEvaluatedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedTimeUtc".equals(fieldName)) { + deserializedRecommendationProperties.lastModifiedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("suggestions".equals(fieldName)) { + List suggestions + = reader.readArray(reader1 -> RecommendedSuggestion.fromJson(reader1)); + deserializedRecommendationProperties.suggestions = suggestions; + } else if ("resourceId".equals(fieldName)) { + deserializedRecommendationProperties.resourceId = reader.getString(); + } else if ("additionalProperties".equals(fieldName)) { + Map additionalProperties = reader.readMap(reader1 -> reader1.getString()); + deserializedRecommendationProperties.additionalProperties = additionalProperties; + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ReevaluateResponseInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ReevaluateResponseInner.java new file mode 100644 index 000000000000..fac382460a2d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ReevaluateResponseInner.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Reevaluate response object. + */ +@Fluent +public final class ReevaluateResponseInner implements JsonSerializable { + /* + * The time stamp (UTC) when the recommendation was last evaluated. + */ + private OffsetDateTime lastEvaluatedTimeUtc; + + /** + * Creates an instance of ReevaluateResponseInner class. + */ + public ReevaluateResponseInner() { + } + + /** + * Get the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @return the lastEvaluatedTimeUtc value. + */ + public OffsetDateTime lastEvaluatedTimeUtc() { + return this.lastEvaluatedTimeUtc; + } + + /** + * Set the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @param lastEvaluatedTimeUtc the lastEvaluatedTimeUtc value to set. + * @return the ReevaluateResponseInner object itself. + */ + public ReevaluateResponseInner withLastEvaluatedTimeUtc(OffsetDateTime lastEvaluatedTimeUtc) { + this.lastEvaluatedTimeUtc = lastEvaluatedTimeUtc; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastEvaluatedTimeUtc", + this.lastEvaluatedTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastEvaluatedTimeUtc)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReevaluateResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReevaluateResponseInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ReevaluateResponseInner. + */ + public static ReevaluateResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ReevaluateResponseInner deserializedReevaluateResponseInner = new ReevaluateResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastEvaluatedTimeUtc".equals(fieldName)) { + deserializedReevaluateResponseInner.lastEvaluatedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedReevaluateResponseInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepoInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepoInner.java new file mode 100644 index 000000000000..86e023d5b3c8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepoInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a repository. + */ +@Fluent +public final class RepoInner implements JsonSerializable { + /* + * The url to access the repository. + */ + private String url; + + /* + * The name of the repository. + */ + private String fullName; + + /* + * The installation id of the repository. + */ + private Long installationId; + + /* + * Array of branches. + */ + private List branches; + + /** + * Creates an instance of RepoInner class. + */ + public RepoInner() { + } + + /** + * Get the url property: The url to access the repository. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: The url to access the repository. + * + * @param url the url value to set. + * @return the RepoInner object itself. + */ + public RepoInner withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the fullName property: The name of the repository. + * + * @return the fullName value. + */ + public String fullName() { + return this.fullName; + } + + /** + * Set the fullName property: The name of the repository. + * + * @param fullName the fullName value to set. + * @return the RepoInner object itself. + */ + public RepoInner withFullName(String fullName) { + this.fullName = fullName; + return this; + } + + /** + * Get the installationId property: The installation id of the repository. + * + * @return the installationId value. + */ + public Long installationId() { + return this.installationId; + } + + /** + * Set the installationId property: The installation id of the repository. + * + * @param installationId the installationId value to set. + * @return the RepoInner object itself. + */ + public RepoInner withInstallationId(Long installationId) { + this.installationId = installationId; + return this; + } + + /** + * Get the branches property: Array of branches. + * + * @return the branches value. + */ + public List branches() { + return this.branches; + } + + /** + * Set the branches property: Array of branches. + * + * @param branches the branches value to set. + * @return the RepoInner object itself. + */ + public RepoInner withBranches(List branches) { + this.branches = branches; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("fullName", this.fullName); + jsonWriter.writeNumberField("installationId", this.installationId); + jsonWriter.writeArrayField("branches", this.branches, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RepoInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RepoInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the RepoInner. + */ + public static RepoInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RepoInner deserializedRepoInner = new RepoInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("url".equals(fieldName)) { + deserializedRepoInner.url = reader.getString(); + } else if ("fullName".equals(fieldName)) { + deserializedRepoInner.fullName = reader.getString(); + } else if ("installationId".equals(fieldName)) { + deserializedRepoInner.installationId = reader.getNullable(JsonReader::getLong); + } else if ("branches".equals(fieldName)) { + List branches = reader.readArray(reader1 -> reader1.getString()); + deserializedRepoInner.branches = branches; + } else { + reader.skipChildren(); + } + } + + return deserializedRepoInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepositoryAccess.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepositoryAccess.java new file mode 100644 index 000000000000..64fb44c42b2e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepositoryAccess.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import java.io.IOException; + +/** + * Credentials to access repository. + */ +@Fluent +public final class RepositoryAccess implements JsonSerializable { + /* + * The kind of repository access credentials + */ + private RepositoryAccessKind kind; + + /* + * OAuth Code. Required when `kind` is `OAuth` + */ + private String code; + + /* + * OAuth State. Required when `kind` is `OAuth` + */ + private String state; + + /* + * OAuth ClientId. Required when `kind` is `OAuth` + */ + private String clientId; + + /* + * Personal Access Token. Required when `kind` is `PAT` + */ + private String token; + + /* + * Application installation ID. Required when `kind` is `App`. Supported by `GitHub` only. + */ + private String installationId; + + /** + * Creates an instance of RepositoryAccess class. + */ + public RepositoryAccess() { + } + + /** + * Get the kind property: The kind of repository access credentials. + * + * @return the kind value. + */ + public RepositoryAccessKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of repository access credentials. + * + * @param kind the kind value to set. + * @return the RepositoryAccess object itself. + */ + public RepositoryAccess withKind(RepositoryAccessKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the code property: OAuth Code. Required when `kind` is `OAuth`. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: OAuth Code. Required when `kind` is `OAuth`. + * + * @param code the code value to set. + * @return the RepositoryAccess object itself. + */ + public RepositoryAccess withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the state property: OAuth State. Required when `kind` is `OAuth`. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: OAuth State. Required when `kind` is `OAuth`. + * + * @param state the state value to set. + * @return the RepositoryAccess object itself. + */ + public RepositoryAccess withState(String state) { + this.state = state; + return this; + } + + /** + * Get the clientId property: OAuth ClientId. Required when `kind` is `OAuth`. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: OAuth ClientId. Required when `kind` is `OAuth`. + * + * @param clientId the clientId value to set. + * @return the RepositoryAccess object itself. + */ + public RepositoryAccess withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the token property: Personal Access Token. Required when `kind` is `PAT`. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Set the token property: Personal Access Token. Required when `kind` is `PAT`. + * + * @param token the token value to set. + * @return the RepositoryAccess object itself. + */ + public RepositoryAccess withToken(String token) { + this.token = token; + return this; + } + + /** + * Get the installationId property: Application installation ID. Required when `kind` is `App`. Supported by + * `GitHub` only. + * + * @return the installationId value. + */ + public String installationId() { + return this.installationId; + } + + /** + * Set the installationId property: Application installation ID. Required when `kind` is `App`. Supported by + * `GitHub` only. + * + * @param installationId the installationId value to set. + * @return the RepositoryAccess object itself. + */ + public RepositoryAccess withInstallationId(String installationId) { + this.installationId = installationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (kind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property kind in model RepositoryAccess")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RepositoryAccess.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("state", this.state); + jsonWriter.writeStringField("clientId", this.clientId); + jsonWriter.writeStringField("token", this.token); + jsonWriter.writeStringField("installationId", this.installationId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RepositoryAccess from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RepositoryAccess if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RepositoryAccess. + */ + public static RepositoryAccess fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RepositoryAccess deserializedRepositoryAccess = new RepositoryAccess(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedRepositoryAccess.kind = RepositoryAccessKind.fromString(reader.getString()); + } else if ("code".equals(fieldName)) { + deserializedRepositoryAccess.code = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedRepositoryAccess.state = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedRepositoryAccess.clientId = reader.getString(); + } else if ("token".equals(fieldName)) { + deserializedRepositoryAccess.token = reader.getString(); + } else if ("installationId".equals(fieldName)) { + deserializedRepositoryAccess.installationId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRepositoryAccess; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepositoryAccessObject.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepositoryAccessObject.java new file mode 100644 index 000000000000..a85fd0d5f315 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RepositoryAccessObject.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import java.io.IOException; + +/** + * Credentials to access repository. + */ +@Fluent +public final class RepositoryAccessObject implements JsonSerializable { + /* + * RepositoryAccess properties + */ + private RepositoryAccess innerRepositoryAccess = new RepositoryAccess(); + + /** + * Creates an instance of RepositoryAccessObject class. + */ + public RepositoryAccessObject() { + } + + /** + * Get the innerRepositoryAccess property: RepositoryAccess properties. + * + * @return the innerRepositoryAccess value. + */ + private RepositoryAccess innerRepositoryAccess() { + return this.innerRepositoryAccess; + } + + /** + * Get the kind property: The kind of repository access credentials. + * + * @return the kind value. + */ + public RepositoryAccessKind kind() { + return this.innerRepositoryAccess() == null ? null : this.innerRepositoryAccess().kind(); + } + + /** + * Set the kind property: The kind of repository access credentials. + * + * @param kind the kind value to set. + * @return the RepositoryAccessObject object itself. + */ + public RepositoryAccessObject withKind(RepositoryAccessKind kind) { + if (this.innerRepositoryAccess() == null) { + this.innerRepositoryAccess = new RepositoryAccess(); + } + this.innerRepositoryAccess().withKind(kind); + return this; + } + + /** + * Get the code property: OAuth Code. Required when `kind` is `OAuth`. + * + * @return the code value. + */ + public String code() { + return this.innerRepositoryAccess() == null ? null : this.innerRepositoryAccess().code(); + } + + /** + * Set the code property: OAuth Code. Required when `kind` is `OAuth`. + * + * @param code the code value to set. + * @return the RepositoryAccessObject object itself. + */ + public RepositoryAccessObject withCode(String code) { + if (this.innerRepositoryAccess() == null) { + this.innerRepositoryAccess = new RepositoryAccess(); + } + this.innerRepositoryAccess().withCode(code); + return this; + } + + /** + * Get the state property: OAuth State. Required when `kind` is `OAuth`. + * + * @return the state value. + */ + public String state() { + return this.innerRepositoryAccess() == null ? null : this.innerRepositoryAccess().state(); + } + + /** + * Set the state property: OAuth State. Required when `kind` is `OAuth`. + * + * @param state the state value to set. + * @return the RepositoryAccessObject object itself. + */ + public RepositoryAccessObject withState(String state) { + if (this.innerRepositoryAccess() == null) { + this.innerRepositoryAccess = new RepositoryAccess(); + } + this.innerRepositoryAccess().withState(state); + return this; + } + + /** + * Get the clientId property: OAuth ClientId. Required when `kind` is `OAuth`. + * + * @return the clientId value. + */ + public String clientId() { + return this.innerRepositoryAccess() == null ? null : this.innerRepositoryAccess().clientId(); + } + + /** + * Set the clientId property: OAuth ClientId. Required when `kind` is `OAuth`. + * + * @param clientId the clientId value to set. + * @return the RepositoryAccessObject object itself. + */ + public RepositoryAccessObject withClientId(String clientId) { + if (this.innerRepositoryAccess() == null) { + this.innerRepositoryAccess = new RepositoryAccess(); + } + this.innerRepositoryAccess().withClientId(clientId); + return this; + } + + /** + * Get the token property: Personal Access Token. Required when `kind` is `PAT`. + * + * @return the token value. + */ + public String token() { + return this.innerRepositoryAccess() == null ? null : this.innerRepositoryAccess().token(); + } + + /** + * Set the token property: Personal Access Token. Required when `kind` is `PAT`. + * + * @param token the token value to set. + * @return the RepositoryAccessObject object itself. + */ + public RepositoryAccessObject withToken(String token) { + if (this.innerRepositoryAccess() == null) { + this.innerRepositoryAccess = new RepositoryAccess(); + } + this.innerRepositoryAccess().withToken(token); + return this; + } + + /** + * Get the installationId property: Application installation ID. Required when `kind` is `App`. Supported by + * `GitHub` only. + * + * @return the installationId value. + */ + public String installationId() { + return this.innerRepositoryAccess() == null ? null : this.innerRepositoryAccess().installationId(); + } + + /** + * Set the installationId property: Application installation ID. Required when `kind` is `App`. Supported by + * `GitHub` only. + * + * @param installationId the installationId value to set. + * @return the RepositoryAccessObject object itself. + */ + public RepositoryAccessObject withInstallationId(String installationId) { + if (this.innerRepositoryAccess() == null) { + this.innerRepositoryAccess = new RepositoryAccess(); + } + this.innerRepositoryAccess().withInstallationId(installationId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerRepositoryAccess() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerRepositoryAccess in model RepositoryAccessObject")); + } else { + innerRepositoryAccess().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RepositoryAccessObject.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("repositoryAccess", this.innerRepositoryAccess); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RepositoryAccessObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RepositoryAccessObject if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RepositoryAccessObject. + */ + public static RepositoryAccessObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RepositoryAccessObject deserializedRepositoryAccessObject = new RepositoryAccessObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("repositoryAccess".equals(fieldName)) { + deserializedRepositoryAccessObject.innerRepositoryAccess = RepositoryAccess.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRepositoryAccessObject; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RestApiPollerDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RestApiPollerDataConnectorProperties.java new file mode 100644 index 000000000000..e804428ac6d3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/RestApiPollerDataConnectorProperties.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.CcpAuthConfig; +import com.azure.resourcemanager.securityinsights.models.CcpResponseConfig; +import com.azure.resourcemanager.securityinsights.models.DcrConfiguration; +import com.azure.resourcemanager.securityinsights.models.RestApiPollerRequestConfig; +import com.azure.resourcemanager.securityinsights.models.RestApiPollerRequestPagingConfig; +import java.io.IOException; +import java.util.Map; + +/** + * Rest Api Poller data connector properties. + */ +@Fluent +public final class RestApiPollerDataConnectorProperties + implements JsonSerializable { + /* + * The connector definition name (the dataConnectorDefinition resource id). + */ + private String connectorDefinitionName; + + /* + * The a authentication model. + */ + private CcpAuthConfig auth; + + /* + * The request configuration. + */ + private RestApiPollerRequestConfig request; + + /* + * The DCR related properties. + */ + private DcrConfiguration dcrConfig; + + /* + * Indicates whether the connector is active or not. + */ + private Boolean isActive; + + /* + * The Log Analytics table destination. + */ + private String dataType; + + /* + * The response configuration. + */ + private CcpResponseConfig response; + + /* + * The paging configuration. + */ + private RestApiPollerRequestPagingConfig paging; + + /* + * The add on attributes. The key name will become attribute name (a column) and the value will become the attribute + * value in the payload. + */ + private Map addOnAttributes; + + /** + * Creates an instance of RestApiPollerDataConnectorProperties class. + */ + public RestApiPollerDataConnectorProperties() { + } + + /** + * Get the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @return the connectorDefinitionName value. + */ + public String connectorDefinitionName() { + return this.connectorDefinitionName; + } + + /** + * Set the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @param connectorDefinitionName the connectorDefinitionName value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withConnectorDefinitionName(String connectorDefinitionName) { + this.connectorDefinitionName = connectorDefinitionName; + return this; + } + + /** + * Get the auth property: The a authentication model. + * + * @return the auth value. + */ + public CcpAuthConfig auth() { + return this.auth; + } + + /** + * Set the auth property: The a authentication model. + * + * @param auth the auth value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withAuth(CcpAuthConfig auth) { + this.auth = auth; + return this; + } + + /** + * Get the request property: The request configuration. + * + * @return the request value. + */ + public RestApiPollerRequestConfig request() { + return this.request; + } + + /** + * Set the request property: The request configuration. + * + * @param request the request value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withRequest(RestApiPollerRequestConfig request) { + this.request = request; + return this; + } + + /** + * Get the dcrConfig property: The DCR related properties. + * + * @return the dcrConfig value. + */ + public DcrConfiguration dcrConfig() { + return this.dcrConfig; + } + + /** + * Set the dcrConfig property: The DCR related properties. + * + * @param dcrConfig the dcrConfig value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withDcrConfig(DcrConfiguration dcrConfig) { + this.dcrConfig = dcrConfig; + return this; + } + + /** + * Get the isActive property: Indicates whether the connector is active or not. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Set the isActive property: Indicates whether the connector is active or not. + * + * @param isActive the isActive value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withIsActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get the dataType property: The Log Analytics table destination. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Set the dataType property: The Log Analytics table destination. + * + * @param dataType the dataType value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withDataType(String dataType) { + this.dataType = dataType; + return this; + } + + /** + * Get the response property: The response configuration. + * + * @return the response value. + */ + public CcpResponseConfig response() { + return this.response; + } + + /** + * Set the response property: The response configuration. + * + * @param response the response value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withResponse(CcpResponseConfig response) { + this.response = response; + return this; + } + + /** + * Get the paging property: The paging configuration. + * + * @return the paging value. + */ + public RestApiPollerRequestPagingConfig paging() { + return this.paging; + } + + /** + * Set the paging property: The paging configuration. + * + * @param paging the paging value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withPaging(RestApiPollerRequestPagingConfig paging) { + this.paging = paging; + return this; + } + + /** + * Get the addOnAttributes property: The add on attributes. The key name will become attribute name (a column) and + * the value will become the attribute value in the payload. + * + * @return the addOnAttributes value. + */ + public Map addOnAttributes() { + return this.addOnAttributes; + } + + /** + * Set the addOnAttributes property: The add on attributes. The key name will become attribute name (a column) and + * the value will become the attribute value in the payload. + * + * @param addOnAttributes the addOnAttributes value to set. + * @return the RestApiPollerDataConnectorProperties object itself. + */ + public RestApiPollerDataConnectorProperties withAddOnAttributes(Map addOnAttributes) { + this.addOnAttributes = addOnAttributes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectorDefinitionName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectorDefinitionName in model RestApiPollerDataConnectorProperties")); + } + if (auth() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property auth in model RestApiPollerDataConnectorProperties")); + } else { + auth().validate(); + } + if (request() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property request in model RestApiPollerDataConnectorProperties")); + } else { + request().validate(); + } + if (dcrConfig() != null) { + dcrConfig().validate(); + } + if (response() != null) { + response().validate(); + } + if (paging() != null) { + paging().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectorDefinitionName", this.connectorDefinitionName); + jsonWriter.writeJsonField("auth", this.auth); + jsonWriter.writeJsonField("request", this.request); + jsonWriter.writeJsonField("dcrConfig", this.dcrConfig); + jsonWriter.writeBooleanField("isActive", this.isActive); + jsonWriter.writeStringField("dataType", this.dataType); + jsonWriter.writeJsonField("response", this.response); + jsonWriter.writeJsonField("paging", this.paging); + jsonWriter.writeMapField("addOnAttributes", this.addOnAttributes, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerDataConnectorProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerDataConnectorProperties. + */ + public static RestApiPollerDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerDataConnectorProperties deserializedRestApiPollerDataConnectorProperties + = new RestApiPollerDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectorDefinitionName".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.connectorDefinitionName = reader.getString(); + } else if ("auth".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.auth = CcpAuthConfig.fromJson(reader); + } else if ("request".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.request + = RestApiPollerRequestConfig.fromJson(reader); + } else if ("dcrConfig".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.dcrConfig = DcrConfiguration.fromJson(reader); + } else if ("isActive".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.isActive + = reader.getNullable(JsonReader::getBoolean); + } else if ("dataType".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.dataType = reader.getString(); + } else if ("response".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.response = CcpResponseConfig.fromJson(reader); + } else if ("paging".equals(fieldName)) { + deserializedRestApiPollerDataConnectorProperties.paging + = RestApiPollerRequestPagingConfig.fromJson(reader); + } else if ("addOnAttributes".equals(fieldName)) { + Map addOnAttributes = reader.readMap(reader1 -> reader1.getString()); + deserializedRestApiPollerDataConnectorProperties.addOnAttributes = addOnAttributes; + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SapSolutionUsageStatisticProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SapSolutionUsageStatisticProperties.java new file mode 100644 index 000000000000..6e4c7872655e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SapSolutionUsageStatisticProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of the billing statistic about the Microsoft Sentinel solution for SAP usage. + */ +@Immutable +public final class SapSolutionUsageStatisticProperties + implements JsonSerializable { + /* + * The latest count of active SAP system IDs under the Microsoft Sentinel solution for SAP Usage + */ + private Long activeSystemIdCount; + + /** + * Creates an instance of SapSolutionUsageStatisticProperties class. + */ + public SapSolutionUsageStatisticProperties() { + } + + /** + * Get the activeSystemIdCount property: The latest count of active SAP system IDs under the Microsoft Sentinel + * solution for SAP Usage. + * + * @return the activeSystemIdCount value. + */ + public Long activeSystemIdCount() { + return this.activeSystemIdCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SapSolutionUsageStatisticProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SapSolutionUsageStatisticProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SapSolutionUsageStatisticProperties. + */ + public static SapSolutionUsageStatisticProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SapSolutionUsageStatisticProperties deserializedSapSolutionUsageStatisticProperties + = new SapSolutionUsageStatisticProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("activeSystemIdCount".equals(fieldName)) { + deserializedSapSolutionUsageStatisticProperties.activeSystemIdCount + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedSapSolutionUsageStatisticProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleProperties.java index 65cef73d2007..c60551b3c2e3 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleProperties.java @@ -17,6 +17,7 @@ import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRuleCommonProperties; +import com.azure.resourcemanager.securityinsights.models.SentinelEntityMapping; import com.azure.resourcemanager.securityinsights.models.TriggerOperator; import java.io.IOException; import java.time.Duration; @@ -80,6 +81,11 @@ public final class ScheduledAlertRuleProperties extends ScheduledAlertRuleCommon */ private List techniques; + /* + * The sub-techniques of the alert rule + */ + private List subTechniques; + /* * The settings of the incidents that created from alerts triggered by this analytics rule */ @@ -286,6 +292,26 @@ public ScheduledAlertRuleProperties withTechniques(List techniques) { return this; } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.subTechniques; + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the ScheduledAlertRuleProperties object itself. + */ + public ScheduledAlertRuleProperties withSubTechniques(List subTechniques) { + this.subTechniques = subTechniques; + return this; + } + /** * Get the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this * analytics rule. @@ -398,6 +424,16 @@ public ScheduledAlertRuleProperties withAlertDetailsOverride(AlertDetailsOverrid return this; } + /** + * {@inheritDoc} + */ + @Override + public ScheduledAlertRuleProperties + withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + super.withSentinelEntitiesMappings(sentinelEntitiesMappings); + return this; + } + /** * Validates the instance. * @@ -427,6 +463,9 @@ public void validate() { if (alertDetailsOverride() != null) { alertDetailsOverride().validate(); } + if (sentinelEntitiesMappings() != null) { + sentinelEntitiesMappings().forEach(e -> e.validate()); + } } private static final ClientLogger LOGGER = new ClientLogger(ScheduledAlertRuleProperties.class); @@ -447,6 +486,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeMapField("customDetails", customDetails(), (writer, element) -> writer.writeString(element)); jsonWriter.writeArrayField("entityMappings", entityMappings(), (writer, element) -> writer.writeJson(element)); jsonWriter.writeJsonField("alertDetailsOverride", alertDetailsOverride()); + jsonWriter.writeArrayField("sentinelEntitiesMappings", sentinelEntitiesMappings(), + (writer, element) -> writer.writeJson(element)); jsonWriter.writeStringField("displayName", this.displayName); jsonWriter.writeBooleanField("enabled", this.enabled); jsonWriter.writeStringField("suppressionDuration", @@ -458,6 +499,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeArrayField("tactics", this.tactics, (writer, element) -> writer.writeString(element == null ? null : element.toString())); jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("subTechniques", this.subTechniques, + (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("incidentConfiguration", this.incidentConfiguration); return jsonWriter.writeEndObject(); } @@ -506,6 +549,10 @@ public static ScheduledAlertRuleProperties fromJson(JsonReader jsonReader) throw } else if ("alertDetailsOverride".equals(fieldName)) { deserializedScheduledAlertRuleProperties .withAlertDetailsOverride(AlertDetailsOverride.fromJson(reader)); + } else if ("sentinelEntitiesMappings".equals(fieldName)) { + List sentinelEntitiesMappings + = reader.readArray(reader1 -> SentinelEntityMapping.fromJson(reader1)); + deserializedScheduledAlertRuleProperties.withSentinelEntitiesMappings(sentinelEntitiesMappings); } else if ("displayName".equals(fieldName)) { deserializedScheduledAlertRuleProperties.displayName = reader.getString(); } else if ("enabled".equals(fieldName)) { @@ -531,6 +578,9 @@ public static ScheduledAlertRuleProperties fromJson(JsonReader jsonReader) throw } else if ("techniques".equals(fieldName)) { List techniques = reader.readArray(reader1 -> reader1.getString()); deserializedScheduledAlertRuleProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedScheduledAlertRuleProperties.subTechniques = subTechniques; } else if ("incidentConfiguration".equals(fieldName)) { deserializedScheduledAlertRuleProperties.incidentConfiguration = IncidentConfiguration.fromJson(reader); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleTemplateProperties.java index 1e674e1d961b..4bf8d7d45b39 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleTemplateProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ScheduledAlertRuleTemplateProperties.java @@ -16,6 +16,7 @@ import com.azure.resourcemanager.securityinsights.models.AttackTactic; import com.azure.resourcemanager.securityinsights.models.EntityMapping; import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; +import com.azure.resourcemanager.securityinsights.models.SentinelEntityMapping; import com.azure.resourcemanager.securityinsights.models.TemplateStatus; import com.azure.resourcemanager.securityinsights.models.TriggerOperator; import java.io.IOException; @@ -101,10 +102,15 @@ public final class ScheduledAlertRuleTemplateProperties private List tactics; /* - * The techniques of the alert rule template + * The techniques of the alert rule */ private List techniques; + /* + * The sub-techniques of the alert rule + */ + private List subTechniques; + /* * The version of this template - in format , where all are numbers. For example <1.0.2>. */ @@ -130,6 +136,11 @@ public final class ScheduledAlertRuleTemplateProperties */ private AlertDetailsOverride alertDetailsOverride; + /* + * Array of the sentinel entity mappings of the alert rule + */ + private List sentinelEntitiesMappings; + /** * Creates an instance of ScheduledAlertRuleTemplateProperties class. */ @@ -397,7 +408,7 @@ public ScheduledAlertRuleTemplateProperties withTactics(List tacti } /** - * Get the techniques property: The techniques of the alert rule template. + * Get the techniques property: The techniques of the alert rule. * * @return the techniques value. */ @@ -406,7 +417,7 @@ public List techniques() { } /** - * Set the techniques property: The techniques of the alert rule template. + * Set the techniques property: The techniques of the alert rule. * * @param techniques the techniques value to set. * @return the ScheduledAlertRuleTemplateProperties object itself. @@ -416,6 +427,26 @@ public ScheduledAlertRuleTemplateProperties withTechniques(List techniqu return this; } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.subTechniques; + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the ScheduledAlertRuleTemplateProperties object itself. + */ + public ScheduledAlertRuleTemplateProperties withSubTechniques(List subTechniques) { + this.subTechniques = subTechniques; + return this; + } + /** * Get the version property: The version of this template - in format <a.b.c>, where all are numbers. For * example <1.0.2>. @@ -518,6 +549,27 @@ public ScheduledAlertRuleTemplateProperties withAlertDetailsOverride(AlertDetail return this; } + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.sentinelEntitiesMappings; + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the ScheduledAlertRuleTemplateProperties object itself. + */ + public ScheduledAlertRuleTemplateProperties + withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + this.sentinelEntitiesMappings = sentinelEntitiesMappings; + return this; + } + /** * Validates the instance. * @@ -536,6 +588,9 @@ public void validate() { if (alertDetailsOverride() != null) { alertDetailsOverride().validate(); } + if (sentinelEntitiesMappings() != null) { + sentinelEntitiesMappings().forEach(e -> e.validate()); + } } /** @@ -560,12 +615,16 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeArrayField("tactics", this.tactics, (writer, element) -> writer.writeString(element == null ? null : element.toString())); jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("subTechniques", this.subTechniques, + (writer, element) -> writer.writeString(element)); jsonWriter.writeStringField("version", this.version); jsonWriter.writeJsonField("eventGroupingSettings", this.eventGroupingSettings); jsonWriter.writeMapField("customDetails", this.customDetails, (writer, element) -> writer.writeString(element)); jsonWriter.writeArrayField("entityMappings", this.entityMappings, (writer, element) -> writer.writeJson(element)); jsonWriter.writeJsonField("alertDetailsOverride", this.alertDetailsOverride); + jsonWriter.writeArrayField("sentinelEntitiesMappings", this.sentinelEntitiesMappings, + (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -629,6 +688,9 @@ public static ScheduledAlertRuleTemplateProperties fromJson(JsonReader jsonReade } else if ("techniques".equals(fieldName)) { List techniques = reader.readArray(reader1 -> reader1.getString()); deserializedScheduledAlertRuleTemplateProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedScheduledAlertRuleTemplateProperties.subTechniques = subTechniques; } else if ("version".equals(fieldName)) { deserializedScheduledAlertRuleTemplateProperties.version = reader.getString(); } else if ("eventGroupingSettings".equals(fieldName)) { @@ -643,6 +705,11 @@ public static ScheduledAlertRuleTemplateProperties fromJson(JsonReader jsonReade } else if ("alertDetailsOverride".equals(fieldName)) { deserializedScheduledAlertRuleTemplateProperties.alertDetailsOverride = AlertDetailsOverride.fromJson(reader); + } else if ("sentinelEntitiesMappings".equals(fieldName)) { + List sentinelEntitiesMappings + = reader.readArray(reader1 -> SentinelEntityMapping.fromJson(reader1)); + deserializedScheduledAlertRuleTemplateProperties.sentinelEntitiesMappings + = sentinelEntitiesMappings; } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SettingsInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SettingsInner.java new file mode 100644 index 000000000000..68a0cefd2b7f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SettingsInner.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Anomalies; +import com.azure.resourcemanager.securityinsights.models.EntityAnalytics; +import com.azure.resourcemanager.securityinsights.models.EyesOn; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import com.azure.resourcemanager.securityinsights.models.SettingKind; +import com.azure.resourcemanager.securityinsights.models.Ueba; +import java.io.IOException; + +/** + * The Setting. + */ +@Fluent +public class SettingsInner extends ResourceWithEtag { + /* + * The kind of the setting + */ + private SettingKind kind = SettingKind.fromString("Settings"); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SettingsInner class. + */ + public SettingsInner() { + } + + /** + * Get the kind property: The kind of the setting. + * + * @return the kind value. + */ + public SettingKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SettingsInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SettingsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SettingsInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SettingsInner. + */ + public static SettingsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Anomalies".equals(discriminatorValue)) { + return Anomalies.fromJson(readerToUse.reset()); + } else if ("EyesOn".equals(discriminatorValue)) { + return EyesOn.fromJson(readerToUse.reset()); + } else if ("EntityAnalytics".equals(discriminatorValue)) { + return EntityAnalytics.fromJson(readerToUse.reset()); + } else if ("Ueba".equals(discriminatorValue)) { + return Ueba.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static SettingsInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SettingsInner deserializedSettingsInner = new SettingsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSettingsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSettingsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSettingsInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedSettingsInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedSettingsInner.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedSettingsInner.kind = SettingKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSettingsInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SourceControlInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SourceControlInner.java new file mode 100644 index 000000000000..709555cd6ef5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SourceControlInner.java @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ContentType; +import com.azure.resourcemanager.securityinsights.models.DeploymentInfo; +import com.azure.resourcemanager.securityinsights.models.PullRequest; +import com.azure.resourcemanager.securityinsights.models.RepoType; +import com.azure.resourcemanager.securityinsights.models.Repository; +import com.azure.resourcemanager.securityinsights.models.RepositoryResourceInfo; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import com.azure.resourcemanager.securityinsights.models.ServicePrincipal; +import com.azure.resourcemanager.securityinsights.models.Version; +import java.io.IOException; +import java.util.List; + +/** + * Represents a SourceControl in Azure Security Insights. + */ +@Fluent +public final class SourceControlInner extends ResourceWithEtag { + /* + * source control properties + */ + private SourceControlProperties innerProperties = new SourceControlProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SourceControlInner class. + */ + public SourceControlInner() { + } + + /** + * Get the innerProperties property: source control properties. + * + * @return the innerProperties value. + */ + private SourceControlProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SourceControlInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the id property: The id (a Guid) of the source control. + * + * @return the id value. + */ + public String idPropertiesId() { + return this.innerProperties() == null ? null : this.innerProperties().id(); + } + + /** + * Get the version property: The version number associated with the source control. + * + * @return the version value. + */ + public Version version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the displayName property: The display name of the source control. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the source control. + * + * @param displayName the displayName value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: A description of the source control. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description of the source control. + * + * @param description the description value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the repoType property: The repository type of the source control. + * + * @return the repoType value. + */ + public RepoType repoType() { + return this.innerProperties() == null ? null : this.innerProperties().repoType(); + } + + /** + * Set the repoType property: The repository type of the source control. + * + * @param repoType the repoType value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withRepoType(RepoType repoType) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withRepoType(repoType); + return this; + } + + /** + * Get the contentTypes property: Array of source control content types. + * + * @return the contentTypes value. + */ + public List contentTypes() { + return this.innerProperties() == null ? null : this.innerProperties().contentTypes(); + } + + /** + * Set the contentTypes property: Array of source control content types. + * + * @param contentTypes the contentTypes value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withContentTypes(List contentTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withContentTypes(contentTypes); + return this; + } + + /** + * Get the repository property: Repository metadata. + * + * @return the repository value. + */ + public Repository repository() { + return this.innerProperties() == null ? null : this.innerProperties().repository(); + } + + /** + * Set the repository property: Repository metadata. + * + * @param repository the repository value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withRepository(Repository repository) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withRepository(repository); + return this; + } + + /** + * Get the servicePrincipal property: Service principal metadata. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.innerProperties() == null ? null : this.innerProperties().servicePrincipal(); + } + + /** + * Set the servicePrincipal property: Service principal metadata. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withServicePrincipal(ServicePrincipal servicePrincipal) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withServicePrincipal(servicePrincipal); + return this; + } + + /** + * Get the repositoryAccess property: Repository access credentials. This is write-only object and it never returns + * back to a user. + * + * @return the repositoryAccess value. + */ + public RepositoryAccess repositoryAccess() { + return this.innerProperties() == null ? null : this.innerProperties().repositoryAccess(); + } + + /** + * Set the repositoryAccess property: Repository access credentials. This is write-only object and it never returns + * back to a user. + * + * @param repositoryAccess the repositoryAccess value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withRepositoryAccess(RepositoryAccess repositoryAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withRepositoryAccess(repositoryAccess); + return this; + } + + /** + * Get the repositoryResourceInfo property: Information regarding the resources created in user's repository. + * + * @return the repositoryResourceInfo value. + */ + public RepositoryResourceInfo repositoryResourceInfo() { + return this.innerProperties() == null ? null : this.innerProperties().repositoryResourceInfo(); + } + + /** + * Set the repositoryResourceInfo property: Information regarding the resources created in user's repository. + * + * @param repositoryResourceInfo the repositoryResourceInfo value to set. + * @return the SourceControlInner object itself. + */ + public SourceControlInner withRepositoryResourceInfo(RepositoryResourceInfo repositoryResourceInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new SourceControlProperties(); + } + this.innerProperties().withRepositoryResourceInfo(repositoryResourceInfo); + return this; + } + + /** + * Get the lastDeploymentInfo property: Information regarding the latest deployment for the source control. + * + * @return the lastDeploymentInfo value. + */ + public DeploymentInfo lastDeploymentInfo() { + return this.innerProperties() == null ? null : this.innerProperties().lastDeploymentInfo(); + } + + /** + * Get the pullRequest property: Information regarding the pull request of the source control. + * + * @return the pullRequest value. + */ + public PullRequest pullRequest() { + return this.innerProperties() == null ? null : this.innerProperties().pullRequest(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model SourceControlInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SourceControlInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceControlInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceControlInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SourceControlInner. + */ + public static SourceControlInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceControlInner deserializedSourceControlInner = new SourceControlInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSourceControlInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSourceControlInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSourceControlInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedSourceControlInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedSourceControlInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedSourceControlInner.innerProperties = SourceControlProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceControlInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SourceControlProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SourceControlProperties.java new file mode 100644 index 000000000000..befc494683c8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SourceControlProperties.java @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ContentType; +import com.azure.resourcemanager.securityinsights.models.DeploymentInfo; +import com.azure.resourcemanager.securityinsights.models.PullRequest; +import com.azure.resourcemanager.securityinsights.models.RepoType; +import com.azure.resourcemanager.securityinsights.models.Repository; +import com.azure.resourcemanager.securityinsights.models.RepositoryResourceInfo; +import com.azure.resourcemanager.securityinsights.models.ServicePrincipal; +import com.azure.resourcemanager.securityinsights.models.Version; +import java.io.IOException; +import java.util.List; + +/** + * Describes source control properties. + */ +@Fluent +public final class SourceControlProperties implements JsonSerializable { + /* + * The id (a Guid) of the source control + */ + private String id; + + /* + * The version number associated with the source control + */ + private Version version; + + /* + * The display name of the source control + */ + private String displayName; + + /* + * A description of the source control + */ + private String description; + + /* + * The repository type of the source control + */ + private RepoType repoType; + + /* + * Array of source control content types. + */ + private List contentTypes; + + /* + * Repository metadata. + */ + private Repository repository; + + /* + * Service principal metadata. + */ + private ServicePrincipal servicePrincipal; + + /* + * Repository access credentials. This is write-only object and it never returns back to a user. + */ + private RepositoryAccess repositoryAccess; + + /* + * Information regarding the resources created in user's repository. + */ + private RepositoryResourceInfo repositoryResourceInfo; + + /* + * Information regarding the latest deployment for the source control. + */ + private DeploymentInfo lastDeploymentInfo; + + /* + * Information regarding the pull request of the source control. + */ + private PullRequest pullRequest; + + /** + * Creates an instance of SourceControlProperties class. + */ + public SourceControlProperties() { + } + + /** + * Get the id property: The id (a Guid) of the source control. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the version property: The version number associated with the source control. + * + * @return the version value. + */ + public Version version() { + return this.version; + } + + /** + * Get the displayName property: The display name of the source control. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the source control. + * + * @param displayName the displayName value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: A description of the source control. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description of the source control. + * + * @param description the description value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the repoType property: The repository type of the source control. + * + * @return the repoType value. + */ + public RepoType repoType() { + return this.repoType; + } + + /** + * Set the repoType property: The repository type of the source control. + * + * @param repoType the repoType value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withRepoType(RepoType repoType) { + this.repoType = repoType; + return this; + } + + /** + * Get the contentTypes property: Array of source control content types. + * + * @return the contentTypes value. + */ + public List contentTypes() { + return this.contentTypes; + } + + /** + * Set the contentTypes property: Array of source control content types. + * + * @param contentTypes the contentTypes value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withContentTypes(List contentTypes) { + this.contentTypes = contentTypes; + return this; + } + + /** + * Get the repository property: Repository metadata. + * + * @return the repository value. + */ + public Repository repository() { + return this.repository; + } + + /** + * Set the repository property: Repository metadata. + * + * @param repository the repository value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withRepository(Repository repository) { + this.repository = repository; + return this; + } + + /** + * Get the servicePrincipal property: Service principal metadata. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.servicePrincipal; + } + + /** + * Set the servicePrincipal property: Service principal metadata. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withServicePrincipal(ServicePrincipal servicePrincipal) { + this.servicePrincipal = servicePrincipal; + return this; + } + + /** + * Get the repositoryAccess property: Repository access credentials. This is write-only object and it never returns + * back to a user. + * + * @return the repositoryAccess value. + */ + public RepositoryAccess repositoryAccess() { + return this.repositoryAccess; + } + + /** + * Set the repositoryAccess property: Repository access credentials. This is write-only object and it never returns + * back to a user. + * + * @param repositoryAccess the repositoryAccess value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withRepositoryAccess(RepositoryAccess repositoryAccess) { + this.repositoryAccess = repositoryAccess; + return this; + } + + /** + * Get the repositoryResourceInfo property: Information regarding the resources created in user's repository. + * + * @return the repositoryResourceInfo value. + */ + public RepositoryResourceInfo repositoryResourceInfo() { + return this.repositoryResourceInfo; + } + + /** + * Set the repositoryResourceInfo property: Information regarding the resources created in user's repository. + * + * @param repositoryResourceInfo the repositoryResourceInfo value to set. + * @return the SourceControlProperties object itself. + */ + public SourceControlProperties withRepositoryResourceInfo(RepositoryResourceInfo repositoryResourceInfo) { + this.repositoryResourceInfo = repositoryResourceInfo; + return this; + } + + /** + * Get the lastDeploymentInfo property: Information regarding the latest deployment for the source control. + * + * @return the lastDeploymentInfo value. + */ + public DeploymentInfo lastDeploymentInfo() { + return this.lastDeploymentInfo; + } + + /** + * Get the pullRequest property: Information regarding the pull request of the source control. + * + * @return the pullRequest value. + */ + public PullRequest pullRequest() { + return this.pullRequest; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property displayName in model SourceControlProperties")); + } + if (repoType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property repoType in model SourceControlProperties")); + } + if (contentTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property contentTypes in model SourceControlProperties")); + } + if (repository() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property repository in model SourceControlProperties")); + } else { + repository().validate(); + } + if (servicePrincipal() != null) { + servicePrincipal().validate(); + } + if (repositoryAccess() != null) { + repositoryAccess().validate(); + } + if (repositoryResourceInfo() != null) { + repositoryResourceInfo().validate(); + } + if (lastDeploymentInfo() != null) { + lastDeploymentInfo().validate(); + } + if (pullRequest() != null) { + pullRequest().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SourceControlProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("repoType", this.repoType == null ? null : this.repoType.toString()); + jsonWriter.writeArrayField("contentTypes", this.contentTypes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("repository", this.repository); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("servicePrincipal", this.servicePrincipal); + jsonWriter.writeJsonField("repositoryAccess", this.repositoryAccess); + jsonWriter.writeJsonField("repositoryResourceInfo", this.repositoryResourceInfo); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceControlProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceControlProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SourceControlProperties. + */ + public static SourceControlProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceControlProperties deserializedSourceControlProperties = new SourceControlProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSourceControlProperties.displayName = reader.getString(); + } else if ("repoType".equals(fieldName)) { + deserializedSourceControlProperties.repoType = RepoType.fromString(reader.getString()); + } else if ("contentTypes".equals(fieldName)) { + List contentTypes + = reader.readArray(reader1 -> ContentType.fromString(reader1.getString())); + deserializedSourceControlProperties.contentTypes = contentTypes; + } else if ("repository".equals(fieldName)) { + deserializedSourceControlProperties.repository = Repository.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedSourceControlProperties.id = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedSourceControlProperties.version = Version.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSourceControlProperties.description = reader.getString(); + } else if ("servicePrincipal".equals(fieldName)) { + deserializedSourceControlProperties.servicePrincipal = ServicePrincipal.fromJson(reader); + } else if ("repositoryAccess".equals(fieldName)) { + deserializedSourceControlProperties.repositoryAccess = RepositoryAccess.fromJson(reader); + } else if ("repositoryResourceInfo".equals(fieldName)) { + deserializedSourceControlProperties.repositoryResourceInfo + = RepositoryResourceInfo.fromJson(reader); + } else if ("lastDeploymentInfo".equals(fieldName)) { + deserializedSourceControlProperties.lastDeploymentInfo = DeploymentInfo.fromJson(reader); + } else if ("pullRequest".equals(fieldName)) { + deserializedSourceControlProperties.pullRequest = PullRequest.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceControlProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SystemProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SystemProperties.java new file mode 100644 index 000000000000..f65af4d979f3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SystemProperties.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.SystemStatusType; +import com.azure.resourcemanager.securityinsights.models.SystemsConfiguration; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The properties of the system. + */ +@Fluent +public final class SystemProperties implements JsonSerializable { + /* + * The status of the system. + */ + private SystemStatusType status; + + /* + * The configuration of the system. + */ + private SystemsConfiguration configuration; + + /* + * The displayName property. + */ + private String displayName; + + /* + * The lastModifiedTimeUtc property. + */ + private OffsetDateTime lastModifiedTimeUtc; + + /** + * Creates an instance of SystemProperties class. + */ + public SystemProperties() { + } + + /** + * Get the status property: The status of the system. + * + * @return the status value. + */ + public SystemStatusType status() { + return this.status; + } + + /** + * Set the status property: The status of the system. + * + * @param status the status value to set. + * @return the SystemProperties object itself. + */ + public SystemProperties withStatus(SystemStatusType status) { + this.status = status; + return this; + } + + /** + * Get the configuration property: The configuration of the system. + * + * @return the configuration value. + */ + public SystemsConfiguration configuration() { + return this.configuration; + } + + /** + * Set the configuration property: The configuration of the system. + * + * @param configuration the configuration value to set. + * @return the SystemProperties object itself. + */ + public SystemProperties withConfiguration(SystemsConfiguration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Get the displayName property: The displayName property. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The displayName property. + * + * @param displayName the displayName value to set. + * @return the SystemProperties object itself. + */ + public SystemProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the lastModifiedTimeUtc property: The lastModifiedTimeUtc property. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.lastModifiedTimeUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configuration() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property configuration in model SystemProperties")); + } else { + configuration().validate(); + } + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property displayName in model SystemProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SystemProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("configuration", this.configuration); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SystemProperties. + */ + public static SystemProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemProperties deserializedSystemProperties = new SystemProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("configuration".equals(fieldName)) { + deserializedSystemProperties.configuration = SystemsConfiguration.fromJson(reader); + } else if ("displayName".equals(fieldName)) { + deserializedSystemProperties.displayName = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSystemProperties.status = SystemStatusType.fromString(reader.getString()); + } else if ("lastModifiedTimeUtc".equals(fieldName)) { + deserializedSystemProperties.lastModifiedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedSystemProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SystemResourceInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SystemResourceInner.java new file mode 100644 index 000000000000..7fee04469875 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/SystemResourceInner.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import com.azure.resourcemanager.securityinsights.models.SystemStatusType; +import com.azure.resourcemanager.securityinsights.models.SystemsConfiguration; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Describes the system within the agent. + */ +@Fluent +public final class SystemResourceInner extends ResourceWithEtag { + /* + * The properties of the system. + */ + private SystemProperties innerProperties = new SystemProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SystemResourceInner class. + */ + public SystemResourceInner() { + } + + /** + * Get the innerProperties property: The properties of the system. + * + * @return the innerProperties value. + */ + private SystemProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SystemResourceInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the status property: The status of the system. + * + * @return the status value. + */ + public SystemStatusType status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The status of the system. + * + * @param status the status value to set. + * @return the SystemResourceInner object itself. + */ + public SystemResourceInner withStatus(SystemStatusType status) { + if (this.innerProperties() == null) { + this.innerProperties = new SystemProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the configuration property: The configuration of the system. + * + * @return the configuration value. + */ + public SystemsConfiguration configuration() { + return this.innerProperties() == null ? null : this.innerProperties().configuration(); + } + + /** + * Set the configuration property: The configuration of the system. + * + * @param configuration the configuration value to set. + * @return the SystemResourceInner object itself. + */ + public SystemResourceInner withConfiguration(SystemsConfiguration configuration) { + if (this.innerProperties() == null) { + this.innerProperties = new SystemProperties(); + } + this.innerProperties().withConfiguration(configuration); + return this; + } + + /** + * Get the displayName property: The displayName property. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The displayName property. + * + * @param displayName the displayName value to set. + * @return the SystemResourceInner object itself. + */ + public SystemResourceInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new SystemProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the lastModifiedTimeUtc property: The lastModifiedTimeUtc property. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model SystemResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SystemResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemResourceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SystemResourceInner. + */ + public static SystemResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemResourceInner deserializedSystemResourceInner = new SystemResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSystemResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSystemResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSystemResourceInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedSystemResourceInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedSystemResourceInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedSystemResourceInner.innerProperties = SystemProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSystemResourceInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TICheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TICheckRequirementsProperties.java new file mode 100644 index 000000000000..a06dbcf30321 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TICheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * Threat Intelligence Platforms data connector required properties. + */ +@Fluent +public final class TICheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of TICheckRequirementsProperties class. + */ + public TICheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public TICheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model TICheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TICheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TICheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TICheckRequirementsProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TICheckRequirementsProperties. + */ + public static TICheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TICheckRequirementsProperties deserializedTICheckRequirementsProperties + = new TICheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedTICheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTICheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIDataConnectorProperties.java index e6fb8cbf6e93..37c8d89c2992 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIDataConnectorProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIDataConnectorProperties.java @@ -6,10 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes; import java.io.IOException; import java.time.OffsetDateTime; @@ -19,12 +20,7 @@ * TI (Threat Intelligence) data connector properties. */ @Fluent -public final class TIDataConnectorProperties implements JsonSerializable { - /* - * The tenant id to connect to, and get the data from. - */ - private String tenantId; - +public final class TIDataConnectorProperties extends DataConnectorTenantId { /* * The lookback period for the feed to be imported. */ @@ -41,26 +37,6 @@ public final class TIDataConnectorProperties implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("dataTypes".equals(fieldName)) { - deserializedTIDataConnectorProperties.dataTypes = TIDataConnectorDataTypes.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIObjectCommonProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIObjectCommonProperties.java new file mode 100644 index 000000000000..60e049425726 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIObjectCommonProperties.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.RelationshipHint; +import com.azure.resourcemanager.securityinsights.models.UserInfo; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Describes properties common to all threat intelligence objects. + */ +@Immutable +public final class TIObjectCommonProperties implements JsonSerializable { + /* + * The core STIX object that this TI object represents. + */ + private Map data; + + /* + * The UserInfo of the user/entity which originally created this TI object. + */ + private UserInfo createdBy; + + /* + * The source name for this TI object. + */ + private String source; + + /* + * The timestamp for the first time this object was ingested. + */ + private OffsetDateTime firstIngestedTimeUtc; + + /* + * The timestamp for the last time this object was ingested. + */ + private OffsetDateTime lastIngestedTimeUtc; + + /* + * The ID of the rules version that was active when this TI object was last ingested. + */ + private UUID ingestionRulesVersion; + + /* + * The name of the method/application that initiated the last write to this TI object. + */ + private String lastUpdateMethod; + + /* + * The UserInfo of the user/entity which last modified this TI object. + */ + private UserInfo lastModifiedBy; + + /* + * The timestamp for the last time this TI object was updated. + */ + private OffsetDateTime lastUpdatedDateTimeUtc; + + /* + * A dictionary used to help follow relationships from this object to other STIX objects. The keys are field names + * from the STIX object (in the 'data' field), and the values are lists of sources that can be prepended to the + * object ID in order to efficiently locate the target TI object. + */ + private List relationshipHints; + + /** + * Creates an instance of TIObjectCommonProperties class. + */ + public TIObjectCommonProperties() { + } + + /** + * Get the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + public Map data() { + return this.data; + } + + /** + * Get the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.createdBy; + } + + /** + * Get the source property: The source name for this TI object. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Get the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + public OffsetDateTime firstIngestedTimeUtc() { + return this.firstIngestedTimeUtc; + } + + /** + * Get the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + public OffsetDateTime lastIngestedTimeUtc() { + return this.lastIngestedTimeUtc; + } + + /** + * Get the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + public UUID ingestionRulesVersion() { + return this.ingestionRulesVersion; + } + + /** + * Get the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + public String lastUpdateMethod() { + return this.lastUpdateMethod; + } + + /** + * Get the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + public UserInfo lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.lastUpdatedDateTimeUtc; + } + + /** + * Get the relationshipHints property: A dictionary used to help follow relationships from this object to other STIX + * objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of sources + * that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + public List relationshipHints() { + return this.relationshipHints; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (createdBy() != null) { + createdBy().validate(); + } + if (lastModifiedBy() != null) { + lastModifiedBy().validate(); + } + if (relationshipHints() != null) { + relationshipHints().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TIObjectCommonProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TIObjectCommonProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TIObjectCommonProperties. + */ + public static TIObjectCommonProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TIObjectCommonProperties deserializedTIObjectCommonProperties = new TIObjectCommonProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + Map data = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedTIObjectCommonProperties.data = data; + } else if ("createdBy".equals(fieldName)) { + deserializedTIObjectCommonProperties.createdBy = UserInfo.fromJson(reader); + } else if ("source".equals(fieldName)) { + deserializedTIObjectCommonProperties.source = reader.getString(); + } else if ("firstIngestedTimeUtc".equals(fieldName)) { + deserializedTIObjectCommonProperties.firstIngestedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastIngestedTimeUtc".equals(fieldName)) { + deserializedTIObjectCommonProperties.lastIngestedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("ingestionRulesVersion".equals(fieldName)) { + deserializedTIObjectCommonProperties.ingestionRulesVersion + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("lastUpdateMethod".equals(fieldName)) { + deserializedTIObjectCommonProperties.lastUpdateMethod = reader.getString(); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTIObjectCommonProperties.lastModifiedBy = UserInfo.fromJson(reader); + } else if ("lastUpdatedDateTimeUtc".equals(fieldName)) { + deserializedTIObjectCommonProperties.lastUpdatedDateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("relationshipHints".equals(fieldName)) { + List relationshipHints + = reader.readArray(reader1 -> RelationshipHint.fromJson(reader1)); + deserializedTIObjectCommonProperties.relationshipHints = relationshipHints; + } else { + reader.skipChildren(); + } + } + + return deserializedTIObjectCommonProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIObjectInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIObjectInner.java new file mode 100644 index 000000000000..d75a9ca57242 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TIObjectInner.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AttackPattern; +import com.azure.resourcemanager.securityinsights.models.Identity; +import com.azure.resourcemanager.securityinsights.models.Indicator; +import com.azure.resourcemanager.securityinsights.models.Relationship; +import com.azure.resourcemanager.securityinsights.models.RelationshipHint; +import com.azure.resourcemanager.securityinsights.models.TIObjectKind; +import com.azure.resourcemanager.securityinsights.models.ThreatActor; +import com.azure.resourcemanager.securityinsights.models.UserInfo; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Represents a threat intelligence object in Azure Security Insights. + */ +@Immutable +public class TIObjectInner extends ProxyResource { + /* + * The kind of the TI object + */ + private TIObjectKind kind = TIObjectKind.fromString("TIObject"); + + /* + * The properties of the TI object + */ + private TIObjectCommonProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TIObjectInner class. + */ + public TIObjectInner() { + } + + /** + * Get the kind property: The kind of the TI object. + * + * @return the kind value. + */ + public TIObjectKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: The properties of the TI object. + * + * @return the innerProperties value. + */ + private TIObjectCommonProperties innerProperties() { + return this.innerProperties; + } + + /** + * Set the innerProperties property: The properties of the TI object. + * + * @param innerProperties the innerProperties value to set. + * @return the TIObjectInner object itself. + */ + TIObjectInner withInnerProperties(TIObjectCommonProperties innerProperties) { + this.innerProperties = innerProperties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Set the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @param systemData the systemData value to set. + * @return the TIObjectInner object itself. + */ + TIObjectInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + public Map data() { + return this.innerProperties() == null ? null : this.innerProperties().data(); + } + + /** + * Get the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the source property: The source name for this TI object. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Get the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + public OffsetDateTime firstIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().firstIngestedTimeUtc(); + } + + /** + * Get the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + public OffsetDateTime lastIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastIngestedTimeUtc(); + } + + /** + * Get the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + public UUID ingestionRulesVersion() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionRulesVersion(); + } + + /** + * Get the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + public String lastUpdateMethod() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateMethod(); + } + + /** + * Get the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + public UserInfo lastModifiedBy() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy(); + } + + /** + * Get the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateTimeUtc(); + } + + /** + * Get the relationshipHints property: A dictionary used to help follow relationships from this object to other STIX + * objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of sources + * that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + public List relationshipHints() { + return this.innerProperties() == null ? null : this.innerProperties().relationshipHints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TIObjectInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TIObjectInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TIObjectInner. + */ + public static TIObjectInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("ThreatActor".equals(discriminatorValue)) { + return ThreatActor.fromJson(readerToUse.reset()); + } else if ("AttackPattern".equals(discriminatorValue)) { + return AttackPattern.fromJson(readerToUse.reset()); + } else if ("Identity".equals(discriminatorValue)) { + return Identity.fromJson(readerToUse.reset()); + } else if ("Relationship".equals(discriminatorValue)) { + return Relationship.fromJson(readerToUse.reset()); + } else if ("Indicator".equals(discriminatorValue)) { + return Indicator.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static TIObjectInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TIObjectInner deserializedTIObjectInner = new TIObjectInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTIObjectInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTIObjectInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTIObjectInner.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedTIObjectInner.kind = TIObjectKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedTIObjectInner.innerProperties = TIObjectCommonProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTIObjectInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTIObjectInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TemplateModelInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TemplateModelInner.java new file mode 100644 index 000000000000..761e700b351a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TemplateModelInner.java @@ -0,0 +1,795 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; + +/** + * Template resource definition. + */ +@Fluent +public final class TemplateModelInner extends ResourceWithEtag { + /* + * template properties + */ + private TemplateProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TemplateModelInner class. + */ + public TemplateModelInner() { + } + + /** + * Get the innerProperties property: template properties. + * + * @return the innerProperties value. + */ + private TemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateModelInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable. + * + * @return the mainTemplate value. + */ + public Object mainTemplate() { + return this.innerProperties() == null ? null : this.innerProperties().mainTemplate(); + } + + /** + * Set the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable. + * + * @param mainTemplate the mainTemplate value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withMainTemplate(Object mainTemplate) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withMainTemplate(mainTemplate); + return this; + } + + /** + * Get the dependantTemplates property: Dependant templates. Expandable. + * + * @return the dependantTemplates value. + */ + public List dependantTemplates() { + return this.innerProperties() == null ? null : this.innerProperties().dependantTemplates(); + } + + /** + * Get the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + public String contentId() { + return this.innerProperties() == null ? null : this.innerProperties().contentId(); + } + + /** + * Set the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @param contentId the contentId value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withContentId(String contentId) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withContentId(contentId); + return this; + } + + /** + * Get the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @return the contentProductId value. + */ + public String contentProductId() { + return this.innerProperties() == null ? null : this.innerProperties().contentProductId(); + } + + /** + * Set the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @param contentProductId the contentProductId value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withContentProductId(String contentProductId) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withContentProductId(contentProductId); + return this; + } + + /** + * Get the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @return the packageVersion value. + */ + public String packageVersion() { + return this.innerProperties() == null ? null : this.innerProperties().packageVersion(); + } + + /** + * Set the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @param packageVersion the packageVersion value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withPackageVersion(String packageVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withPackageVersion(packageVersion); + return this; + } + + /** + * Get the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @param version the version value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the displayName property: The display name of the template. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the template. + * + * @param displayName the displayName value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the contentKind property: The kind of content the template is for. + * + * @return the contentKind value. + */ + public Kind contentKind() { + return this.innerProperties() == null ? null : this.innerProperties().contentKind(); + } + + /** + * Set the contentKind property: The kind of content the template is for. + * + * @param contentKind the contentKind value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withContentKind(Kind contentKind) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withContentKind(contentKind); + return this; + } + + /** + * Get the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + public MetadataSource source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: Source of the content. This is where/how it was created. + * + * @param source the source value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withSource(MetadataSource source) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the author property: The creator of the content item. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.innerProperties() == null ? null : this.innerProperties().author(); + } + + /** + * Set the author property: The creator of the content item. + * + * @param author the author value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withAuthor(MetadataAuthor author) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withAuthor(author); + return this; + } + + /** + * Get the support property: Support information for the template - type, name, contact information. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.innerProperties() == null ? null : this.innerProperties().support(); + } + + /** + * Set the support property: Support information for the template - type, name, contact information. + * + * @param support the support value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withSupport(MetadataSupport support) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withSupport(support); + return this; + } + + /** + * Get the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.innerProperties() == null ? null : this.innerProperties().dependencies(); + } + + /** + * Set the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @param dependencies the dependencies value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withDependencies(MetadataDependencies dependencies) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withDependencies(dependencies); + return this; + } + + /** + * Get the categories property: Categories for the item. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.innerProperties() == null ? null : this.innerProperties().categories(); + } + + /** + * Set the categories property: Categories for the item. + * + * @param categories the categories value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withCategories(MetadataCategories categories) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withCategories(categories); + return this; + } + + /** + * Get the providers property: Providers for the content item. + * + * @return the providers value. + */ + public List providers() { + return this.innerProperties() == null ? null : this.innerProperties().providers(); + } + + /** + * Set the providers property: Providers for the content item. + * + * @param providers the providers value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withProviders(List providers) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withProviders(providers); + return this; + } + + /** + * Get the firstPublishDate property: first publish date content item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().firstPublishDate(); + } + + /** + * Set the firstPublishDate property: first publish date content item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withFirstPublishDate(LocalDate firstPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the content item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastPublishDate(); + } + + /** + * Set the lastPublishDate property: last publish date for the content item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withLastPublishDate(LocalDate lastPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withLastPublishDate(lastPublishDate); + return this; + } + + /** + * Get the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + public String customVersion() { + return this.innerProperties() == null ? null : this.innerProperties().customVersion(); + } + + /** + * Set the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion the customVersion value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withCustomVersion(String customVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withCustomVersion(customVersion); + return this; + } + + /** + * Get the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.innerProperties() == null ? null : this.innerProperties().contentSchemaVersion(); + } + + /** + * Set the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withContentSchemaVersion(String contentSchemaVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + public String icon() { + return this.innerProperties() == null ? null : this.innerProperties().icon(); + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withIcon(String icon) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withIcon(icon); + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTactics(); + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withThreatAnalysisTactics(List threatAnalysisTactics) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTechniques(); + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withThreatAnalysisTechniques(List threatAnalysisTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * Get the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + public List previewImages() { + return this.innerProperties() == null ? null : this.innerProperties().previewImages(); + } + + /** + * Set the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @param previewImages the previewImages value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withPreviewImages(List previewImages) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withPreviewImages(previewImages); + return this; + } + + /** + * Get the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + public List previewImagesDark() { + return this.innerProperties() == null ? null : this.innerProperties().previewImagesDark(); + } + + /** + * Set the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @param previewImagesDark the previewImagesDark value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withPreviewImagesDark(List previewImagesDark) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withPreviewImagesDark(previewImagesDark); + return this; + } + + /** + * Get the packageId property: the package Id contains this template. + * + * @return the packageId value. + */ + public String packageId() { + return this.innerProperties() == null ? null : this.innerProperties().packageId(); + } + + /** + * Set the packageId property: the package Id contains this template. + * + * @param packageId the packageId value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withPackageId(String packageId) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withPackageId(packageId); + return this; + } + + /** + * Get the packageKind property: the packageKind of the package contains this template. + * + * @return the packageKind value. + */ + public PackageKind packageKind() { + return this.innerProperties() == null ? null : this.innerProperties().packageKind(); + } + + /** + * Set the packageKind property: the packageKind of the package contains this template. + * + * @param packageKind the packageKind value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withPackageKind(PackageKind packageKind) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withPackageKind(packageKind); + return this; + } + + /** + * Get the packageName property: the name of the package contains this template. + * + * @return the packageName value. + */ + public String packageName() { + return this.innerProperties() == null ? null : this.innerProperties().packageName(); + } + + /** + * Set the packageName property: the name of the package contains this template. + * + * @param packageName the packageName value to set. + * @return the TemplateModelInner object itself. + */ + public TemplateModelInner withPackageName(String packageName) { + if (this.innerProperties() == null) { + this.innerProperties = new TemplateProperties(); + } + this.innerProperties().withPackageName(packageName); + return this; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + public Flag isDeprecated() { + return this.innerProperties() == null ? null : this.innerProperties().isDeprecated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TemplateModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TemplateModelInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TemplateModelInner. + */ + public static TemplateModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TemplateModelInner deserializedTemplateModelInner = new TemplateModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTemplateModelInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTemplateModelInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTemplateModelInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedTemplateModelInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedTemplateModelInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedTemplateModelInner.innerProperties = TemplateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTemplateModelInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TemplateProperties.java new file mode 100644 index 000000000000..1b048e1b26e8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TemplateProperties.java @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.TemplateBaseProperties; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Template property bag. + */ +@Fluent +public final class TemplateProperties extends TemplateBaseProperties { + /* + * The JSON of the ARM template to deploy active content. Expandable. + */ + private Object mainTemplate; + + /* + * Dependant templates. Expandable. + */ + private List dependantTemplates; + + /* + * Flag indicates if this template is deprecated + */ + private Flag isDeprecated; + + /** + * Creates an instance of TemplateProperties class. + */ + public TemplateProperties() { + } + + /** + * Get the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable. + * + * @return the mainTemplate value. + */ + public Object mainTemplate() { + return this.mainTemplate; + } + + /** + * Set the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable. + * + * @param mainTemplate the mainTemplate value to set. + * @return the TemplateProperties object itself. + */ + public TemplateProperties withMainTemplate(Object mainTemplate) { + this.mainTemplate = mainTemplate; + return this; + } + + /** + * Get the dependantTemplates property: Dependant templates. Expandable. + * + * @return the dependantTemplates value. + */ + public List dependantTemplates() { + return this.dependantTemplates; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + @Override + public Flag isDeprecated() { + return this.isDeprecated; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withContentId(String contentId) { + super.withContentId(contentId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withContentProductId(String contentProductId) { + super.withContentProductId(contentProductId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withPackageVersion(String packageVersion) { + super.withPackageVersion(packageVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withVersion(String version) { + super.withVersion(version); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withContentKind(Kind contentKind) { + super.withContentKind(contentKind); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withSource(MetadataSource source) { + super.withSource(source); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withAuthor(MetadataAuthor author) { + super.withAuthor(author); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withSupport(MetadataSupport support) { + super.withSupport(support); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withDependencies(MetadataDependencies dependencies) { + super.withDependencies(dependencies); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withCategories(MetadataCategories categories) { + super.withCategories(categories); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withProviders(List providers) { + super.withProviders(providers); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withFirstPublishDate(LocalDate firstPublishDate) { + super.withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withLastPublishDate(LocalDate lastPublishDate) { + super.withLastPublishDate(lastPublishDate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withCustomVersion(String customVersion) { + super.withCustomVersion(customVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withContentSchemaVersion(String contentSchemaVersion) { + super.withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withIcon(String icon) { + super.withIcon(icon); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withThreatAnalysisTactics(List threatAnalysisTactics) { + super.withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withThreatAnalysisTechniques(List threatAnalysisTechniques) { + super.withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withPreviewImages(List previewImages) { + super.withPreviewImages(previewImages); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withPreviewImagesDark(List previewImagesDark) { + super.withPreviewImagesDark(previewImagesDark); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withPackageId(String packageId) { + super.withPackageId(packageId); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withPackageKind(PackageKind packageKind) { + super.withPackageKind(packageKind); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TemplateProperties withPackageName(String packageName) { + super.withPackageName(packageName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dependantTemplates() != null) { + dependantTemplates().forEach(e -> e.validate()); + } + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", contentId()); + jsonWriter.writeStringField("contentProductId", contentProductId()); + jsonWriter.writeStringField("packageVersion", packageVersion()); + jsonWriter.writeStringField("version", version()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeStringField("contentKind", contentKind() == null ? null : contentKind().toString()); + jsonWriter.writeJsonField("source", source()); + jsonWriter.writeJsonField("author", author()); + jsonWriter.writeJsonField("support", support()); + jsonWriter.writeJsonField("dependencies", dependencies()); + jsonWriter.writeJsonField("categories", categories()); + jsonWriter.writeArrayField("providers", providers(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(firstPublishDate(), null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(lastPublishDate(), null)); + jsonWriter.writeStringField("customVersion", customVersion()); + jsonWriter.writeStringField("contentSchemaVersion", contentSchemaVersion()); + jsonWriter.writeStringField("icon", icon()); + jsonWriter.writeArrayField("threatAnalysisTactics", threatAnalysisTactics(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", threatAnalysisTechniques(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImages", previewImages(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImagesDark", previewImagesDark(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("packageId", packageId()); + jsonWriter.writeStringField("packageKind", packageKind() == null ? null : packageKind().toString()); + jsonWriter.writeStringField("packageName", packageName()); + jsonWriter.writeUntypedField("mainTemplate", this.mainTemplate); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TemplateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TemplateProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TemplateProperties. + */ + public static TemplateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TemplateProperties deserializedTemplateProperties = new TemplateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedTemplateProperties.withContentId(reader.getString()); + } else if ("contentProductId".equals(fieldName)) { + deserializedTemplateProperties.withContentProductId(reader.getString()); + } else if ("packageVersion".equals(fieldName)) { + deserializedTemplateProperties.withPackageVersion(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedTemplateProperties.withVersion(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedTemplateProperties.withDisplayName(reader.getString()); + } else if ("contentKind".equals(fieldName)) { + deserializedTemplateProperties.withContentKind(Kind.fromString(reader.getString())); + } else if ("source".equals(fieldName)) { + deserializedTemplateProperties.withSource(MetadataSource.fromJson(reader)); + } else if ("author".equals(fieldName)) { + deserializedTemplateProperties.withAuthor(MetadataAuthor.fromJson(reader)); + } else if ("support".equals(fieldName)) { + deserializedTemplateProperties.withSupport(MetadataSupport.fromJson(reader)); + } else if ("dependencies".equals(fieldName)) { + deserializedTemplateProperties.withDependencies(MetadataDependencies.fromJson(reader)); + } else if ("categories".equals(fieldName)) { + deserializedTemplateProperties.withCategories(MetadataCategories.fromJson(reader)); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateProperties.withProviders(providers); + } else if ("firstPublishDate".equals(fieldName)) { + deserializedTemplateProperties.withFirstPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedTemplateProperties.withLastPublishDate( + reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString()))); + } else if ("customVersion".equals(fieldName)) { + deserializedTemplateProperties.withCustomVersion(reader.getString()); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedTemplateProperties.withContentSchemaVersion(reader.getString()); + } else if ("icon".equals(fieldName)) { + deserializedTemplateProperties.withIcon(reader.getString()); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateProperties.withThreatAnalysisTactics(threatAnalysisTactics); + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateProperties.withThreatAnalysisTechniques(threatAnalysisTechniques); + } else if ("previewImages".equals(fieldName)) { + List previewImages = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateProperties.withPreviewImages(previewImages); + } else if ("previewImagesDark".equals(fieldName)) { + List previewImagesDark = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateProperties.withPreviewImagesDark(previewImagesDark); + } else if ("packageId".equals(fieldName)) { + deserializedTemplateProperties.withPackageId(reader.getString()); + } else if ("packageKind".equals(fieldName)) { + deserializedTemplateProperties.withPackageKind(PackageKind.fromString(reader.getString())); + } else if ("packageName".equals(fieldName)) { + deserializedTemplateProperties.withPackageName(reader.getString()); + } else if ("isDeprecated".equals(fieldName)) { + deserializedTemplateProperties.isDeprecated = Flag.fromString(reader.getString()); + } else if ("mainTemplate".equals(fieldName)) { + deserializedTemplateProperties.mainTemplate = reader.readUntyped(); + } else if ("dependantTemplates".equals(fieldName)) { + List dependantTemplates + = reader.readArray(reader1 -> TemplateProperties.fromJson(reader1)); + deserializedTemplateProperties.dependantTemplates = dependantTemplates; + } else { + reader.skipChildren(); + } + } + + return deserializedTemplateProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceAlertRuleProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceAlertRuleProperties.java new file mode 100644 index 000000000000..77b005d19a22 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceAlertRuleProperties.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertSeverity; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Threat Intelligence alert rule base property bag. + */ +@Fluent +public final class ThreatIntelligenceAlertRuleProperties + implements JsonSerializable { + /* + * The Name of the alert rule template used to create this rule. + */ + private String alertRuleTemplateName; + + /* + * The description of the alert rule. + */ + private String description; + + /* + * The display name for alerts created by this alert rule. + */ + private String displayName; + + /* + * Determines whether this alert rule is enabled or disabled. + */ + private boolean enabled; + + /* + * The last time that this alert has been modified. + */ + private OffsetDateTime lastModifiedUtc; + + /* + * The severity for alerts created by this alert rule. + */ + private AlertSeverity severity; + + /* + * The tactics of the alert rule + */ + private List tactics; + + /* + * The techniques of the alert rule + */ + private List techniques; + + /* + * The sub-techniques of the alert rule + */ + private List subTechniques; + + /** + * Creates an instance of ThreatIntelligenceAlertRuleProperties class. + */ + public ThreatIntelligenceAlertRuleProperties() { + } + + /** + * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @return the alertRuleTemplateName value. + */ + public String alertRuleTemplateName() { + return this.alertRuleTemplateName; + } + + /** + * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @param alertRuleTemplateName the alertRuleTemplateName value to set. + * @return the ThreatIntelligenceAlertRuleProperties object itself. + */ + public ThreatIntelligenceAlertRuleProperties withAlertRuleTemplateName(String alertRuleTemplateName) { + this.alertRuleTemplateName = alertRuleTemplateName; + return this; + } + + /** + * Get the description property: The description of the alert rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the displayName property: The display name for alerts created by this alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the ThreatIntelligenceAlertRuleProperties object itself. + */ + public ThreatIntelligenceAlertRuleProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the lastModifiedUtc property: The last time that this alert has been modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.lastModifiedUtc; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.tactics; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.subTechniques; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (alertRuleTemplateName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property alertRuleTemplateName in model ThreatIntelligenceAlertRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThreatIntelligenceAlertRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("alertRuleTemplateName", this.alertRuleTemplateName); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreatIntelligenceAlertRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreatIntelligenceAlertRuleProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreatIntelligenceAlertRuleProperties. + */ + public static ThreatIntelligenceAlertRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThreatIntelligenceAlertRuleProperties deserializedThreatIntelligenceAlertRuleProperties + = new ThreatIntelligenceAlertRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertRuleTemplateName".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleProperties.alertRuleTemplateName = reader.getString(); + } else if ("enabled".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleProperties.enabled = reader.getBoolean(); + } else if ("description".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleProperties.description = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleProperties.displayName = reader.getString(); + } else if ("lastModifiedUtc".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleProperties.lastModifiedUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("severity".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleProperties.severity + = AlertSeverity.fromString(reader.getString()); + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedThreatIntelligenceAlertRuleProperties.tactics = tactics; + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedThreatIntelligenceAlertRuleProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedThreatIntelligenceAlertRuleProperties.subTechniques = subTechniques; + } else { + reader.skipChildren(); + } + } + + return deserializedThreatIntelligenceAlertRuleProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceAlertRuleTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceAlertRuleTemplateProperties.java new file mode 100644 index 000000000000..4650e842f5f3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceAlertRuleTemplateProperties.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; +import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateWithMitreProperties; +import com.azure.resourcemanager.securityinsights.models.AlertSeverity; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.TemplateStatus; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Threat Intelligence alert rule template properties. + */ +@Fluent +public final class ThreatIntelligenceAlertRuleTemplateProperties extends AlertRuleTemplateWithMitreProperties { + /* + * The severity for alerts created by this alert rule. + */ + private AlertSeverity severity; + + /* + * The time that this alert rule template has been added. + */ + private OffsetDateTime createdDateUtc; + + /* + * The last time that this alert rule template has been updated. + */ + private OffsetDateTime lastUpdatedDateUtc; + + /** + * Creates an instance of ThreatIntelligenceAlertRuleTemplateProperties class. + */ + public ThreatIntelligenceAlertRuleTemplateProperties() { + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the ThreatIntelligenceAlertRuleTemplateProperties object itself. + */ + public ThreatIntelligenceAlertRuleTemplateProperties withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + @Override + public OffsetDateTime createdDateUtc() { + return this.createdDateUtc; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + @Override + public OffsetDateTime lastUpdatedDateUtc() { + return this.lastUpdatedDateUtc; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRuleTemplateProperties withTactics(List tactics) { + super.withTactics(tactics); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRuleTemplateProperties withTechniques(List techniques) { + super.withTechniques(techniques); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRuleTemplateProperties + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + super.withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRuleTemplateProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRuleTemplateProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRuleTemplateProperties + withRequiredDataConnectors(List requiredDataConnectors) { + super.withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRuleTemplateProperties withStatus(TemplateStatus status) { + super.withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (severity() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property severity in model ThreatIntelligenceAlertRuleTemplateProperties")); + } + if (requiredDataConnectors() != null) { + requiredDataConnectors().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThreatIntelligenceAlertRuleTemplateProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", alertRulesCreatedByTemplateCount()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeArrayField("requiredDataConnectors", requiredDataConnectors(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("status", status() == null ? null : status().toString()); + jsonWriter.writeArrayField("tactics", tactics(), + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("techniques", techniques(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreatIntelligenceAlertRuleTemplateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreatIntelligenceAlertRuleTemplateProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreatIntelligenceAlertRuleTemplateProperties. + */ + public static ThreatIntelligenceAlertRuleTemplateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThreatIntelligenceAlertRuleTemplateProperties deserializedThreatIntelligenceAlertRuleTemplateProperties + = new ThreatIntelligenceAlertRuleTemplateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertRulesCreatedByTemplateCount".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplateProperties + .withAlertRulesCreatedByTemplateCount(reader.getNullable(JsonReader::getInt)); + } else if ("lastUpdatedDateUTC".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplateProperties.lastUpdatedDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateUTC".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplateProperties.createdDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("description".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplateProperties.withDescription(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplateProperties.withDisplayName(reader.getString()); + } else if ("requiredDataConnectors".equals(fieldName)) { + List requiredDataConnectors + = reader.readArray(reader1 -> AlertRuleTemplateDataSource.fromJson(reader1)); + deserializedThreatIntelligenceAlertRuleTemplateProperties + .withRequiredDataConnectors(requiredDataConnectors); + } else if ("status".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplateProperties + .withStatus(TemplateStatus.fromString(reader.getString())); + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedThreatIntelligenceAlertRuleTemplateProperties.withTactics(tactics); + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedThreatIntelligenceAlertRuleTemplateProperties.withTechniques(techniques); + } else if ("severity".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplateProperties.severity + = AlertSeverity.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedThreatIntelligenceAlertRuleTemplateProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceCountInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceCountInner.java new file mode 100644 index 000000000000..73420cbf22c4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/ThreatIntelligenceCountInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Count of all the threat intelligence objects on the workspace that match the provided query. + */ +@Immutable +public final class ThreatIntelligenceCountInner implements JsonSerializable { + /* + * Count of all the threat intelligence objects on the workspace that match the provided query. + */ + private int count; + + /** + * Creates an instance of ThreatIntelligenceCountInner class. + */ + public ThreatIntelligenceCountInner() { + } + + /** + * Get the count property: Count of all the threat intelligence objects on the workspace that match the provided + * query. + * + * @return the count value. + */ + public int count() { + return this.count; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreatIntelligenceCountInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreatIntelligenceCountInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreatIntelligenceCountInner. + */ + public static ThreatIntelligenceCountInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThreatIntelligenceCountInner deserializedThreatIntelligenceCountInner = new ThreatIntelligenceCountInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedThreatIntelligenceCountInner.count = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedThreatIntelligenceCountInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TiTaxiiCheckRequirementsProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TiTaxiiCheckRequirementsProperties.java new file mode 100644 index 000000000000..87d9bbdc2228 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TiTaxiiCheckRequirementsProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import java.io.IOException; + +/** + * Threat Intelligence TAXII data connector required properties. + */ +@Fluent +public final class TiTaxiiCheckRequirementsProperties extends DataConnectorTenantId { + /** + * Creates an instance of TiTaxiiCheckRequirementsProperties class. + */ + public TiTaxiiCheckRequirementsProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public TiTaxiiCheckRequirementsProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model TiTaxiiCheckRequirementsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TiTaxiiCheckRequirementsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TiTaxiiCheckRequirementsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TiTaxiiCheckRequirementsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TiTaxiiCheckRequirementsProperties. + */ + public static TiTaxiiCheckRequirementsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TiTaxiiCheckRequirementsProperties deserializedTiTaxiiCheckRequirementsProperties + = new TiTaxiiCheckRequirementsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedTiTaxiiCheckRequirementsProperties.withTenantId(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTiTaxiiCheckRequirementsProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TiTaxiiDataConnectorProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TiTaxiiDataConnectorProperties.java new file mode 100644 index 000000000000..e278bce65237 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TiTaxiiDataConnectorProperties.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.DataConnectorTenantId; +import com.azure.resourcemanager.securityinsights.models.PollingFrequency; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnectorDataTypes; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Threat Intelligence TAXII data connector properties. + */ +@Fluent +public final class TiTaxiiDataConnectorProperties extends DataConnectorTenantId { + /* + * The workspace id. + */ + private String workspaceId; + + /* + * The friendly name for the TAXII server. + */ + private String friendlyName; + + /* + * The API root for the TAXII server. + */ + private String taxiiServer; + + /* + * The collection id of the TAXII server. + */ + private String collectionId; + + /* + * The userName for the TAXII server. + */ + private String username; + + /* + * The password for the TAXII server. + */ + private String password; + + /* + * The lookback period for the TAXII server. + */ + private OffsetDateTime taxiiLookbackPeriod; + + /* + * The polling frequency for the TAXII server. + */ + private PollingFrequency pollingFrequency; + + /* + * The available data types for Threat Intelligence TAXII data connector. + */ + private TiTaxiiDataConnectorDataTypes dataTypes; + + /** + * Creates an instance of TiTaxiiDataConnectorProperties class. + */ + public TiTaxiiDataConnectorProperties() { + } + + /** + * Get the workspaceId property: The workspace id. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: The workspace id. + * + * @param workspaceId the workspaceId value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the friendlyName property: The friendly name for the TAXII server. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: The friendly name for the TAXII server. + * + * @param friendlyName the friendlyName value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the taxiiServer property: The API root for the TAXII server. + * + * @return the taxiiServer value. + */ + public String taxiiServer() { + return this.taxiiServer; + } + + /** + * Set the taxiiServer property: The API root for the TAXII server. + * + * @param taxiiServer the taxiiServer value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withTaxiiServer(String taxiiServer) { + this.taxiiServer = taxiiServer; + return this; + } + + /** + * Get the collectionId property: The collection id of the TAXII server. + * + * @return the collectionId value. + */ + public String collectionId() { + return this.collectionId; + } + + /** + * Set the collectionId property: The collection id of the TAXII server. + * + * @param collectionId the collectionId value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withCollectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + + /** + * Get the username property: The userName for the TAXII server. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The userName for the TAXII server. + * + * @param username the username value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password for the TAXII server. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password for the TAXII server. + * + * @param password the password value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the taxiiLookbackPeriod property: The lookback period for the TAXII server. + * + * @return the taxiiLookbackPeriod value. + */ + public OffsetDateTime taxiiLookbackPeriod() { + return this.taxiiLookbackPeriod; + } + + /** + * Set the taxiiLookbackPeriod property: The lookback period for the TAXII server. + * + * @param taxiiLookbackPeriod the taxiiLookbackPeriod value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withTaxiiLookbackPeriod(OffsetDateTime taxiiLookbackPeriod) { + this.taxiiLookbackPeriod = taxiiLookbackPeriod; + return this; + } + + /** + * Get the pollingFrequency property: The polling frequency for the TAXII server. + * + * @return the pollingFrequency value. + */ + public PollingFrequency pollingFrequency() { + return this.pollingFrequency; + } + + /** + * Set the pollingFrequency property: The polling frequency for the TAXII server. + * + * @param pollingFrequency the pollingFrequency value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withPollingFrequency(PollingFrequency pollingFrequency) { + this.pollingFrequency = pollingFrequency; + return this; + } + + /** + * Get the dataTypes property: The available data types for Threat Intelligence TAXII data connector. + * + * @return the dataTypes value. + */ + public TiTaxiiDataConnectorDataTypes dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: The available data types for Threat Intelligence TAXII data connector. + * + * @param dataTypes the dataTypes value to set. + * @return the TiTaxiiDataConnectorProperties object itself. + */ + public TiTaxiiDataConnectorProperties withDataTypes(TiTaxiiDataConnectorDataTypes dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TiTaxiiDataConnectorProperties withTenantId(String tenantId) { + super.withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (pollingFrequency() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pollingFrequency in model TiTaxiiDataConnectorProperties")); + } + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model TiTaxiiDataConnectorProperties")); + } else { + dataTypes().validate(); + } + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model TiTaxiiDataConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TiTaxiiDataConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", tenantId()); + jsonWriter.writeStringField("pollingFrequency", + this.pollingFrequency == null ? null : this.pollingFrequency.toString()); + jsonWriter.writeJsonField("dataTypes", this.dataTypes); + jsonWriter.writeStringField("workspaceId", this.workspaceId); + jsonWriter.writeStringField("friendlyName", this.friendlyName); + jsonWriter.writeStringField("taxiiServer", this.taxiiServer); + jsonWriter.writeStringField("collectionId", this.collectionId); + jsonWriter.writeStringField("userName", this.username); + jsonWriter.writeStringField("password", this.password); + jsonWriter.writeStringField("taxiiLookbackPeriod", + this.taxiiLookbackPeriod == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.taxiiLookbackPeriod)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TiTaxiiDataConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TiTaxiiDataConnectorProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TiTaxiiDataConnectorProperties. + */ + public static TiTaxiiDataConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TiTaxiiDataConnectorProperties deserializedTiTaxiiDataConnectorProperties + = new TiTaxiiDataConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.withTenantId(reader.getString()); + } else if ("pollingFrequency".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.pollingFrequency + = PollingFrequency.fromString(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.dataTypes + = TiTaxiiDataConnectorDataTypes.fromJson(reader); + } else if ("workspaceId".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.workspaceId = reader.getString(); + } else if ("friendlyName".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.friendlyName = reader.getString(); + } else if ("taxiiServer".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.taxiiServer = reader.getString(); + } else if ("collectionId".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.collectionId = reader.getString(); + } else if ("userName".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.password = reader.getString(); + } else if ("taxiiLookbackPeriod".equals(fieldName)) { + deserializedTiTaxiiDataConnectorProperties.taxiiLookbackPeriod = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedTiTaxiiDataConnectorProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TriggeredAnalyticsRuleRunInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TriggeredAnalyticsRuleRunInner.java new file mode 100644 index 000000000000..fa7d9f71f989 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TriggeredAnalyticsRuleRunInner.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * The triggered analytics rule run. + */ +@Fluent +public final class TriggeredAnalyticsRuleRunInner extends ResourceWithEtag { + /* + * The triggered analytics rule run Properties + */ + private TriggeredAnalyticsRuleRunProperties innerProperties = new TriggeredAnalyticsRuleRunProperties(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TriggeredAnalyticsRuleRunInner class. + */ + public TriggeredAnalyticsRuleRunInner() { + } + + /** + * Get the innerProperties property: The triggered analytics rule run Properties. + * + * @return the innerProperties value. + */ + private TriggeredAnalyticsRuleRunProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TriggeredAnalyticsRuleRunInner withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the executionTimeUtc property: The executionTimeUtc property. + * + * @return the executionTimeUtc value. + */ + public OffsetDateTime executionTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().executionTimeUtc(); + } + + /** + * Set the executionTimeUtc property: The executionTimeUtc property. + * + * @param executionTimeUtc the executionTimeUtc value to set. + * @return the TriggeredAnalyticsRuleRunInner object itself. + */ + public TriggeredAnalyticsRuleRunInner withExecutionTimeUtc(OffsetDateTime executionTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new TriggeredAnalyticsRuleRunProperties(); + } + this.innerProperties().withExecutionTimeUtc(executionTimeUtc); + return this; + } + + /** + * Get the ruleId property: The ruleId property. + * + * @return the ruleId value. + */ + public String ruleId() { + return this.innerProperties() == null ? null : this.innerProperties().ruleId(); + } + + /** + * Set the ruleId property: The ruleId property. + * + * @param ruleId the ruleId value to set. + * @return the TriggeredAnalyticsRuleRunInner object itself. + */ + public TriggeredAnalyticsRuleRunInner withRuleId(String ruleId) { + if (this.innerProperties() == null) { + this.innerProperties = new TriggeredAnalyticsRuleRunProperties(); + } + this.innerProperties().withRuleId(ruleId); + return this; + } + + /** + * Get the triggeredAnalyticsRuleRunId property: The triggeredAnalyticsRuleRunId property. + * + * @return the triggeredAnalyticsRuleRunId value. + */ + public String triggeredAnalyticsRuleRunId() { + return this.innerProperties() == null ? null : this.innerProperties().triggeredAnalyticsRuleRunId(); + } + + /** + * Set the triggeredAnalyticsRuleRunId property: The triggeredAnalyticsRuleRunId property. + * + * @param triggeredAnalyticsRuleRunId the triggeredAnalyticsRuleRunId value to set. + * @return the TriggeredAnalyticsRuleRunInner object itself. + */ + public TriggeredAnalyticsRuleRunInner withTriggeredAnalyticsRuleRunId(String triggeredAnalyticsRuleRunId) { + if (this.innerProperties() == null) { + this.innerProperties = new TriggeredAnalyticsRuleRunProperties(); + } + this.innerProperties().withTriggeredAnalyticsRuleRunId(triggeredAnalyticsRuleRunId); + return this; + } + + /** + * Get the provisioningState property: The triggered analytics rule run provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: The triggered analytics rule run provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the TriggeredAnalyticsRuleRunInner object itself. + */ + public TriggeredAnalyticsRuleRunInner withProvisioningState(ProvisioningState provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new TriggeredAnalyticsRuleRunProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Get the ruleRunAdditionalData property: Dictionary of <any>. + * + * @return the ruleRunAdditionalData value. + */ + public Map ruleRunAdditionalData() { + return this.innerProperties() == null ? null : this.innerProperties().ruleRunAdditionalData(); + } + + /** + * Set the ruleRunAdditionalData property: Dictionary of <any>. + * + * @param ruleRunAdditionalData the ruleRunAdditionalData value to set. + * @return the TriggeredAnalyticsRuleRunInner object itself. + */ + public TriggeredAnalyticsRuleRunInner withRuleRunAdditionalData(Map ruleRunAdditionalData) { + if (this.innerProperties() == null) { + this.innerProperties = new TriggeredAnalyticsRuleRunProperties(); + } + this.innerProperties().withRuleRunAdditionalData(ruleRunAdditionalData); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model TriggeredAnalyticsRuleRunInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TriggeredAnalyticsRuleRunInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TriggeredAnalyticsRuleRunInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TriggeredAnalyticsRuleRunInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TriggeredAnalyticsRuleRunInner. + */ + public static TriggeredAnalyticsRuleRunInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TriggeredAnalyticsRuleRunInner deserializedTriggeredAnalyticsRuleRunInner + = new TriggeredAnalyticsRuleRunInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunInner.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunInner.innerProperties + = TriggeredAnalyticsRuleRunProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTriggeredAnalyticsRuleRunInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TriggeredAnalyticsRuleRunProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TriggeredAnalyticsRuleRunProperties.java new file mode 100644 index 000000000000..2a80789c5ca3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/TriggeredAnalyticsRuleRunProperties.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Map; + +/** + * The triggered analytics rule run Properties. + */ +@Fluent +public final class TriggeredAnalyticsRuleRunProperties + implements JsonSerializable { + /* + * The executionTimeUtc property. + */ + private OffsetDateTime executionTimeUtc; + + /* + * The ruleId property. + */ + private String ruleId; + + /* + * The triggeredAnalyticsRuleRunId property. + */ + private String triggeredAnalyticsRuleRunId; + + /* + * The triggered analytics rule run provisioning state + */ + private ProvisioningState provisioningState; + + /* + * Dictionary of + */ + private Map ruleRunAdditionalData; + + /** + * Creates an instance of TriggeredAnalyticsRuleRunProperties class. + */ + public TriggeredAnalyticsRuleRunProperties() { + } + + /** + * Get the executionTimeUtc property: The executionTimeUtc property. + * + * @return the executionTimeUtc value. + */ + public OffsetDateTime executionTimeUtc() { + return this.executionTimeUtc; + } + + /** + * Set the executionTimeUtc property: The executionTimeUtc property. + * + * @param executionTimeUtc the executionTimeUtc value to set. + * @return the TriggeredAnalyticsRuleRunProperties object itself. + */ + public TriggeredAnalyticsRuleRunProperties withExecutionTimeUtc(OffsetDateTime executionTimeUtc) { + this.executionTimeUtc = executionTimeUtc; + return this; + } + + /** + * Get the ruleId property: The ruleId property. + * + * @return the ruleId value. + */ + public String ruleId() { + return this.ruleId; + } + + /** + * Set the ruleId property: The ruleId property. + * + * @param ruleId the ruleId value to set. + * @return the TriggeredAnalyticsRuleRunProperties object itself. + */ + public TriggeredAnalyticsRuleRunProperties withRuleId(String ruleId) { + this.ruleId = ruleId; + return this; + } + + /** + * Get the triggeredAnalyticsRuleRunId property: The triggeredAnalyticsRuleRunId property. + * + * @return the triggeredAnalyticsRuleRunId value. + */ + public String triggeredAnalyticsRuleRunId() { + return this.triggeredAnalyticsRuleRunId; + } + + /** + * Set the triggeredAnalyticsRuleRunId property: The triggeredAnalyticsRuleRunId property. + * + * @param triggeredAnalyticsRuleRunId the triggeredAnalyticsRuleRunId value to set. + * @return the TriggeredAnalyticsRuleRunProperties object itself. + */ + public TriggeredAnalyticsRuleRunProperties withTriggeredAnalyticsRuleRunId(String triggeredAnalyticsRuleRunId) { + this.triggeredAnalyticsRuleRunId = triggeredAnalyticsRuleRunId; + return this; + } + + /** + * Get the provisioningState property: The triggered analytics rule run provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The triggered analytics rule run provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the TriggeredAnalyticsRuleRunProperties object itself. + */ + public TriggeredAnalyticsRuleRunProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the ruleRunAdditionalData property: Dictionary of <any>. + * + * @return the ruleRunAdditionalData value. + */ + public Map ruleRunAdditionalData() { + return this.ruleRunAdditionalData; + } + + /** + * Set the ruleRunAdditionalData property: Dictionary of <any>. + * + * @param ruleRunAdditionalData the ruleRunAdditionalData value to set. + * @return the TriggeredAnalyticsRuleRunProperties object itself. + */ + public TriggeredAnalyticsRuleRunProperties withRuleRunAdditionalData(Map ruleRunAdditionalData) { + this.ruleRunAdditionalData = ruleRunAdditionalData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (executionTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionTimeUtc in model TriggeredAnalyticsRuleRunProperties")); + } + if (ruleId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property ruleId in model TriggeredAnalyticsRuleRunProperties")); + } + if (triggeredAnalyticsRuleRunId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property triggeredAnalyticsRuleRunId in model TriggeredAnalyticsRuleRunProperties")); + } + if (provisioningState() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property provisioningState in model TriggeredAnalyticsRuleRunProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TriggeredAnalyticsRuleRunProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("executionTimeUtc", + this.executionTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.executionTimeUtc)); + jsonWriter.writeStringField("ruleId", this.ruleId); + jsonWriter.writeStringField("triggeredAnalyticsRuleRunId", this.triggeredAnalyticsRuleRunId); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeMapField("ruleRunAdditionalData", this.ruleRunAdditionalData, + (writer, element) -> writer.writeUntyped(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TriggeredAnalyticsRuleRunProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TriggeredAnalyticsRuleRunProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TriggeredAnalyticsRuleRunProperties. + */ + public static TriggeredAnalyticsRuleRunProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TriggeredAnalyticsRuleRunProperties deserializedTriggeredAnalyticsRuleRunProperties + = new TriggeredAnalyticsRuleRunProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("executionTimeUtc".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunProperties.executionTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("ruleId".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunProperties.ruleId = reader.getString(); + } else if ("triggeredAnalyticsRuleRunId".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunProperties.triggeredAnalyticsRuleRunId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRunProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("ruleRunAdditionalData".equals(fieldName)) { + Map ruleRunAdditionalData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedTriggeredAnalyticsRuleRunProperties.ruleRunAdditionalData = ruleRunAdditionalData; + } else { + reader.skipChildren(); + } + } + + return deserializedTriggeredAnalyticsRuleRunProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/UebaProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/UebaProperties.java new file mode 100644 index 000000000000..273c852cb494 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/UebaProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.UebaDataSources; +import java.io.IOException; +import java.util.List; + +/** + * Ueba property bag. + */ +@Fluent +public final class UebaProperties implements JsonSerializable { + /* + * The relevant data sources that enriched by ueba + */ + private List dataSources; + + /** + * Creates an instance of UebaProperties class. + */ + public UebaProperties() { + } + + /** + * Get the dataSources property: The relevant data sources that enriched by ueba. + * + * @return the dataSources value. + */ + public List dataSources() { + return this.dataSources; + } + + /** + * Set the dataSources property: The relevant data sources that enriched by ueba. + * + * @param dataSources the dataSources value to set. + * @return the UebaProperties object itself. + */ + public UebaProperties withDataSources(List dataSources) { + this.dataSources = dataSources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dataSources", this.dataSources, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UebaProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UebaProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UebaProperties. + */ + public static UebaProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UebaProperties deserializedUebaProperties = new UebaProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataSources".equals(fieldName)) { + List dataSources + = reader.readArray(reader1 -> UebaDataSources.fromString(reader1.getString())); + deserializedUebaProperties.dataSources = dataSources; + } else { + reader.skipChildren(); + } + } + + return deserializedUebaProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WarningInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WarningInner.java new file mode 100644 index 000000000000..e3d1fc37dc49 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WarningInner.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.WarningBody; +import java.io.IOException; + +/** + * Warning response structure. + */ +@Immutable +public final class WarningInner implements JsonSerializable { + /* + * Warning data. + */ + private WarningBody warning; + + /** + * Creates an instance of WarningInner class. + */ + public WarningInner() { + } + + /** + * Get the warning property: Warning data. + * + * @return the warning value. + */ + public WarningBody warning() { + return this.warning; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (warning() != null) { + warning().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WarningInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WarningInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the WarningInner. + */ + public static WarningInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WarningInner deserializedWarningInner = new WarningInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("warning".equals(fieldName)) { + deserializedWarningInner.warning = WarningBody.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWarningInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistInner.java index f1c148d085ba..ef2be830d20c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistInner.java @@ -9,8 +9,9 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; -import com.azure.resourcemanager.securityinsights.models.Source; +import com.azure.resourcemanager.securityinsights.models.SourceType; import com.azure.resourcemanager.securityinsights.models.UserInfo; import java.io.IOException; import java.time.Duration; @@ -181,21 +182,21 @@ public WatchlistInner withProvider(String provider) { } /** - * Get the source property: The source of the watchlist. + * Get the source property: The filename of the watchlist, called 'source'. * * @return the source value. */ - public Source source() { + public String source() { return this.innerProperties() == null ? null : this.innerProperties().source(); } /** - * Set the source property: The source of the watchlist. + * Set the source property: The filename of the watchlist, called 'source'. * * @param source the source value to set. * @return the WatchlistInner object itself. */ - public WatchlistInner withSource(Source source) { + public WatchlistInner withSource(String source) { if (this.innerProperties() == null) { this.innerProperties = new WatchlistProperties(); } @@ -203,6 +204,29 @@ public WatchlistInner withSource(Source source) { return this; } + /** + * Get the sourceType property: The sourceType of the watchlist. + * + * @return the sourceType value. + */ + public SourceType sourceType() { + return this.innerProperties() == null ? null : this.innerProperties().sourceType(); + } + + /** + * Set the sourceType property: The sourceType of the watchlist. + * + * @param sourceType the sourceType value to set. + * @return the WatchlistInner object itself. + */ + public WatchlistInner withSourceType(SourceType sourceType) { + if (this.innerProperties() == null) { + this.innerProperties = new WatchlistProperties(); + } + this.innerProperties().withSourceType(sourceType); + return this; + } + /** * Get the created property: The time the watchlist was created. * @@ -457,7 +481,7 @@ public WatchlistInner withTenantId(String tenantId) { } /** - * Get the numberOfLinesToSkip property: The number of lines in a csv content to skip before the header. + * Get the numberOfLinesToSkip property: The number of lines in a csv/tsv content to skip before the header. * * @return the numberOfLinesToSkip value. */ @@ -466,7 +490,7 @@ public Integer numberOfLinesToSkip() { } /** - * Set the numberOfLinesToSkip property: The number of lines in a csv content to skip before the header. + * Set the numberOfLinesToSkip property: The number of lines in a csv/tsv content to skip before the header. * * @param numberOfLinesToSkip the numberOfLinesToSkip value to set. * @return the WatchlistInner object itself. @@ -480,10 +504,8 @@ public WatchlistInner withNumberOfLinesToSkip(Integer numberOfLinesToSkip) { } /** - * Get the rawContent property: The raw content that represents to watchlist items to create. Example : This line - * will be skipped - * header1,header2 - * value1,value2. + * Get the rawContent property: The raw content that represents to watchlist items to create. In case of csv/tsv + * content type, it's the content of the file that will parsed by the endpoint. * * @return the rawContent value. */ @@ -492,10 +514,8 @@ public String rawContent() { } /** - * Set the rawContent property: The raw content that represents to watchlist items to create. Example : This line - * will be skipped - * header1,header2 - * value1,value2. + * Set the rawContent property: The raw content that represents to watchlist items to create. In case of csv/tsv + * content type, it's the content of the file that will parsed by the endpoint. * * @param rawContent the rawContent value to set. * @return the WatchlistInner object itself. @@ -536,7 +556,7 @@ public WatchlistInner withItemsSearchKey(String itemsSearchKey) { } /** - * Get the contentType property: The content type of the raw content. For now, only text/csv is valid. + * Get the contentType property: The content type of the raw content. Example : text/csv or text/tsv. * * @return the contentType value. */ @@ -545,7 +565,7 @@ public String contentType() { } /** - * Set the contentType property: The content type of the raw content. For now, only text/csv is valid. + * Set the contentType property: The content type of the raw content. Example : text/csv or text/tsv. * * @param contentType the contentType value to set. * @return the WatchlistInner object itself. @@ -559,8 +579,8 @@ public WatchlistInner withContentType(String contentType) { } /** - * Get the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. **Note** : When - * a Watchlist upload status is InProgress, the Watchlist cannot be deleted. + * Get the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. Pls note : When + * a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. * * @return the uploadStatus value. */ @@ -569,8 +589,8 @@ public String uploadStatus() { } /** - * Set the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. **Note** : When - * a Watchlist upload status is InProgress, the Watchlist cannot be deleted. + * Set the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. Pls note : When + * a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. * * @param uploadStatus the uploadStatus value to set. * @return the WatchlistInner object itself. @@ -583,6 +603,29 @@ public WatchlistInner withUploadStatus(String uploadStatus) { return this; } + /** + * Get the provisioningState property: The triggered analytics rule run provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: The triggered analytics rule run provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the WatchlistInner object itself. + */ + public WatchlistInner withProvisioningState(ProvisioningState provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new WatchlistProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistItemInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistItemInner.java index 29b647f184b2..e7f7640ace5f 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistItemInner.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistItemInner.java @@ -15,7 +15,7 @@ import java.time.OffsetDateTime; /** - * Represents a Watchlist Item in Azure Security Insights. + * Represents a Watchlist item in Azure Security Insights. */ @Fluent public final class WatchlistItemInner extends ResourceWithEtag { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistProperties.java index 4f771bbc5193..4ab4db6f0912 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WatchlistProperties.java @@ -11,7 +11,8 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.azure.resourcemanager.securityinsights.models.Source; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import com.azure.resourcemanager.securityinsights.models.SourceType; import com.azure.resourcemanager.securityinsights.models.UserInfo; import java.io.IOException; import java.time.Duration; @@ -40,9 +41,14 @@ public final class WatchlistProperties implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); @@ -672,6 +719,9 @@ public static WatchlistProperties fromJson(JsonReader jsonReader) throws IOExcep deserializedWatchlistProperties.contentType = reader.getString(); } else if ("uploadStatus".equals(fieldName)) { deserializedWatchlistProperties.uploadStatus = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedWatchlistProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerAssignmentInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerAssignmentInner.java new file mode 100644 index 000000000000..69d9e02fbf37 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerAssignmentInner.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AssignmentItem; +import com.azure.resourcemanager.securityinsights.models.AzureEntityResource; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The workspace manager assignment. + */ +@Fluent +public final class WorkspaceManagerAssignmentInner extends AzureEntityResource { + /* + * The workspace manager assignment object + */ + private WorkspaceManagerAssignmentProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Resource Etag. + */ + private String etag; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspaceManagerAssignmentInner class. + */ + public WorkspaceManagerAssignmentInner() { + } + + /** + * Get the innerProperties property: The workspace manager assignment object. + * + * @return the innerProperties value. + */ + private WorkspaceManagerAssignmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the targetResourceName property: The resource name of the workspace manager group targeted by the workspace + * manager assignment. + * + * @return the targetResourceName value. + */ + public String targetResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceName(); + } + + /** + * Set the targetResourceName property: The resource name of the workspace manager group targeted by the workspace + * manager assignment. + * + * @param targetResourceName the targetResourceName value to set. + * @return the WorkspaceManagerAssignmentInner object itself. + */ + public WorkspaceManagerAssignmentInner withTargetResourceName(String targetResourceName) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerAssignmentProperties(); + } + this.innerProperties().withTargetResourceName(targetResourceName); + return this; + } + + /** + * Get the lastJobEndTime property: The time the last job associated to this assignment ended at. + * + * @return the lastJobEndTime value. + */ + public OffsetDateTime lastJobEndTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastJobEndTime(); + } + + /** + * Get the lastJobProvisioningState property: State of the last job associated to this assignment. + * + * @return the lastJobProvisioningState value. + */ + public ProvisioningState lastJobProvisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().lastJobProvisioningState(); + } + + /** + * Get the items property: List of resources included in this workspace manager assignment. + * + * @return the items value. + */ + public List items() { + return this.innerProperties() == null ? null : this.innerProperties().items(); + } + + /** + * Set the items property: List of resources included in this workspace manager assignment. + * + * @param items the items value to set. + * @return the WorkspaceManagerAssignmentInner object itself. + */ + public WorkspaceManagerAssignmentInner withItems(List items) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerAssignmentProperties(); + } + this.innerProperties().withItems(items); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerAssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerAssignmentInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerAssignmentInner. + */ + public static WorkspaceManagerAssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerAssignmentInner deserializedWorkspaceManagerAssignmentInner + = new WorkspaceManagerAssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentInner.innerProperties + = WorkspaceManagerAssignmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerAssignmentInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerAssignmentProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerAssignmentProperties.java new file mode 100644 index 000000000000..4206552663a5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerAssignmentProperties.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AssignmentItem; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The workspace manager assignment properties. + */ +@Fluent +public final class WorkspaceManagerAssignmentProperties + implements JsonSerializable { + /* + * The resource name of the workspace manager group targeted by the workspace manager assignment + */ + private String targetResourceName; + + /* + * The time the last job associated to this assignment ended at + */ + private OffsetDateTime lastJobEndTime; + + /* + * State of the last job associated to this assignment + */ + private ProvisioningState lastJobProvisioningState; + + /* + * List of resources included in this workspace manager assignment + */ + private List items; + + /** + * Creates an instance of WorkspaceManagerAssignmentProperties class. + */ + public WorkspaceManagerAssignmentProperties() { + } + + /** + * Get the targetResourceName property: The resource name of the workspace manager group targeted by the workspace + * manager assignment. + * + * @return the targetResourceName value. + */ + public String targetResourceName() { + return this.targetResourceName; + } + + /** + * Set the targetResourceName property: The resource name of the workspace manager group targeted by the workspace + * manager assignment. + * + * @param targetResourceName the targetResourceName value to set. + * @return the WorkspaceManagerAssignmentProperties object itself. + */ + public WorkspaceManagerAssignmentProperties withTargetResourceName(String targetResourceName) { + this.targetResourceName = targetResourceName; + return this; + } + + /** + * Get the lastJobEndTime property: The time the last job associated to this assignment ended at. + * + * @return the lastJobEndTime value. + */ + public OffsetDateTime lastJobEndTime() { + return this.lastJobEndTime; + } + + /** + * Get the lastJobProvisioningState property: State of the last job associated to this assignment. + * + * @return the lastJobProvisioningState value. + */ + public ProvisioningState lastJobProvisioningState() { + return this.lastJobProvisioningState; + } + + /** + * Get the items property: List of resources included in this workspace manager assignment. + * + * @return the items value. + */ + public List items() { + return this.items; + } + + /** + * Set the items property: List of resources included in this workspace manager assignment. + * + * @param items the items value to set. + * @return the WorkspaceManagerAssignmentProperties object itself. + */ + public WorkspaceManagerAssignmentProperties withItems(List items) { + this.items = items; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetResourceName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetResourceName in model WorkspaceManagerAssignmentProperties")); + } + if (items() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property items in model WorkspaceManagerAssignmentProperties")); + } else { + items().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerAssignmentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetResourceName", this.targetResourceName); + jsonWriter.writeArrayField("items", this.items, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerAssignmentProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerAssignmentProperties. + */ + public static WorkspaceManagerAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerAssignmentProperties deserializedWorkspaceManagerAssignmentProperties + = new WorkspaceManagerAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetResourceName".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentProperties.targetResourceName = reader.getString(); + } else if ("items".equals(fieldName)) { + List items = reader.readArray(reader1 -> AssignmentItem.fromJson(reader1)); + deserializedWorkspaceManagerAssignmentProperties.items = items; + } else if ("lastJobEndTime".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentProperties.lastJobEndTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastJobProvisioningState".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentProperties.lastJobProvisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerAssignmentProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerConfigurationInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerConfigurationInner.java new file mode 100644 index 000000000000..227c90989516 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerConfigurationInner.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AzureEntityResource; +import com.azure.resourcemanager.securityinsights.models.Mode; +import java.io.IOException; + +/** + * The workspace manager configuration. + */ +@Fluent +public final class WorkspaceManagerConfigurationInner extends AzureEntityResource { + /* + * The workspace manager configuration object + */ + private WorkspaceManagerConfigurationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Resource Etag. + */ + private String etag; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspaceManagerConfigurationInner class. + */ + public WorkspaceManagerConfigurationInner() { + } + + /** + * Get the innerProperties property: The workspace manager configuration object. + * + * @return the innerProperties value. + */ + private WorkspaceManagerConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the mode property: The current mode of the workspace manager configuration. + * + * @return the mode value. + */ + public Mode mode() { + return this.innerProperties() == null ? null : this.innerProperties().mode(); + } + + /** + * Set the mode property: The current mode of the workspace manager configuration. + * + * @param mode the mode value to set. + * @return the WorkspaceManagerConfigurationInner object itself. + */ + public WorkspaceManagerConfigurationInner withMode(Mode mode) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerConfigurationProperties(); + } + this.innerProperties().withMode(mode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerConfigurationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerConfigurationInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerConfigurationInner. + */ + public static WorkspaceManagerConfigurationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerConfigurationInner deserializedWorkspaceManagerConfigurationInner + = new WorkspaceManagerConfigurationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationInner.innerProperties + = WorkspaceManagerConfigurationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerConfigurationInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerConfigurationProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerConfigurationProperties.java new file mode 100644 index 000000000000..8d1a29d9aa4a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerConfigurationProperties.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.Mode; +import java.io.IOException; + +/** + * The workspace manager configuration properties. + */ +@Fluent +public final class WorkspaceManagerConfigurationProperties + implements JsonSerializable { + /* + * The current mode of the workspace manager configuration + */ + private Mode mode; + + /** + * Creates an instance of WorkspaceManagerConfigurationProperties class. + */ + public WorkspaceManagerConfigurationProperties() { + } + + /** + * Get the mode property: The current mode of the workspace manager configuration. + * + * @return the mode value. + */ + public Mode mode() { + return this.mode; + } + + /** + * Set the mode property: The current mode of the workspace manager configuration. + * + * @param mode the mode value to set. + * @return the WorkspaceManagerConfigurationProperties object itself. + */ + public WorkspaceManagerConfigurationProperties withMode(Mode mode) { + this.mode = mode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mode() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property mode in model WorkspaceManagerConfigurationProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerConfigurationProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerConfigurationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerConfigurationProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerConfigurationProperties. + */ + public static WorkspaceManagerConfigurationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerConfigurationProperties deserializedWorkspaceManagerConfigurationProperties + = new WorkspaceManagerConfigurationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationProperties.mode = Mode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerConfigurationProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerGroupInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerGroupInner.java new file mode 100644 index 000000000000..8a686ee24ec4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerGroupInner.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AzureEntityResource; +import java.io.IOException; +import java.util.List; + +/** + * The workspace manager group. + */ +@Fluent +public final class WorkspaceManagerGroupInner extends AzureEntityResource { + /* + * The workspace manager group object + */ + private WorkspaceManagerGroupProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Resource Etag. + */ + private String etag; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspaceManagerGroupInner class. + */ + public WorkspaceManagerGroupInner() { + } + + /** + * Get the innerProperties property: The workspace manager group object. + * + * @return the innerProperties value. + */ + private WorkspaceManagerGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the description property: The description of the workspace manager group. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the workspace manager group. + * + * @param description the description value to set. + * @return the WorkspaceManagerGroupInner object itself. + */ + public WorkspaceManagerGroupInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerGroupProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the displayName property: The display name of the workspace manager group. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the workspace manager group. + * + * @param displayName the displayName value to set. + * @return the WorkspaceManagerGroupInner object itself. + */ + public WorkspaceManagerGroupInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerGroupProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the memberResourceNames property: The names of the workspace manager members participating in this group. + * + * @return the memberResourceNames value. + */ + public List memberResourceNames() { + return this.innerProperties() == null ? null : this.innerProperties().memberResourceNames(); + } + + /** + * Set the memberResourceNames property: The names of the workspace manager members participating in this group. + * + * @param memberResourceNames the memberResourceNames value to set. + * @return the WorkspaceManagerGroupInner object itself. + */ + public WorkspaceManagerGroupInner withMemberResourceNames(List memberResourceNames) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerGroupProperties(); + } + this.innerProperties().withMemberResourceNames(memberResourceNames); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerGroupInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerGroupInner. + */ + public static WorkspaceManagerGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerGroupInner deserializedWorkspaceManagerGroupInner = new WorkspaceManagerGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceManagerGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceManagerGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceManagerGroupInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedWorkspaceManagerGroupInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspaceManagerGroupInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceManagerGroupInner.innerProperties + = WorkspaceManagerGroupProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerGroupInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerGroupProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerGroupProperties.java new file mode 100644 index 000000000000..96ec22b39b6d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerGroupProperties.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The workspace manager group properties. + */ +@Fluent +public final class WorkspaceManagerGroupProperties implements JsonSerializable { + /* + * The description of the workspace manager group + */ + private String description; + + /* + * The display name of the workspace manager group + */ + private String displayName; + + /* + * The names of the workspace manager members participating in this group. + */ + private List memberResourceNames; + + /** + * Creates an instance of WorkspaceManagerGroupProperties class. + */ + public WorkspaceManagerGroupProperties() { + } + + /** + * Get the description property: The description of the workspace manager group. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the workspace manager group. + * + * @param description the description value to set. + * @return the WorkspaceManagerGroupProperties object itself. + */ + public WorkspaceManagerGroupProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the displayName property: The display name of the workspace manager group. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the workspace manager group. + * + * @param displayName the displayName value to set. + * @return the WorkspaceManagerGroupProperties object itself. + */ + public WorkspaceManagerGroupProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the memberResourceNames property: The names of the workspace manager members participating in this group. + * + * @return the memberResourceNames value. + */ + public List memberResourceNames() { + return this.memberResourceNames; + } + + /** + * Set the memberResourceNames property: The names of the workspace manager members participating in this group. + * + * @param memberResourceNames the memberResourceNames value to set. + * @return the WorkspaceManagerGroupProperties object itself. + */ + public WorkspaceManagerGroupProperties withMemberResourceNames(List memberResourceNames) { + this.memberResourceNames = memberResourceNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property displayName in model WorkspaceManagerGroupProperties")); + } + if (memberResourceNames() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property memberResourceNames in model WorkspaceManagerGroupProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerGroupProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeArrayField("memberResourceNames", this.memberResourceNames, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerGroupProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerGroupProperties. + */ + public static WorkspaceManagerGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerGroupProperties deserializedWorkspaceManagerGroupProperties + = new WorkspaceManagerGroupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedWorkspaceManagerGroupProperties.displayName = reader.getString(); + } else if ("memberResourceNames".equals(fieldName)) { + List memberResourceNames = reader.readArray(reader1 -> reader1.getString()); + deserializedWorkspaceManagerGroupProperties.memberResourceNames = memberResourceNames; + } else if ("description".equals(fieldName)) { + deserializedWorkspaceManagerGroupProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerGroupProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerMemberInner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerMemberInner.java new file mode 100644 index 000000000000..361525cac69a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerMemberInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.models.AzureEntityResource; +import java.io.IOException; + +/** + * The workspace manager member. + */ +@Fluent +public final class WorkspaceManagerMemberInner extends AzureEntityResource { + /* + * The workspace manager member object + */ + private WorkspaceManagerMemberProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Resource Etag. + */ + private String etag; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspaceManagerMemberInner class. + */ + public WorkspaceManagerMemberInner() { + } + + /** + * Get the innerProperties property: The workspace manager member object. + * + * @return the innerProperties value. + */ + private WorkspaceManagerMemberProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the targetWorkspaceResourceId property: Fully qualified resource ID of the target Sentinel workspace joining + * the given Sentinel workspace manager. + * + * @return the targetWorkspaceResourceId value. + */ + public String targetWorkspaceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetWorkspaceResourceId(); + } + + /** + * Set the targetWorkspaceResourceId property: Fully qualified resource ID of the target Sentinel workspace joining + * the given Sentinel workspace manager. + * + * @param targetWorkspaceResourceId the targetWorkspaceResourceId value to set. + * @return the WorkspaceManagerMemberInner object itself. + */ + public WorkspaceManagerMemberInner withTargetWorkspaceResourceId(String targetWorkspaceResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerMemberProperties(); + } + this.innerProperties().withTargetWorkspaceResourceId(targetWorkspaceResourceId); + return this; + } + + /** + * Get the targetWorkspaceTenantId property: Tenant id of the target Sentinel workspace joining the given Sentinel + * workspace manager. + * + * @return the targetWorkspaceTenantId value. + */ + public String targetWorkspaceTenantId() { + return this.innerProperties() == null ? null : this.innerProperties().targetWorkspaceTenantId(); + } + + /** + * Set the targetWorkspaceTenantId property: Tenant id of the target Sentinel workspace joining the given Sentinel + * workspace manager. + * + * @param targetWorkspaceTenantId the targetWorkspaceTenantId value to set. + * @return the WorkspaceManagerMemberInner object itself. + */ + public WorkspaceManagerMemberInner withTargetWorkspaceTenantId(String targetWorkspaceTenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceManagerMemberProperties(); + } + this.innerProperties().withTargetWorkspaceTenantId(targetWorkspaceTenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerMemberInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerMemberInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerMemberInner. + */ + public static WorkspaceManagerMemberInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerMemberInner deserializedWorkspaceManagerMemberInner = new WorkspaceManagerMemberInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceManagerMemberInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceManagerMemberInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceManagerMemberInner.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedWorkspaceManagerMemberInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspaceManagerMemberInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceManagerMemberInner.innerProperties + = WorkspaceManagerMemberProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerMemberInner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerMemberProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerMemberProperties.java new file mode 100644 index 000000000000..b0366a495959 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/fluent/models/WorkspaceManagerMemberProperties.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The workspace manager member properties. + */ +@Fluent +public final class WorkspaceManagerMemberProperties implements JsonSerializable { + /* + * Fully qualified resource ID of the target Sentinel workspace joining the given Sentinel workspace manager + */ + private String targetWorkspaceResourceId; + + /* + * Tenant id of the target Sentinel workspace joining the given Sentinel workspace manager + */ + private String targetWorkspaceTenantId; + + /** + * Creates an instance of WorkspaceManagerMemberProperties class. + */ + public WorkspaceManagerMemberProperties() { + } + + /** + * Get the targetWorkspaceResourceId property: Fully qualified resource ID of the target Sentinel workspace joining + * the given Sentinel workspace manager. + * + * @return the targetWorkspaceResourceId value. + */ + public String targetWorkspaceResourceId() { + return this.targetWorkspaceResourceId; + } + + /** + * Set the targetWorkspaceResourceId property: Fully qualified resource ID of the target Sentinel workspace joining + * the given Sentinel workspace manager. + * + * @param targetWorkspaceResourceId the targetWorkspaceResourceId value to set. + * @return the WorkspaceManagerMemberProperties object itself. + */ + public WorkspaceManagerMemberProperties withTargetWorkspaceResourceId(String targetWorkspaceResourceId) { + this.targetWorkspaceResourceId = targetWorkspaceResourceId; + return this; + } + + /** + * Get the targetWorkspaceTenantId property: Tenant id of the target Sentinel workspace joining the given Sentinel + * workspace manager. + * + * @return the targetWorkspaceTenantId value. + */ + public String targetWorkspaceTenantId() { + return this.targetWorkspaceTenantId; + } + + /** + * Set the targetWorkspaceTenantId property: Tenant id of the target Sentinel workspace joining the given Sentinel + * workspace manager. + * + * @param targetWorkspaceTenantId the targetWorkspaceTenantId value to set. + * @return the WorkspaceManagerMemberProperties object itself. + */ + public WorkspaceManagerMemberProperties withTargetWorkspaceTenantId(String targetWorkspaceTenantId) { + this.targetWorkspaceTenantId = targetWorkspaceTenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetWorkspaceResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetWorkspaceResourceId in model WorkspaceManagerMemberProperties")); + } + if (targetWorkspaceTenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetWorkspaceTenantId in model WorkspaceManagerMemberProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerMemberProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetWorkspaceResourceId", this.targetWorkspaceResourceId); + jsonWriter.writeStringField("targetWorkspaceTenantId", this.targetWorkspaceTenantId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerMemberProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerMemberProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerMemberProperties. + */ + public static WorkspaceManagerMemberProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerMemberProperties deserializedWorkspaceManagerMemberProperties + = new WorkspaceManagerMemberProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetWorkspaceResourceId".equals(fieldName)) { + deserializedWorkspaceManagerMemberProperties.targetWorkspaceResourceId = reader.getString(); + } else if ("targetWorkspaceTenantId".equals(fieldName)) { + deserializedWorkspaceManagerMemberProperties.targetWorkspaceTenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerMemberProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ActionImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ActionImpl.java new file mode 100644 index 000000000000..be2b9313dff8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ActionImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; +import com.azure.resourcemanager.securityinsights.models.Action; +import com.azure.resourcemanager.securityinsights.models.ListActionKind; + +public final class ActionImpl implements Action { + private ActionInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + ActionImpl(ActionInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ListActionKind kind() { + return this.innerModel().kind(); + } + + public ActionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/AlertRuleOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/AlertRuleOperationsClientImpl.java new file mode 100644 index 000000000000..0d1c4c240e04 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/AlertRuleOperationsClientImpl.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.securityinsights.fluent.AlertRuleOperationsClient; +import com.azure.resourcemanager.securityinsights.models.AnalyticsRuleRunTrigger; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AlertRuleOperationsClient. + */ +public final class AlertRuleOperationsClientImpl implements AlertRuleOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AlertRuleOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of AlertRuleOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AlertRuleOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(AlertRuleOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsAlertRuleOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsAler") + public interface AlertRuleOperationsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/triggerRuleRun") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> triggerRuleRun(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("ruleId") String ruleId, + @BodyParam("application/json") AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerRuleRunWithResponseAsync(String resourceGroupName, + String workspaceName, String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (analyticsRuleRunTriggerParameter == null) { + return Mono.error(new IllegalArgumentException( + "Parameter analyticsRuleRunTriggerParameter is required and cannot be null.")); + } else { + analyticsRuleRunTriggerParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.triggerRuleRun(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, ruleId, + analyticsRuleRunTriggerParameter, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> triggerRuleRunWithResponseAsync(String resourceGroupName, + String workspaceName, String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (analyticsRuleRunTriggerParameter == null) { + return Mono.error(new IllegalArgumentException( + "Parameter analyticsRuleRunTriggerParameter is required and cannot be null.")); + } else { + analyticsRuleRunTriggerParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.triggerRuleRun(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter, + accept, context); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginTriggerRuleRunAsync(String resourceGroupName, String workspaceName, + String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter) { + Mono>> mono = triggerRuleRunWithResponseAsync(resourceGroupName, workspaceName, + ruleId, analyticsRuleRunTriggerParameter); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginTriggerRuleRunAsync(String resourceGroupName, String workspaceName, + String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = triggerRuleRunWithResponseAsync(resourceGroupName, workspaceName, + ruleId, analyticsRuleRunTriggerParameter, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginTriggerRuleRun(String resourceGroupName, String workspaceName, + String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter) { + return this.beginTriggerRuleRunAsync(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter) + .getSyncPoller(); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginTriggerRuleRun(String resourceGroupName, String workspaceName, + String ruleId, AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context) { + return this + .beginTriggerRuleRunAsync(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter, + context) + .getSyncPoller(); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerRuleRunAsync(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter) { + return beginTriggerRuleRunAsync(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerRuleRunAsync(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context) { + return beginTriggerRuleRunAsync(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter) { + triggerRuleRunAsync(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter).block(); + } + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context) { + triggerRuleRunAsync(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter, context) + .block(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/AlertRuleOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/AlertRuleOperationsImpl.java new file mode 100644 index 000000000000..d7a9b1b098a7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/AlertRuleOperationsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.AlertRuleOperationsClient; +import com.azure.resourcemanager.securityinsights.models.AlertRuleOperations; +import com.azure.resourcemanager.securityinsights.models.AnalyticsRuleRunTrigger; + +public final class AlertRuleOperationsImpl implements AlertRuleOperations { + private static final ClientLogger LOGGER = new ClientLogger(AlertRuleOperationsImpl.class); + + private final AlertRuleOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public AlertRuleOperationsImpl(AlertRuleOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter) { + this.serviceClient().triggerRuleRun(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter); + } + + public void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context) { + this.serviceClient() + .triggerRuleRun(resourceGroupName, workspaceName, ruleId, analyticsRuleRunTriggerParameter, context); + } + + private AlertRuleOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticImpl.java new file mode 100644 index 000000000000..bf7bf86a6390 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner; +import com.azure.resourcemanager.securityinsights.models.BillingStatistic; +import com.azure.resourcemanager.securityinsights.models.BillingStatisticKind; + +public final class BillingStatisticImpl implements BillingStatistic { + private BillingStatisticInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + BillingStatisticImpl(BillingStatisticInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public BillingStatisticKind kind() { + return this.innerModel().kind(); + } + + public BillingStatisticInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticsClientImpl.java new file mode 100644 index 000000000000..bab81d1752e1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticsClientImpl.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.BillingStatisticsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner; +import com.azure.resourcemanager.securityinsights.models.BillingStatisticList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BillingStatisticsClient. + */ +public final class BillingStatisticsClientImpl implements BillingStatisticsClient { + /** + * The proxy service used to perform REST calls. + */ + private final BillingStatisticsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of BillingStatisticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingStatisticsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(BillingStatisticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsBillingStatistics to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsBill") + public interface BillingStatisticsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/billingStatistics/{billingStatisticName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("billingStatisticName") String billingStatisticName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String billingStatisticName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (billingStatisticName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingStatisticName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, billingStatisticName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String billingStatisticName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (billingStatisticName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingStatisticName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, billingStatisticName, accept, context); + } + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String billingStatisticName) { + return getWithResponseAsync(resourceGroupName, workspaceName, billingStatisticName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String billingStatisticName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, billingStatisticName, context).block(); + } + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingStatisticInner get(String resourceGroupName, String workspaceName, String billingStatisticName) { + return getWithResponse(resourceGroupName, workspaceName, billingStatisticName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all Microsoft Sentinel billing statistics along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all Microsoft Sentinel billing statistics along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticsImpl.java new file mode 100644 index 000000000000..0d7b9ec4ca0c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BillingStatisticsImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.BillingStatisticsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner; +import com.azure.resourcemanager.securityinsights.models.BillingStatistic; +import com.azure.resourcemanager.securityinsights.models.BillingStatistics; + +public final class BillingStatisticsImpl implements BillingStatistics { + private static final ClientLogger LOGGER = new ClientLogger(BillingStatisticsImpl.class); + + private final BillingStatisticsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public BillingStatisticsImpl(BillingStatisticsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BillingStatisticImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BillingStatisticImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String billingStatisticName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, billingStatisticName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BillingStatisticImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingStatistic get(String resourceGroupName, String workspaceName, String billingStatisticName) { + BillingStatisticInner inner = this.serviceClient().get(resourceGroupName, workspaceName, billingStatisticName); + if (inner != null) { + return new BillingStatisticImpl(inner, this.manager()); + } else { + return null; + } + } + + private BillingStatisticsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkExpandResponseImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkExpandResponseImpl.java new file mode 100644 index 000000000000..f9ff52a7db60 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkExpandResponseImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkExpandResponseInner; +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandResponse; +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandResponseValue; +import com.azure.resourcemanager.securityinsights.models.ExpansionResultsMetadata; + +public final class BookmarkExpandResponseImpl implements BookmarkExpandResponse { + private BookmarkExpandResponseInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + BookmarkExpandResponseImpl(BookmarkExpandResponseInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ExpansionResultsMetadata metadata() { + return this.innerModel().metadata(); + } + + public BookmarkExpandResponseValue value() { + return this.innerModel().value(); + } + + public BookmarkExpandResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkImpl.java index 6a8a343cf14a..535dc6db01e7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkImpl.java @@ -7,7 +7,9 @@ import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkInner; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; import com.azure.resourcemanager.securityinsights.models.Bookmark; +import com.azure.resourcemanager.securityinsights.models.BookmarkEntityMappings; import com.azure.resourcemanager.securityinsights.models.IncidentInfo; import com.azure.resourcemanager.securityinsights.models.UserInfo; import java.time.OffsetDateTime; @@ -96,6 +98,33 @@ public IncidentInfo incidentInfo() { return this.innerModel().incidentInfo(); } + public List entityMappings() { + List inner = this.innerModel().entityMappings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List tactics() { + List inner = this.innerModel().tactics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List techniques() { + List inner = this.innerModel().techniques(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + public String resourceGroupName() { return resourceGroupName; } @@ -256,4 +285,19 @@ public BookmarkImpl withIncidentInfo(IncidentInfo incidentInfo) { this.innerModel().withIncidentInfo(incidentInfo); return this; } + + public BookmarkImpl withEntityMappings(List entityMappings) { + this.innerModel().withEntityMappings(entityMappings); + return this; + } + + public BookmarkImpl withTactics(List tactics) { + this.innerModel().withTactics(tactics); + return this; + } + + public BookmarkImpl withTechniques(List techniques) { + this.innerModel().withTechniques(techniques); + return this; + } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkOperationsClientImpl.java new file mode 100644 index 000000000000..35a3701edbee --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkOperationsClientImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.BookmarkOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkExpandResponseInner; +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandParameters; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BookmarkOperationsClient. + */ +public final class BookmarkOperationsClientImpl implements BookmarkOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final BookmarkOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of BookmarkOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BookmarkOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(BookmarkOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsBookmarkOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsBook") + public interface BookmarkOperationsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> expand(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("bookmarkId") String bookmarkId, + @BodyParam("application/json") BookmarkExpandParameters parameters, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandWithResponseAsync(String resourceGroupName, + String workspaceName, String bookmarkId, BookmarkExpandParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.expand(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, bookmarkId, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandWithResponseAsync(String resourceGroupName, + String workspaceName, String bookmarkId, BookmarkExpandParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.expand(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, bookmarkId, parameters, accept, context); + } + + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono expandAsync(String resourceGroupName, String workspaceName, + String bookmarkId, BookmarkExpandParameters parameters) { + return expandWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response expandWithResponse(String resourceGroupName, String workspaceName, + String bookmarkId, BookmarkExpandParameters parameters, Context context) { + return expandWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, parameters, context).block(); + } + + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookmarkExpandResponseInner expand(String resourceGroupName, String workspaceName, String bookmarkId, + BookmarkExpandParameters parameters) { + return expandWithResponse(resourceGroupName, workspaceName, bookmarkId, parameters, Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkOperationsImpl.java new file mode 100644 index 000000000000..c3984c182c44 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkOperationsImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.BookmarkOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkExpandResponseInner; +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandParameters; +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandResponse; +import com.azure.resourcemanager.securityinsights.models.BookmarkOperations; + +public final class BookmarkOperationsImpl implements BookmarkOperations { + private static final ClientLogger LOGGER = new ClientLogger(BookmarkOperationsImpl.class); + + private final BookmarkOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public BookmarkOperationsImpl(BookmarkOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response expandWithResponse(String resourceGroupName, String workspaceName, + String bookmarkId, BookmarkExpandParameters parameters, Context context) { + Response inner = this.serviceClient() + .expandWithResponse(resourceGroupName, workspaceName, bookmarkId, parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BookmarkExpandResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BookmarkExpandResponse expand(String resourceGroupName, String workspaceName, String bookmarkId, + BookmarkExpandParameters parameters) { + BookmarkExpandResponseInner inner + = this.serviceClient().expand(resourceGroupName, workspaceName, bookmarkId, parameters); + if (inner != null) { + return new BookmarkExpandResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private BookmarkOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkRelationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkRelationsClientImpl.java new file mode 100644 index 000000000000..07967897df8e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkRelationsClientImpl.java @@ -0,0 +1,828 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.BookmarkRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; +import com.azure.resourcemanager.securityinsights.models.RelationList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BookmarkRelationsClient. + */ +public final class BookmarkRelationsClientImpl implements BookmarkRelationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final BookmarkRelationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of BookmarkRelationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BookmarkRelationsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(BookmarkRelationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsBookmarkRelations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsBook") + public interface BookmarkRelationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("bookmarkId") String bookmarkId, @QueryParam("$filter") String filter, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("bookmarkId") String bookmarkId, @PathParam("relationName") String relationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("bookmarkId") String bookmarkId, @PathParam("relationName") String relationName, + @BodyParam("application/json") RelationInner relation, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("bookmarkId") String bookmarkId, @PathParam("relationName") String relationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String bookmarkId, String filter, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, bookmarkId, filter, orderby, top, + skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String bookmarkId, String filter, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, bookmarkId, filter, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String bookmarkId, + String filter, String orderby, Integer top, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, bookmarkId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String bookmarkId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, bookmarkId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String bookmarkId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, bookmarkId, filter, orderby, + top, skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, bookmarkId, filter, orderby, top, skipToken)); + } + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, bookmarkId, filter, orderby, top, skipToken, context)); + } + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String bookmarkId, String relationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, bookmarkId, relationName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String bookmarkId, String relationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, bookmarkId, relationName, accept, context); + } + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName) { + return getWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, relationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, relationName, context).block(); + } + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RelationInner get(String resourceGroupName, String workspaceName, String bookmarkId, String relationName) { + return getWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, Context.NONE).getValue(); + } + + /** + * Creates the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param relation The relation model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String bookmarkId, String relationName, RelationInner relation) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + if (relation == null) { + return Mono.error(new IllegalArgumentException("Parameter relation is required and cannot be null.")); + } else { + relation.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, bookmarkId, relationName, relation, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param relation The relation model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String bookmarkId, String relationName, RelationInner relation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + if (relation == null) { + return Mono.error(new IllegalArgumentException("Parameter relation is required and cannot be null.")); + } else { + relation.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, bookmarkId, relationName, relation, + accept, context); + } + + /** + * Creates the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param relation The relation model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, RelationInner relation) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, relationName, relation) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param relation The relation model. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String bookmarkId, String relationName, RelationInner relation, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, relationName, relation, + context).block(); + } + + /** + * Creates the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param relation The relation model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RelationInner createOrUpdate(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, RelationInner relation) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, relation, + Context.NONE).getValue(); + } + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String bookmarkId, String relationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, bookmarkId, relationName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String bookmarkId, String relationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (bookmarkId == null) { + return Mono.error(new IllegalArgumentException("Parameter bookmarkId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, bookmarkId, relationName, accept, context); + } + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, relationName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, bookmarkId, relationName, context).block(); + } + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String bookmarkId, String relationName) { + deleteWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkRelationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkRelationsImpl.java new file mode 100644 index 000000000000..759609fbdb16 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BookmarkRelationsImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.BookmarkRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; +import com.azure.resourcemanager.securityinsights.models.BookmarkRelations; +import com.azure.resourcemanager.securityinsights.models.Relation; + +public final class BookmarkRelationsImpl implements BookmarkRelations { + private static final ClientLogger LOGGER = new ClientLogger(BookmarkRelationsImpl.class); + + private final BookmarkRelationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public BookmarkRelationsImpl(BookmarkRelationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, bookmarkId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RelationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId, + String filter, String orderby, Integer top, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, bookmarkId, filter, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RelationImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RelationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Relation get(String resourceGroupName, String workspaceName, String bookmarkId, String relationName) { + RelationInner inner = this.serviceClient().get(resourceGroupName, workspaceName, bookmarkId, relationName); + if (inner != null) { + return new RelationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String bookmarkId, String relationName) { + this.serviceClient().delete(resourceGroupName, workspaceName, bookmarkId, relationName); + } + + public Relation getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String bookmarkId = ResourceManagerUtils.getValueFromIdByName(id, "bookmarks"); + if (bookmarkId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookmarks'.", id))); + } + String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (relationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String bookmarkId = ResourceManagerUtils.getValueFromIdByName(id, "bookmarks"); + if (bookmarkId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookmarks'.", id))); + } + String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (relationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String bookmarkId = ResourceManagerUtils.getValueFromIdByName(id, "bookmarks"); + if (bookmarkId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookmarks'.", id))); + } + String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (relationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String bookmarkId = ResourceManagerUtils.getValueFromIdByName(id, "bookmarks"); + if (bookmarkId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookmarks'.", id))); + } + String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (relationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, context); + } + + private BookmarkRelationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public RelationImpl define(String name) { + return new RelationImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentOperationsClientImpl.java new file mode 100644 index 000000000000..96b9c5953e46 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentOperationsClientImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.BusinessApplicationAgentOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BusinessApplicationAgentOperationsClient. + */ +public final class BusinessApplicationAgentOperationsClientImpl implements BusinessApplicationAgentOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final BusinessApplicationAgentOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of BusinessApplicationAgentOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BusinessApplicationAgentOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(BusinessApplicationAgentOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsBusinessApplicationAgentOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsBusi") + public interface BusinessApplicationAgentOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String agentResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, agentResourceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String agentResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + agentResourceName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String agentResourceName) { + return getWithResponseAsync(resourceGroupName, workspaceName, agentResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String workspaceName, String agentResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, context).block(); + } + + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BusinessApplicationAgentResourceInner get(String resourceGroupName, String workspaceName, + String agentResourceName) { + return getWithResponse(resourceGroupName, workspaceName, agentResourceName, Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentOperationsImpl.java new file mode 100644 index 000000000000..cf775f22c977 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentOperationsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.BusinessApplicationAgentOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgentOperations; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgentResource; + +public final class BusinessApplicationAgentOperationsImpl implements BusinessApplicationAgentOperations { + private static final ClientLogger LOGGER = new ClientLogger(BusinessApplicationAgentOperationsImpl.class); + + private final BusinessApplicationAgentOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public BusinessApplicationAgentOperationsImpl(BusinessApplicationAgentOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, agentResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BusinessApplicationAgentResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BusinessApplicationAgentResource get(String resourceGroupName, String workspaceName, + String agentResourceName) { + BusinessApplicationAgentResourceInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, agentResourceName); + if (inner != null) { + return new BusinessApplicationAgentResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private BusinessApplicationAgentOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentResourceImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentResourceImpl.java new file mode 100644 index 000000000000..3e04d96bfdf8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentResourceImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; +import com.azure.resourcemanager.securityinsights.models.AgentConfiguration; +import com.azure.resourcemanager.securityinsights.models.AgentSystem; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgentResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class BusinessApplicationAgentResourceImpl implements BusinessApplicationAgentResource, + BusinessApplicationAgentResource.Definition, BusinessApplicationAgentResource.Update { + private BusinessApplicationAgentResourceInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AgentConfiguration configuration() { + return this.innerModel().configuration(); + } + + public List agentSystems() { + List inner = this.innerModel().agentSystems(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerModel().lastModifiedTimeUtc(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public BusinessApplicationAgentResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String agentResourceName; + + public BusinessApplicationAgentResourceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public BusinessApplicationAgentResource create() { + this.innerObject = serviceManager.serviceClient() + .getBusinessApplicationAgents() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public BusinessApplicationAgentResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBusinessApplicationAgents() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + BusinessApplicationAgentResourceImpl(String name, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new BusinessApplicationAgentResourceInner(); + this.serviceManager = serviceManager; + this.agentResourceName = name; + } + + public BusinessApplicationAgentResourceImpl update() { + return this; + } + + public BusinessApplicationAgentResource apply() { + this.innerObject = serviceManager.serviceClient() + .getBusinessApplicationAgents() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public BusinessApplicationAgentResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBusinessApplicationAgents() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + BusinessApplicationAgentResourceImpl(BusinessApplicationAgentResourceInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.agentResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "businessApplicationAgents"); + } + + public BusinessApplicationAgentResourceImpl withConfiguration(AgentConfiguration configuration) { + this.innerModel().withConfiguration(configuration); + return this; + } + + public BusinessApplicationAgentResourceImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public BusinessApplicationAgentResourceImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentsClientImpl.java new file mode 100644 index 000000000000..821bf0cd8336 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentsClientImpl.java @@ -0,0 +1,625 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.BusinessApplicationAgentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgentsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BusinessApplicationAgentsClient. + */ +public final class BusinessApplicationAgentsClientImpl implements BusinessApplicationAgentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final BusinessApplicationAgentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of BusinessApplicationAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BusinessApplicationAgentsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(BusinessApplicationAgentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsBusinessApplicationAgents to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsBusi") + public interface BusinessApplicationAgentsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BusinessApplicationAgentResourceInner agentToUpsert, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, @QueryParam("$filter") String filter, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates or updates the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param agentToUpsert The Business Application Agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the configuration of a Business Application Agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String agentResourceName, + BusinessApplicationAgentResourceInner agentToUpsert) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (agentToUpsert != null) { + agentToUpsert.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, agentResourceName, this.client.getApiVersion(), agentToUpsert, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param agentToUpsert The Business Application Agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the configuration of a Business Application Agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String agentResourceName, + BusinessApplicationAgentResourceInner agentToUpsert, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (agentToUpsert != null) { + agentToUpsert.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, agentResourceName, this.client.getApiVersion(), agentToUpsert, accept, context); + } + + /** + * Creates or updates the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the configuration of a Business Application Agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String workspaceName, String agentResourceName) { + final BusinessApplicationAgentResourceInner agentToUpsert = null; + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, agentToUpsert) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param agentToUpsert The Business Application Agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the configuration of a Business Application Agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String agentResourceName, BusinessApplicationAgentResourceInner agentToUpsert, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, agentToUpsert, + context).block(); + } + + /** + * Creates or updates the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the configuration of a Business Application Agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BusinessApplicationAgentResourceInner createOrUpdate(String resourceGroupName, String workspaceName, + String agentResourceName) { + final BusinessApplicationAgentResourceInner agentToUpsert = null; + return createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, agentToUpsert, + Context.NONE).getValue(); + } + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, agentResourceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, agentResourceName, this.client.getApiVersion(), accept, context); + } + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String agentResourceName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, agentResourceName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, context).block(); + } + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String agentResourceName) { + deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, Context.NONE); + } + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String filter, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, this.client.getApiVersion(), filter, skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String filter, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + this.client.getApiVersion(), filter, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String filter, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String filter, String skipToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, filter, skipToken)); + } + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String filter, String skipToken, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, filter, skipToken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentsImpl.java new file mode 100644 index 000000000000..a9e08700a1d0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/BusinessApplicationAgentsImpl.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.BusinessApplicationAgentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgentResource; +import com.azure.resourcemanager.securityinsights.models.BusinessApplicationAgents; + +public final class BusinessApplicationAgentsImpl implements BusinessApplicationAgents { + private static final ClientLogger LOGGER = new ClientLogger(BusinessApplicationAgentsImpl.class); + + private final BusinessApplicationAgentsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public BusinessApplicationAgentsImpl(BusinessApplicationAgentsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String agentResourceName) { + this.serviceClient().delete(resourceGroupName, workspaceName, agentResourceName); + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new BusinessApplicationAgentResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + String filter, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, filter, skipToken, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new BusinessApplicationAgentResourceImpl(inner1, this.manager())); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String agentResourceName = ResourceManagerUtils.getValueFromIdByName(id, "businessApplicationAgents"); + if (agentResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'businessApplicationAgents'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String agentResourceName = ResourceManagerUtils.getValueFromIdByName(id, "businessApplicationAgents"); + if (agentResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'businessApplicationAgents'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, context); + } + + private BusinessApplicationAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public BusinessApplicationAgentResourceImpl define(String name) { + return new BusinessApplicationAgentResourceImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackageOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackageOperationsClientImpl.java new file mode 100644 index 000000000000..0a651e26f83c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackageOperationsClientImpl.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ContentPackageOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ContentPackageOperationsClient. + */ +public final class ContentPackageOperationsClientImpl implements ContentPackageOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ContentPackageOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ContentPackageOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ContentPackageOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(ContentPackageOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsContentPackageOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsCont") + public interface ContentPackageOperationsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> install(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("packageId") String packageId, + @BodyParam("application/json") PackageModelInner packageInstallationProperties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> uninstall(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("packageId") String packageId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Install a package to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param packageInstallationProperties Package installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Package in Azure Security Insights along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> installWithResponseAsync(String resourceGroupName, String workspaceName, + String packageId, PackageModelInner packageInstallationProperties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + if (packageInstallationProperties == null) { + return Mono.error(new IllegalArgumentException( + "Parameter packageInstallationProperties is required and cannot be null.")); + } else { + packageInstallationProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.install(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, packageId, + packageInstallationProperties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Install a package to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param packageInstallationProperties Package installation properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Package in Azure Security Insights along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> installWithResponseAsync(String resourceGroupName, String workspaceName, + String packageId, PackageModelInner packageInstallationProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + if (packageInstallationProperties == null) { + return Mono.error(new IllegalArgumentException( + "Parameter packageInstallationProperties is required and cannot be null.")); + } else { + packageInstallationProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.install(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, packageId, packageInstallationProperties, accept, context); + } + + /** + * Install a package to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param packageInstallationProperties Package installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Package in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono installAsync(String resourceGroupName, String workspaceName, String packageId, + PackageModelInner packageInstallationProperties) { + return installWithResponseAsync(resourceGroupName, workspaceName, packageId, packageInstallationProperties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Install a package to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param packageInstallationProperties Package installation properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Package in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response installWithResponse(String resourceGroupName, String workspaceName, + String packageId, PackageModelInner packageInstallationProperties, Context context) { + return installWithResponseAsync(resourceGroupName, workspaceName, packageId, packageInstallationProperties, + context).block(); + } + + /** + * Install a package to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param packageInstallationProperties Package installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Package in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageModelInner install(String resourceGroupName, String workspaceName, String packageId, + PackageModelInner packageInstallationProperties) { + return installWithResponse(resourceGroupName, workspaceName, packageId, packageInstallationProperties, + Context.NONE).getValue(); + } + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> uninstallWithResponseAsync(String resourceGroupName, String workspaceName, + String packageId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.uninstall(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, packageId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> uninstallWithResponseAsync(String resourceGroupName, String workspaceName, + String packageId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.uninstall(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, packageId, accept, context); + } + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono uninstallAsync(String resourceGroupName, String workspaceName, String packageId) { + return uninstallWithResponseAsync(resourceGroupName, workspaceName, packageId).flatMap(ignored -> Mono.empty()); + } + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uninstallWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context) { + return uninstallWithResponseAsync(resourceGroupName, workspaceName, packageId, context).block(); + } + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void uninstall(String resourceGroupName, String workspaceName, String packageId) { + uninstallWithResponse(resourceGroupName, workspaceName, packageId, Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackageOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackageOperationsImpl.java new file mode 100644 index 000000000000..85bcb4a8e98e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackageOperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ContentPackageOperationsClient; +import com.azure.resourcemanager.securityinsights.models.ContentPackageOperations; + +public final class ContentPackageOperationsImpl implements ContentPackageOperations { + private static final ClientLogger LOGGER = new ClientLogger(ContentPackageOperationsImpl.class); + + private final ContentPackageOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ContentPackageOperationsImpl(ContentPackageOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response uninstallWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context) { + return this.serviceClient().uninstallWithResponse(resourceGroupName, workspaceName, packageId, context); + } + + public void uninstall(String resourceGroupName, String workspaceName, String packageId) { + this.serviceClient().uninstall(resourceGroupName, workspaceName, packageId); + } + + private ContentPackageOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public PackageModelImpl define(String name) { + return new PackageModelImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackagesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackagesClientImpl.java new file mode 100644 index 000000000000..256529a5bf1f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackagesClientImpl.java @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ContentPackagesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; +import com.azure.resourcemanager.securityinsights.models.PackageList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ContentPackagesClient. + */ +public final class ContentPackagesClientImpl implements ContentPackagesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ContentPackagesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ContentPackagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ContentPackagesClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(ContentPackagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsContentPackages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsCont") + public interface ContentPackagesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, @QueryParam("$orderby") String orderby, + @QueryParam("$search") String search, @QueryParam("$count") Boolean count, @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("packageId") String packageId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, filter, orderby, search, count, top, + skip, skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, search, + count, top, skip, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final String search = null; + final Boolean count = null; + final Integer top = null; + final Integer skip = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, search, + count, top, skip, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, search, + count, top, skip, skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final String search = null; + final Boolean count = null; + final Integer top = null; + final Integer skip = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken)); + } + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken, context)); + } + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String packageId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, packageId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String packageId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, packageId, accept, context); + } + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String packageId) { + return getWithResponseAsync(resourceGroupName, workspaceName, packageId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, packageId, context).block(); + } + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageModelInner get(String resourceGroupName, String workspaceName, String packageId) { + return getWithResponse(resourceGroupName, workspaceName, packageId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list available packages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list available packages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackagesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackagesImpl.java new file mode 100644 index 000000000000..a014c69ba470 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentPackagesImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ContentPackagesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; +import com.azure.resourcemanager.securityinsights.models.ContentPackages; +import com.azure.resourcemanager.securityinsights.models.PackageModel; + +public final class ContentPackagesImpl implements ContentPackages { + private static final ClientLogger LOGGER = new ClientLogger(ContentPackagesImpl.class); + + private final ContentPackagesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ContentPackagesImpl(ContentPackagesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PackageModelImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PackageModelImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, packageId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PackageModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PackageModel get(String resourceGroupName, String workspaceName, String packageId) { + PackageModelInner inner = this.serviceClient().get(resourceGroupName, workspaceName, packageId); + if (inner != null) { + return new PackageModelImpl(inner, this.manager()); + } else { + return null; + } + } + + private ContentPackagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplateOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplateOperationsClientImpl.java new file mode 100644 index 000000000000..c62e4368c2af --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplateOperationsClientImpl.java @@ -0,0 +1,529 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ContentTemplateOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ContentTemplateOperationsClient. + */ +public final class ContentTemplateOperationsClientImpl implements ContentTemplateOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ContentTemplateOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ContentTemplateOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ContentTemplateOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(ContentTemplateOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsContentTemplateOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsCont") + public interface ContentTemplateOperationsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> install(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("templateId") String templateId, + @BodyParam("application/json") TemplateModelInner templateInstallationProperties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("templateId") String templateId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("templateId") String templateId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Install a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param templateInstallationProperties Template installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return template resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> installWithResponseAsync(String resourceGroupName, String workspaceName, + String templateId, TemplateModelInner templateInstallationProperties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + if (templateInstallationProperties == null) { + return Mono.error(new IllegalArgumentException( + "Parameter templateInstallationProperties is required and cannot be null.")); + } else { + templateInstallationProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.install(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, templateId, + templateInstallationProperties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Install a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param templateInstallationProperties Template installation properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return template resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> installWithResponseAsync(String resourceGroupName, String workspaceName, + String templateId, TemplateModelInner templateInstallationProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + if (templateInstallationProperties == null) { + return Mono.error(new IllegalArgumentException( + "Parameter templateInstallationProperties is required and cannot be null.")); + } else { + templateInstallationProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.install(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, templateId, templateInstallationProperties, accept, context); + } + + /** + * Install a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param templateInstallationProperties Template installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return template resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono installAsync(String resourceGroupName, String workspaceName, String templateId, + TemplateModelInner templateInstallationProperties) { + return installWithResponseAsync(resourceGroupName, workspaceName, templateId, templateInstallationProperties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Install a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param templateInstallationProperties Template installation properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return template resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response installWithResponse(String resourceGroupName, String workspaceName, + String templateId, TemplateModelInner templateInstallationProperties, Context context) { + return installWithResponseAsync(resourceGroupName, workspaceName, templateId, templateInstallationProperties, + context).block(); + } + + /** + * Install a template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param templateInstallationProperties Template installation properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return template resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TemplateModelInner install(String resourceGroupName, String workspaceName, String templateId, + TemplateModelInner templateInstallationProperties) { + return installWithResponse(resourceGroupName, workspaceName, templateId, templateInstallationProperties, + Context.NONE).getValue(); + } + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String templateId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, templateId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String templateId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, templateId, accept, context); + } + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String templateId) { + return getWithResponseAsync(resourceGroupName, workspaceName, templateId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String templateId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, templateId, context).block(); + } + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TemplateModelInner get(String resourceGroupName, String workspaceName, String templateId) { + return getWithResponse(resourceGroupName, workspaceName, templateId, Context.NONE).getValue(); + } + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String templateId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, templateId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String templateId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, templateId, accept, context); + } + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String templateId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, templateId).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, templateId, context).block(); + } + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String templateId) { + deleteWithResponse(resourceGroupName, workspaceName, templateId, Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplateOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplateOperationsImpl.java new file mode 100644 index 000000000000..108e709caf09 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplateOperationsImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ContentTemplateOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; +import com.azure.resourcemanager.securityinsights.models.ContentTemplateOperations; +import com.azure.resourcemanager.securityinsights.models.TemplateModel; + +public final class ContentTemplateOperationsImpl implements ContentTemplateOperations { + private static final ClientLogger LOGGER = new ClientLogger(ContentTemplateOperationsImpl.class); + + private final ContentTemplateOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ContentTemplateOperationsImpl(ContentTemplateOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, templateId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TemplateModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TemplateModel get(String resourceGroupName, String workspaceName, String templateId) { + TemplateModelInner inner = this.serviceClient().get(resourceGroupName, workspaceName, templateId); + if (inner != null) { + return new TemplateModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, templateId, context); + } + + public void delete(String resourceGroupName, String workspaceName, String templateId) { + this.serviceClient().delete(resourceGroupName, workspaceName, templateId); + } + + public TemplateModel getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String templateId = ResourceManagerUtils.getValueFromIdByName(id, "contentTemplates"); + if (templateId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'contentTemplates'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, templateId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String templateId = ResourceManagerUtils.getValueFromIdByName(id, "contentTemplates"); + if (templateId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'contentTemplates'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, templateId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String templateId = ResourceManagerUtils.getValueFromIdByName(id, "contentTemplates"); + if (templateId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'contentTemplates'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, templateId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String templateId = ResourceManagerUtils.getValueFromIdByName(id, "contentTemplates"); + if (templateId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'contentTemplates'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, templateId, context); + } + + private ContentTemplateOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public TemplateModelImpl define(String name) { + return new TemplateModelImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplatesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplatesClientImpl.java new file mode 100644 index 000000000000..a390a7ffdbe1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplatesClientImpl.java @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ContentTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; +import com.azure.resourcemanager.securityinsights.models.TemplateList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ContentTemplatesClient. + */ +public final class ContentTemplatesClientImpl implements ContentTemplatesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ContentTemplatesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ContentTemplatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ContentTemplatesClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(ContentTemplatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsContentTemplates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsCont") + public interface ContentTemplatesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, @QueryParam("$orderby") String orderby, + @QueryParam("$expand") String expand, @QueryParam("$search") String search, + @QueryParam("$count") Boolean count, @QueryParam("$top") Integer top, @QueryParam("$skip") Integer skip, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param expand Expands the object with optional fiends that are not included by default. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, String expand, String search, Boolean count, Integer top, Integer skip, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, filter, orderby, expand, search, + count, top, skip, skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param expand Expands the object with optional fiends that are not included by default. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, String expand, String search, Boolean count, Integer top, Integer skip, + String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, filter, orderby, expand, search, count, top, skip, skipToken, accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param expand Expands the object with optional fiends that are not included by default. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, String expand, String search, Boolean count, Integer top, Integer skip, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, expand, + search, count, top, skip, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final String expand = null; + final String search = null; + final Boolean count = null; + final Integer top = null; + final Integer skip = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, expand, + search, count, top, skip, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param expand Expands the object with optional fiends that are not included by default. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, String expand, String search, Boolean count, Integer top, Integer skip, String skipToken, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, expand, + search, count, top, skip, skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final String expand = null; + final String search = null; + final Boolean count = null; + final Integer top = null; + final Integer skip = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, expand, search, count, top, skip, skipToken)); + } + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param expand Expands the object with optional fiends that are not included by default. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String expand, String search, Boolean count, Integer top, Integer skip, String skipToken, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, filter, orderby, expand, search, count, + top, skip, skipToken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the template along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the template along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplatesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplatesImpl.java new file mode 100644 index 000000000000..92e325332649 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ContentTemplatesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ContentTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; +import com.azure.resourcemanager.securityinsights.models.ContentTemplates; +import com.azure.resourcemanager.securityinsights.models.TemplateModel; + +public final class ContentTemplatesImpl implements ContentTemplates { + private static final ClientLogger LOGGER = new ClientLogger(ContentTemplatesImpl.class); + + private final ContentTemplatesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ContentTemplatesImpl(ContentTemplatesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TemplateModelImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String expand, String search, Boolean count, Integer top, Integer skip, String skipToken, + Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, filter, orderby, expand, search, count, top, skip, skipToken, + context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TemplateModelImpl(inner1, this.manager())); + } + + private ContentTemplatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionImpl.java new file mode 100644 index 000000000000..e2aeaf126475 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorDefinition; +import com.azure.resourcemanager.securityinsights.models.DataConnectorDefinitionKind; + +public final class DataConnectorDefinitionImpl implements DataConnectorDefinition { + private DataConnectorDefinitionInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + DataConnectorDefinitionImpl(DataConnectorDefinitionInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public DataConnectorDefinitionKind kind() { + return this.innerModel().kind(); + } + + public DataConnectorDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionsClientImpl.java new file mode 100644 index 000000000000..f428385c8f58 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionsClientImpl.java @@ -0,0 +1,746 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.DataConnectorDefinitionsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorDefinitionArmCollectionWrapper; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DataConnectorDefinitionsClient. + */ +public final class DataConnectorDefinitionsClientImpl implements DataConnectorDefinitionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DataConnectorDefinitionsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of DataConnectorDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataConnectorDefinitionsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(DataConnectorDefinitionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsDataConnectorDefinitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsData") + public interface DataConnectorDefinitionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("dataConnectorDefinitionName") String dataConnectorDefinitionName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("dataConnectorDefinitionName") String dataConnectorDefinitionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataConnectorDefinitionInner connectorDefinitionInput, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorDefinitions/{dataConnectorDefinitionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("dataConnectorDefinitionName") String dataConnectorDefinitionName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String dataConnectorDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorDefinitionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter dataConnectorDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, dataConnectorDefinitionName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String dataConnectorDefinitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorDefinitionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter dataConnectorDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + dataConnectorDefinitionName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataConnectorDefinitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, dataConnectorDefinitionName, context).block(); + } + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataConnectorDefinitionInner get(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName) { + return getWithResponse(resourceGroupName, workspaceName, dataConnectorDefinitionName, Context.NONE).getValue(); + } + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String dataConnectorDefinitionName, + DataConnectorDefinitionInner connectorDefinitionInput) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorDefinitionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter dataConnectorDefinitionName is required and cannot be null.")); + } + if (connectorDefinitionInput == null) { + return Mono.error( + new IllegalArgumentException("Parameter connectorDefinitionInput is required and cannot be null.")); + } else { + connectorDefinitionInput.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, dataConnectorDefinitionName, this.client.getApiVersion(), + connectorDefinitionInput, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorDefinitionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter dataConnectorDefinitionName is required and cannot be null.")); + } + if (connectorDefinitionInput == null) { + return Mono.error( + new IllegalArgumentException("Parameter connectorDefinitionInput is required and cannot be null.")); + } else { + connectorDefinitionInput.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, dataConnectorDefinitionName, this.client.getApiVersion(), connectorDefinitionInput, accept, + context); + } + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataConnectorDefinitionName, + connectorDefinitionInput).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, dataConnectorDefinitionName, + connectorDefinitionInput, context).block(); + } + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataConnectorDefinitionInner createOrUpdate(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, dataConnectorDefinitionName, + connectorDefinitionInput, Context.NONE).getValue(); + } + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorDefinitionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter dataConnectorDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, dataConnectorDefinitionName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorDefinitionName == null) { + return Mono.error( + new IllegalArgumentException("Parameter dataConnectorDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, dataConnectorDefinitionName, this.client.getApiVersion(), accept, context); + } + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String dataConnectorDefinitionName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataConnectorDefinitionName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, dataConnectorDefinitionName, context).block(); + } + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String dataConnectorDefinitionName) { + deleteWithResponse(resourceGroupName, workspaceName, dataConnectorDefinitionName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return encapsulate the data connector definition object along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return encapsulate the data connector definition object along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionsImpl.java new file mode 100644 index 000000000000..dc9aa2992b9f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorDefinitionsImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.DataConnectorDefinitionsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorDefinition; +import com.azure.resourcemanager.securityinsights.models.DataConnectorDefinitions; + +public final class DataConnectorDefinitionsImpl implements DataConnectorDefinitions { + private static final ClientLogger LOGGER = new ClientLogger(DataConnectorDefinitionsImpl.class); + + private final DataConnectorDefinitionsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public DataConnectorDefinitionsImpl(DataConnectorDefinitionsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataConnectorDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataConnectorDefinitionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, dataConnectorDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DataConnectorDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataConnectorDefinition get(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName) { + DataConnectorDefinitionInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, dataConnectorDefinitionName); + if (inner != null) { + return new DataConnectorDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput, Context context) { + Response inner = this.serviceClient() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, dataConnectorDefinitionName, + connectorDefinitionInput, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DataConnectorDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataConnectorDefinition createOrUpdate(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput) { + DataConnectorDefinitionInner inner = this.serviceClient() + .createOrUpdate(resourceGroupName, workspaceName, dataConnectorDefinitionName, connectorDefinitionInput); + if (inner != null) { + return new DataConnectorDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, dataConnectorDefinitionName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String dataConnectorDefinitionName) { + this.serviceClient().delete(resourceGroupName, workspaceName, dataConnectorDefinitionName); + } + + private DataConnectorDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorRequirementsStateImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorRequirementsStateImpl.java new file mode 100644 index 000000000000..9ca4fcb90867 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorRequirementsStateImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorRequirementsStateInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorAuthorizationState; +import com.azure.resourcemanager.securityinsights.models.DataConnectorLicenseState; +import com.azure.resourcemanager.securityinsights.models.DataConnectorRequirementsState; + +public final class DataConnectorRequirementsStateImpl implements DataConnectorRequirementsState { + private DataConnectorRequirementsStateInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + DataConnectorRequirementsStateImpl(DataConnectorRequirementsStateInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public DataConnectorAuthorizationState authorizationState() { + return this.innerModel().authorizationState(); + } + + public DataConnectorLicenseState licenseState() { + return this.innerModel().licenseState(); + } + + public DataConnectorRequirementsStateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsCheckRequirementsOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsCheckRequirementsOperationsClientImpl.java new file mode 100644 index 000000000000..964724015afe --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsCheckRequirementsOperationsClientImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.DataConnectorsCheckRequirementsOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorRequirementsStateInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirements; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DataConnectorsCheckRequirementsOperationsClient. + */ +public final class DataConnectorsCheckRequirementsOperationsClientImpl + implements DataConnectorsCheckRequirementsOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DataConnectorsCheckRequirementsOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of DataConnectorsCheckRequirementsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataConnectorsCheckRequirementsOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(DataConnectorsCheckRequirementsOperationsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsDataConnectorsCheckRequirementsOperations to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsData") + public interface DataConnectorsCheckRequirementsOperationsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> post(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @BodyParam("application/json") DataConnectorsCheckRequirements dataConnectorsCheckRequirements, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postWithResponseAsync(String resourceGroupName, + String workspaceName, DataConnectorsCheckRequirements dataConnectorsCheckRequirements) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorsCheckRequirements == null) { + return Mono.error(new IllegalArgumentException( + "Parameter dataConnectorsCheckRequirements is required and cannot be null.")); + } else { + dataConnectorsCheckRequirements.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.post(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, dataConnectorsCheckRequirements, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postWithResponseAsync(String resourceGroupName, + String workspaceName, DataConnectorsCheckRequirements dataConnectorsCheckRequirements, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorsCheckRequirements == null) { + return Mono.error(new IllegalArgumentException( + "Parameter dataConnectorsCheckRequirements is required and cannot be null.")); + } else { + dataConnectorsCheckRequirements.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.post(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, dataConnectorsCheckRequirements, accept, context); + } + + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements) { + return postWithResponseAsync(resourceGroupName, workspaceName, dataConnectorsCheckRequirements) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String resourceGroupName, + String workspaceName, DataConnectorsCheckRequirements dataConnectorsCheckRequirements, Context context) { + return postWithResponseAsync(resourceGroupName, workspaceName, dataConnectorsCheckRequirements, context) + .block(); + } + + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataConnectorRequirementsStateInner post(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements) { + return postWithResponse(resourceGroupName, workspaceName, dataConnectorsCheckRequirements, Context.NONE) + .getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsCheckRequirementsOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsCheckRequirementsOperationsImpl.java new file mode 100644 index 000000000000..a9e0a2f411a8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsCheckRequirementsOperationsImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.DataConnectorsCheckRequirementsOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorRequirementsStateInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorRequirementsState; +import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirementsOperations; + +public final class DataConnectorsCheckRequirementsOperationsImpl implements DataConnectorsCheckRequirementsOperations { + private static final ClientLogger LOGGER = new ClientLogger(DataConnectorsCheckRequirementsOperationsImpl.class); + + private final DataConnectorsCheckRequirementsOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public DataConnectorsCheckRequirementsOperationsImpl(DataConnectorsCheckRequirementsOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response postWithResponse(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements, Context context) { + Response inner = this.serviceClient() + .postWithResponse(resourceGroupName, workspaceName, dataConnectorsCheckRequirements, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DataConnectorRequirementsStateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataConnectorRequirementsState post(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements) { + DataConnectorRequirementsStateInner inner + = this.serviceClient().post(resourceGroupName, workspaceName, dataConnectorsCheckRequirements); + if (inner != null) { + return new DataConnectorRequirementsStateImpl(inner, this.manager()); + } else { + return null; + } + } + + private DataConnectorsCheckRequirementsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsClientImpl.java index e43d5c7f004d..262f6aa23020 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsClientImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsClientImpl.java @@ -13,6 +13,7 @@ import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; @@ -30,6 +31,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.securityinsights.fluent.DataConnectorsClient; import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.models.DataConnectorConnectBody; import com.azure.resourcemanager.securityinsights.models.DataConnectorList; import reactor.core.publisher.Mono; @@ -105,6 +107,27 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @PathParam("dataConnectorId") String dataConnectorId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> connect(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("dataConnectorId") String dataConnectorId, + @BodyParam("application/json") DataConnectorConnectBody connectBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disconnect(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("dataConnectorId") String dataConnectorId, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -665,6 +688,285 @@ public void delete(String resourceGroupName, String workspaceName, String dataCo deleteWithResponse(resourceGroupName, workspaceName, dataConnectorId, Context.NONE); } + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> connectWithResponseAsync(String resourceGroupName, String workspaceName, + String dataConnectorId, DataConnectorConnectBody connectBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorId == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataConnectorId is required and cannot be null.")); + } + if (connectBody == null) { + return Mono.error(new IllegalArgumentException("Parameter connectBody is required and cannot be null.")); + } else { + connectBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.connect(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, dataConnectorId, connectBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> connectWithResponseAsync(String resourceGroupName, String workspaceName, + String dataConnectorId, DataConnectorConnectBody connectBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorId == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataConnectorId is required and cannot be null.")); + } + if (connectBody == null) { + return Mono.error(new IllegalArgumentException("Parameter connectBody is required and cannot be null.")); + } else { + connectBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.connect(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, dataConnectorId, connectBody, accept, context); + } + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono connectAsync(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody) { + return connectWithResponseAsync(resourceGroupName, workspaceName, dataConnectorId, connectBody) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response connectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody, Context context) { + return connectWithResponseAsync(resourceGroupName, workspaceName, dataConnectorId, connectBody, context) + .block(); + } + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void connect(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody) { + connectWithResponse(resourceGroupName, workspaceName, dataConnectorId, connectBody, Context.NONE); + } + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disconnectWithResponseAsync(String resourceGroupName, String workspaceName, + String dataConnectorId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorId == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataConnectorId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.disconnect(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, dataConnectorId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disconnectWithResponseAsync(String resourceGroupName, String workspaceName, + String dataConnectorId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (dataConnectorId == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataConnectorId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.disconnect(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, dataConnectorId, accept, context); + } + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disconnectAsync(String resourceGroupName, String workspaceName, String dataConnectorId) { + return disconnectWithResponseAsync(resourceGroupName, workspaceName, dataConnectorId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disconnectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + Context context) { + return disconnectWithResponseAsync(resourceGroupName, workspaceName, dataConnectorId, context).block(); + } + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void disconnect(String resourceGroupName, String workspaceName, String dataConnectorId) { + disconnectWithResponse(resourceGroupName, workspaceName, dataConnectorId, Context.NONE); + } + /** * Get the next page of items. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsImpl.java index 4899f0b8fe3e..bc886b58adb7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsImpl.java @@ -12,6 +12,7 @@ import com.azure.resourcemanager.securityinsights.fluent.DataConnectorsClient; import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; import com.azure.resourcemanager.securityinsights.models.DataConnector; +import com.azure.resourcemanager.securityinsights.models.DataConnectorConnectBody; import com.azure.resourcemanager.securityinsights.models.DataConnectors; public final class DataConnectorsImpl implements DataConnectors { @@ -90,6 +91,26 @@ public void delete(String resourceGroupName, String workspaceName, String dataCo this.serviceClient().delete(resourceGroupName, workspaceName, dataConnectorId); } + public Response connectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody, Context context) { + return this.serviceClient() + .connectWithResponse(resourceGroupName, workspaceName, dataConnectorId, connectBody, context); + } + + public void connect(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody) { + this.serviceClient().connect(resourceGroupName, workspaceName, dataConnectorId, connectBody); + } + + public Response disconnectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + Context context) { + return this.serviceClient().disconnectWithResponse(resourceGroupName, workspaceName, dataConnectorId, context); + } + + public void disconnect(String resourceGroupName, String workspaceName, String dataConnectorId) { + this.serviceClient().disconnect(resourceGroupName, workspaceName, dataConnectorId); + } + private DataConnectorsClient serviceClient() { return this.innerClient; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EnrichmentDomainWhoisImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EnrichmentDomainWhoisImpl.java new file mode 100644 index 000000000000..497dcf8a481e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EnrichmentDomainWhoisImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentDomainWhoisInner; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainWhois; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainWhoisDetails; +import java.time.OffsetDateTime; + +public final class EnrichmentDomainWhoisImpl implements EnrichmentDomainWhois { + private EnrichmentDomainWhoisInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EnrichmentDomainWhoisImpl(EnrichmentDomainWhoisInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String domain() { + return this.innerModel().domain(); + } + + public String server() { + return this.innerModel().server(); + } + + public OffsetDateTime created() { + return this.innerModel().created(); + } + + public OffsetDateTime updated() { + return this.innerModel().updated(); + } + + public OffsetDateTime expires() { + return this.innerModel().expires(); + } + + public EnrichmentDomainWhoisDetails parsedWhois() { + return this.innerModel().parsedWhois(); + } + + public EnrichmentDomainWhoisInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EnrichmentIpGeodataImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EnrichmentIpGeodataImpl.java new file mode 100644 index 000000000000..4f6122434a44 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EnrichmentIpGeodataImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentIpGeodataInner; +import com.azure.resourcemanager.securityinsights.models.EnrichmentIpGeodata; + +public final class EnrichmentIpGeodataImpl implements EnrichmentIpGeodata { + private EnrichmentIpGeodataInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EnrichmentIpGeodataImpl(EnrichmentIpGeodataInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String asn() { + return this.innerModel().asn(); + } + + public String carrier() { + return this.innerModel().carrier(); + } + + public String city() { + return this.innerModel().city(); + } + + public Integer cityConfidenceFactor() { + return this.innerModel().cityConfidenceFactor(); + } + + public String continent() { + return this.innerModel().continent(); + } + + public String country() { + return this.innerModel().country(); + } + + public Integer countryConfidenceFactor() { + return this.innerModel().countryConfidenceFactor(); + } + + public String ipAddr() { + return this.innerModel().ipAddr(); + } + + public String ipRoutingType() { + return this.innerModel().ipRoutingType(); + } + + public String latitude() { + return this.innerModel().latitude(); + } + + public String longitude() { + return this.innerModel().longitude(); + } + + public String organization() { + return this.innerModel().organization(); + } + + public String organizationType() { + return this.innerModel().organizationType(); + } + + public String region() { + return this.innerModel().region(); + } + + public String state() { + return this.innerModel().state(); + } + + public Integer stateConfidenceFactor() { + return this.innerModel().stateConfidenceFactor(); + } + + public String stateCode() { + return this.innerModel().stateCode(); + } + + public EnrichmentIpGeodataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesClientImpl.java new file mode 100644 index 000000000000..dabb508ff930 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesClientImpl.java @@ -0,0 +1,1066 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityExpandResponseInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityGetInsightsResponseInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner; +import com.azure.resourcemanager.securityinsights.models.EntityExpandParameters; +import com.azure.resourcemanager.securityinsights.models.EntityGetInsightsParameters; +import com.azure.resourcemanager.securityinsights.models.EntityItemQueryKind; +import com.azure.resourcemanager.securityinsights.models.EntityList; +import com.azure.resourcemanager.securityinsights.models.EntityManualTriggerRequestBody; +import com.azure.resourcemanager.securityinsights.models.GetQueriesResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EntitiesClient. + */ +public final class EntitiesClientImpl implements EntitiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final EntitiesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of EntitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntitiesClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(EntitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsEntities to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsEnti") + public interface EntitiesService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityIdentifier}/runPlaybook") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> runPlaybook(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityIdentifier") String entityIdentifier, + @BodyParam("application/json") EntityManualTriggerRequestBody requestBody, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityId") String entityId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> expand(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityId") String entityId, @BodyParam("application/json") EntityExpandParameters parameters, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> queries(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityId") String entityId, @QueryParam("kind") EntityItemQueryKind kind, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getInsights(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityId") String entityId, + @BodyParam("application/json") EntityGetInsightsParameters parameters, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @param requestBody Describes the request body for triggering a playbook on an entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runPlaybookWithResponseAsync(String resourceGroupName, String workspaceName, + String entityIdentifier, EntityManualTriggerRequestBody requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter entityIdentifier is required and cannot be null.")); + } + if (requestBody != null) { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.runPlaybook(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityIdentifier, requestBody, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @param requestBody Describes the request body for triggering a playbook on an entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runPlaybookWithResponseAsync(String resourceGroupName, String workspaceName, + String entityIdentifier, EntityManualTriggerRequestBody requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter entityIdentifier is required and cannot be null.")); + } + if (requestBody != null) { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.runPlaybook(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityIdentifier, requestBody, accept, + context); + } + + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runPlaybookAsync(String resourceGroupName, String workspaceName, String entityIdentifier) { + final EntityManualTriggerRequestBody requestBody = null; + return runPlaybookWithResponseAsync(resourceGroupName, workspaceName, entityIdentifier, requestBody) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @param requestBody Describes the request body for triggering a playbook on an entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, + String entityIdentifier, EntityManualTriggerRequestBody requestBody, Context context) { + return runPlaybookWithResponseAsync(resourceGroupName, workspaceName, entityIdentifier, requestBody, context) + .block(); + } + + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void runPlaybook(String resourceGroupName, String workspaceName, String entityIdentifier) { + final EntityManualTriggerRequestBody requestBody = null; + runPlaybookWithResponse(resourceGroupName, workspaceName, entityIdentifier, requestBody, Context.NONE); + } + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String entityId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String entityId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityId, accept, context); + } + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String entityId) { + return getWithResponseAsync(resourceGroupName, workspaceName, entityId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String entityId, + Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, entityId, context).block(); + } + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EntityInner get(String resourceGroupName, String workspaceName, String entityId) { + return getWithResponse(resourceGroupName, workspaceName, entityId, Context.NONE).getValue(); + } + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandWithResponseAsync(String resourceGroupName, + String workspaceName, String entityId, EntityExpandParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.expand(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandWithResponseAsync(String resourceGroupName, + String workspaceName, String entityId, EntityExpandParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.expand(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityId, parameters, accept, context); + } + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono expandAsync(String resourceGroupName, String workspaceName, String entityId, + EntityExpandParameters parameters) { + return expandWithResponseAsync(resourceGroupName, workspaceName, entityId, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response expandWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityExpandParameters parameters, Context context) { + return expandWithResponseAsync(resourceGroupName, workspaceName, entityId, parameters, context).block(); + } + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EntityExpandResponseInner expand(String resourceGroupName, String workspaceName, String entityId, + EntityExpandParameters parameters) { + return expandWithResponse(resourceGroupName, workspaceName, entityId, parameters, Context.NONE).getValue(); + } + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> queriesSinglePageAsync(String resourceGroupName, + String workspaceName, String entityId, EntityItemQueryKind kind) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (kind == null) { + return Mono.error(new IllegalArgumentException("Parameter kind is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.queries(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, kind, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> queriesSinglePageAsync(String resourceGroupName, + String workspaceName, String entityId, EntityItemQueryKind kind, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (kind == null) { + return Mono.error(new IllegalArgumentException("Parameter kind is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .queries(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityId, kind, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), null, null)); + } + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux queriesAsync(String resourceGroupName, String workspaceName, + String entityId, EntityItemQueryKind kind) { + return new PagedFlux<>(() -> queriesSinglePageAsync(resourceGroupName, workspaceName, entityId, kind)); + } + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux queriesAsync(String resourceGroupName, String workspaceName, + String entityId, EntityItemQueryKind kind, Context context) { + return new PagedFlux<>(() -> queriesSinglePageAsync(resourceGroupName, workspaceName, entityId, kind, context)); + } + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind) { + return new PagedIterable<>(queriesAsync(resourceGroupName, workspaceName, entityId, kind)); + } + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind, Context context) { + return new PagedIterable<>(queriesAsync(resourceGroupName, workspaceName, entityId, kind, context)); + } + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInsightsWithResponseAsync(String resourceGroupName, + String workspaceName, String entityId, EntityGetInsightsParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getInsights(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, parameters, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getInsightsWithResponseAsync(String resourceGroupName, + String workspaceName, String entityId, EntityGetInsightsParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getInsights(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, parameters, accept, context); + } + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getInsightsAsync(String resourceGroupName, String workspaceName, + String entityId, EntityGetInsightsParameters parameters) { + return getInsightsWithResponseAsync(resourceGroupName, workspaceName, entityId, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getInsightsWithResponse(String resourceGroupName, + String workspaceName, String entityId, EntityGetInsightsParameters parameters, Context context) { + return getInsightsWithResponseAsync(resourceGroupName, workspaceName, entityId, parameters, context).block(); + } + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EntityGetInsightsResponseInner getInsights(String resourceGroupName, String workspaceName, String entityId, + EntityGetInsightsParameters parameters) { + return getInsightsWithResponse(resourceGroupName, workspaceName, entityId, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesGetTimelinesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesGetTimelinesClientImpl.java new file mode 100644 index 000000000000..b8568c73e1e7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesGetTimelinesClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesGetTimelinesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityTimelineResponseInner; +import com.azure.resourcemanager.securityinsights.models.EntityTimelineParameters; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EntitiesGetTimelinesClient. + */ +public final class EntitiesGetTimelinesClientImpl implements EntitiesGetTimelinesClient { + /** + * The proxy service used to perform REST calls. + */ + private final EntitiesGetTimelinesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of EntitiesGetTimelinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntitiesGetTimelinesClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(EntitiesGetTimelinesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsEntitiesGetTimelines to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsEnti") + public interface EntitiesGetTimelinesService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityId") String entityId, @BodyParam("application/json") EntityTimelineParameters parameters, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String resourceGroupName, + String workspaceName, String entityId, EntityTimelineParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(String resourceGroupName, + String workspaceName, String entityId, EntityTimelineParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityId, parameters, accept, context); + } + + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String workspaceName, String entityId, + EntityTimelineParameters parameters) { + return listWithResponseAsync(resourceGroupName, workspaceName, entityId, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityTimelineParameters parameters, Context context) { + return listWithResponseAsync(resourceGroupName, workspaceName, entityId, parameters, context).block(); + } + + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EntityTimelineResponseInner list(String resourceGroupName, String workspaceName, String entityId, + EntityTimelineParameters parameters) { + return listWithResponse(resourceGroupName, workspaceName, entityId, parameters, Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesGetTimelinesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesGetTimelinesImpl.java new file mode 100644 index 000000000000..eebaf982ff43 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesGetTimelinesImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesGetTimelinesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityTimelineResponseInner; +import com.azure.resourcemanager.securityinsights.models.EntitiesGetTimelines; +import com.azure.resourcemanager.securityinsights.models.EntityTimelineParameters; +import com.azure.resourcemanager.securityinsights.models.EntityTimelineResponse; + +public final class EntitiesGetTimelinesImpl implements EntitiesGetTimelines { + private static final ClientLogger LOGGER = new ClientLogger(EntitiesGetTimelinesImpl.class); + + private final EntitiesGetTimelinesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public EntitiesGetTimelinesImpl(EntitiesGetTimelinesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityTimelineParameters parameters, Context context) { + Response inner + = this.serviceClient().listWithResponse(resourceGroupName, workspaceName, entityId, parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EntityTimelineResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EntityTimelineResponse list(String resourceGroupName, String workspaceName, String entityId, + EntityTimelineParameters parameters) { + EntityTimelineResponseInner inner + = this.serviceClient().list(resourceGroupName, workspaceName, entityId, parameters); + if (inner != null) { + return new EntityTimelineResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private EntitiesGetTimelinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesImpl.java new file mode 100644 index 000000000000..f08a5a13745a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityExpandResponseInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityGetInsightsResponseInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner; +import com.azure.resourcemanager.securityinsights.models.Entities; +import com.azure.resourcemanager.securityinsights.models.Entity; +import com.azure.resourcemanager.securityinsights.models.EntityExpandParameters; +import com.azure.resourcemanager.securityinsights.models.EntityExpandResponse; +import com.azure.resourcemanager.securityinsights.models.EntityGetInsightsParameters; +import com.azure.resourcemanager.securityinsights.models.EntityGetInsightsResponse; +import com.azure.resourcemanager.securityinsights.models.EntityItemQueryKind; +import com.azure.resourcemanager.securityinsights.models.EntityManualTriggerRequestBody; +import com.azure.resourcemanager.securityinsights.models.EntityQueryItem; + +public final class EntitiesImpl implements Entities { + private static final ClientLogger LOGGER = new ClientLogger(EntitiesImpl.class); + + private final EntitiesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public EntitiesImpl(EntitiesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, + String entityIdentifier, EntityManualTriggerRequestBody requestBody, Context context) { + return this.serviceClient() + .runPlaybookWithResponse(resourceGroupName, workspaceName, entityIdentifier, requestBody, context); + } + + public void runPlaybook(String resourceGroupName, String workspaceName, String entityIdentifier) { + this.serviceClient().runPlaybook(resourceGroupName, workspaceName, entityIdentifier); + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String entityId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, entityId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EntityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Entity get(String resourceGroupName, String workspaceName, String entityId) { + EntityInner inner = this.serviceClient().get(resourceGroupName, workspaceName, entityId); + if (inner != null) { + return new EntityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response expandWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityExpandParameters parameters, Context context) { + Response inner + = this.serviceClient().expandWithResponse(resourceGroupName, workspaceName, entityId, parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EntityExpandResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EntityExpandResponse expand(String resourceGroupName, String workspaceName, String entityId, + EntityExpandParameters parameters) { + EntityExpandResponseInner inner + = this.serviceClient().expand(resourceGroupName, workspaceName, entityId, parameters); + if (inner != null) { + return new EntityExpandResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind) { + PagedIterable inner + = this.serviceClient().queries(resourceGroupName, workspaceName, entityId, kind); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityQueryItemImpl(inner1, this.manager())); + } + + public PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind, Context context) { + PagedIterable inner + = this.serviceClient().queries(resourceGroupName, workspaceName, entityId, kind, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityQueryItemImpl(inner1, this.manager())); + } + + public Response getInsightsWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityGetInsightsParameters parameters, Context context) { + Response inner = this.serviceClient() + .getInsightsWithResponse(resourceGroupName, workspaceName, entityId, parameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EntityGetInsightsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EntityGetInsightsResponse getInsights(String resourceGroupName, String workspaceName, String entityId, + EntityGetInsightsParameters parameters) { + EntityGetInsightsResponseInner inner + = this.serviceClient().getInsights(resourceGroupName, workspaceName, entityId, parameters); + if (inner != null) { + return new EntityGetInsightsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private EntitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesRelationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesRelationsClientImpl.java new file mode 100644 index 000000000000..46882edcbbf0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesRelationsClientImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; +import com.azure.resourcemanager.securityinsights.models.RelationList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EntitiesRelationsClient. + */ +public final class EntitiesRelationsClientImpl implements EntitiesRelationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final EntitiesRelationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of EntitiesRelationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntitiesRelationsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(EntitiesRelationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsEntitiesRelations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsEnti") + public interface EntitiesRelationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityId") String entityId, @QueryParam("$filter") String filter, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String entityId, String filter, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, filter, orderby, top, + skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String entityId, String filter, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityId, filter, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String entityId, + String filter, String orderby, Integer top, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, entityId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String entityId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, entityId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String entityId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, entityId, filter, orderby, + top, skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String entityId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, entityId, filter, orderby, top, skipToken)); + } + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String entityId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, entityId, filter, orderby, top, skipToken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesRelationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesRelationsImpl.java new file mode 100644 index 000000000000..d9af690ad635 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntitiesRelationsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; +import com.azure.resourcemanager.securityinsights.models.EntitiesRelations; +import com.azure.resourcemanager.securityinsights.models.Relation; + +public final class EntitiesRelationsImpl implements EntitiesRelations { + private static final ClientLogger LOGGER = new ClientLogger(EntitiesRelationsImpl.class); + + private final EntitiesRelationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public EntitiesRelationsImpl(EntitiesRelationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String entityId) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, entityId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RelationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String entityId, String filter, + String orderby, Integer top, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, entityId, filter, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RelationImpl(inner1, this.manager())); + } + + private EntitiesRelationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityExpandResponseImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityExpandResponseImpl.java new file mode 100644 index 000000000000..6b7f4403b51b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityExpandResponseImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityExpandResponseInner; +import com.azure.resourcemanager.securityinsights.models.EntityExpandResponse; +import com.azure.resourcemanager.securityinsights.models.EntityExpandResponseValue; +import com.azure.resourcemanager.securityinsights.models.ExpansionResultsMetadata; + +public final class EntityExpandResponseImpl implements EntityExpandResponse { + private EntityExpandResponseInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EntityExpandResponseImpl(EntityExpandResponseInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ExpansionResultsMetadata metadata() { + return this.innerModel().metadata(); + } + + public EntityExpandResponseValue value() { + return this.innerModel().value(); + } + + public EntityExpandResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityGetInsightsResponseImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityGetInsightsResponseImpl.java new file mode 100644 index 000000000000..3ef9ba9c501e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityGetInsightsResponseImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityGetInsightsResponseInner; +import com.azure.resourcemanager.securityinsights.models.EntityGetInsightsResponse; +import com.azure.resourcemanager.securityinsights.models.EntityInsightItem; +import com.azure.resourcemanager.securityinsights.models.GetInsightsResultsMetadata; +import java.util.Collections; +import java.util.List; + +public final class EntityGetInsightsResponseImpl implements EntityGetInsightsResponse { + private EntityGetInsightsResponseInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EntityGetInsightsResponseImpl(EntityGetInsightsResponseInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public GetInsightsResultsMetadata metadata() { + return this.innerModel().metadata(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EntityGetInsightsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityImpl.java new file mode 100644 index 000000000000..bcc1c8b2335a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import com.azure.resourcemanager.securityinsights.models.Entity; +import com.azure.resourcemanager.securityinsights.models.EntityKindEnum; + +public final class EntityImpl implements Entity { + private EntityInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EntityImpl(EntityInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public EntityKindEnum kind() { + return this.innerModel().kind(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public EntityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueriesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueriesClientImpl.java new file mode 100644 index 000000000000..aa2f05a81e03 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueriesClientImpl.java @@ -0,0 +1,739 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.EntityQueriesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; +import com.azure.resourcemanager.securityinsights.models.CustomEntityQuery; +import com.azure.resourcemanager.securityinsights.models.EntityQueryList; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EntityQueriesClient. + */ +public final class EntityQueriesClientImpl implements EntityQueriesClient { + /** + * The proxy service used to perform REST calls. + */ + private final EntityQueriesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of EntityQueriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntityQueriesClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(EntityQueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsEntityQueries to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsEnti") + public interface EntityQueriesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("kind") EntityQueryTemplateKind kind, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityQueryId") String entityQueryId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityQueryId") String entityQueryId, + @BodyParam("application/json") CustomEntityQuery entityQuery, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityQueryId") String entityQueryId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity query kind we want to fetch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), kind, this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), kind, this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity query kind we want to fetch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, kind), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final EntityQueryTemplateKind kind = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, kind), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, kind, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final EntityQueryTemplateKind kind = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, kind)); + } + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, kind, context)); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String entityQueryId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQueryId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityQueryId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String entityQueryId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQueryId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityQueryId, accept, context); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String entityQueryId) { + return getWithResponseAsync(resourceGroupName, workspaceName, entityQueryId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String entityQueryId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, entityQueryId, context).block(); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EntityQueryInner get(String resourceGroupName, String workspaceName, String entityQueryId) { + return getWithResponse(resourceGroupName, workspaceName, entityQueryId, Context.NONE).getValue(); + } + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String entityQueryId, CustomEntityQuery entityQuery) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQueryId is required and cannot be null.")); + } + if (entityQuery == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQuery is required and cannot be null.")); + } else { + entityQuery.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityQueryId, entityQuery, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String entityQueryId, CustomEntityQuery entityQuery, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQueryId is required and cannot be null.")); + } + if (entityQuery == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQuery is required and cannot be null.")); + } else { + entityQuery.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityQueryId, entityQuery, accept, + context); + } + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String entityQueryId, CustomEntityQuery entityQuery) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, entityQueryId, entityQuery) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String entityQueryId, CustomEntityQuery entityQuery, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, entityQueryId, entityQuery, context) + .block(); + } + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EntityQueryInner createOrUpdate(String resourceGroupName, String workspaceName, String entityQueryId, + CustomEntityQuery entityQuery) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, entityQueryId, entityQuery, Context.NONE) + .getValue(); + } + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String entityQueryId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQueryId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityQueryId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String entityQueryId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityQueryId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityQueryId, accept, context); + } + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String entityQueryId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, entityQueryId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String entityQueryId, + Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, entityQueryId, context).block(); + } + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String entityQueryId) { + deleteWithResponse(resourceGroupName, workspaceName, entityQueryId, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the entity queries along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the entity queries along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueriesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueriesImpl.java new file mode 100644 index 000000000000..cbd2c4b628cc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueriesImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.EntityQueriesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; +import com.azure.resourcemanager.securityinsights.models.CustomEntityQuery; +import com.azure.resourcemanager.securityinsights.models.EntityQueries; +import com.azure.resourcemanager.securityinsights.models.EntityQuery; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + +public final class EntityQueriesImpl implements EntityQueries { + private static final ClientLogger LOGGER = new ClientLogger(EntityQueriesImpl.class); + + private final EntityQueriesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public EntityQueriesImpl(EntityQueriesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityQueryImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, EntityQueryTemplateKind kind, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, kind, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityQueryImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String entityQueryId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, entityQueryId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EntityQueryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EntityQuery get(String resourceGroupName, String workspaceName, String entityQueryId) { + EntityQueryInner inner = this.serviceClient().get(resourceGroupName, workspaceName, entityQueryId); + if (inner != null) { + return new EntityQueryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String entityQueryId, CustomEntityQuery entityQuery, Context context) { + Response inner = this.serviceClient() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, entityQueryId, entityQuery, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EntityQueryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EntityQuery createOrUpdate(String resourceGroupName, String workspaceName, String entityQueryId, + CustomEntityQuery entityQuery) { + EntityQueryInner inner + = this.serviceClient().createOrUpdate(resourceGroupName, workspaceName, entityQueryId, entityQuery); + if (inner != null) { + return new EntityQueryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String entityQueryId, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, entityQueryId, context); + } + + public void delete(String resourceGroupName, String workspaceName, String entityQueryId) { + this.serviceClient().delete(resourceGroupName, workspaceName, entityQueryId); + } + + private EntityQueriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryImpl.java new file mode 100644 index 000000000000..03fb5b702d5d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; +import com.azure.resourcemanager.securityinsights.models.EntityQuery; +import com.azure.resourcemanager.securityinsights.models.EntityQueryKind; + +public final class EntityQueryImpl implements EntityQuery { + private EntityQueryInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EntityQueryImpl(EntityQueryInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public EntityQueryKind kind() { + return this.innerModel().kind(); + } + + public EntityQueryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryItemImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryItemImpl.java new file mode 100644 index 000000000000..3afc18ed5233 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryItemImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner; +import com.azure.resourcemanager.securityinsights.models.EntityQueryItem; +import com.azure.resourcemanager.securityinsights.models.EntityQueryKind; + +public final class EntityQueryItemImpl implements EntityQueryItem { + private EntityQueryItemInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EntityQueryItemImpl(EntityQueryItemInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public EntityQueryKind kind() { + return this.innerModel().kind(); + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public EntityQueryItemInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplateImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplateImpl.java new file mode 100644 index 000000000000..5df75661b3a4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplateImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplate; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + +public final class EntityQueryTemplateImpl implements EntityQueryTemplate { + private EntityQueryTemplateInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EntityQueryTemplateImpl(EntityQueryTemplateInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public EntityQueryTemplateKind kind() { + return this.innerModel().kind(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public EntityQueryTemplateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplatesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplatesClientImpl.java new file mode 100644 index 000000000000..b34f00093a7f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplatesClientImpl.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.EntityQueryTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EntityQueryTemplatesClient. + */ +public final class EntityQueryTemplatesClientImpl implements EntityQueryTemplatesClient { + /** + * The proxy service used to perform REST calls. + */ + private final EntityQueryTemplatesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of EntityQueryTemplatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntityQueryTemplatesClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(EntityQueryTemplatesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsEntityQueryTemplates to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsEnti") + public interface EntityQueryTemplatesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("kind") EntityQueryTemplateKind kind, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityQueryTemplateId") String entityQueryTemplateId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity template query kind we want to fetch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, EntityQueryTemplateKind kind) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), kind, this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity template query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, EntityQueryTemplateKind kind, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), kind, this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity template query kind we want to fetch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, kind), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final EntityQueryTemplateKind kind = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, kind), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity template query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, kind, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final EntityQueryTemplateKind kind = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, kind)); + } + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity template query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, kind, context)); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String entityQueryTemplateId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryTemplateId == null) { + return Mono + .error(new IllegalArgumentException("Parameter entityQueryTemplateId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityQueryTemplateId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String entityQueryTemplateId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityQueryTemplateId == null) { + return Mono + .error(new IllegalArgumentException("Parameter entityQueryTemplateId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, entityQueryTemplateId, accept, context); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String entityQueryTemplateId) { + return getWithResponseAsync(resourceGroupName, workspaceName, entityQueryTemplateId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String entityQueryTemplateId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, entityQueryTemplateId, context).block(); + } + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EntityQueryTemplateInner get(String resourceGroupName, String workspaceName, String entityQueryTemplateId) { + return getWithResponse(resourceGroupName, workspaceName, entityQueryTemplateId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the entity query templates along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the entity query templates along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplatesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplatesImpl.java new file mode 100644 index 000000000000..a83bc3f2c56b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityQueryTemplatesImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.EntityQueryTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplate; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplates; + +public final class EntityQueryTemplatesImpl implements EntityQueryTemplates { + private static final ClientLogger LOGGER = new ClientLogger(EntityQueryTemplatesImpl.class); + + private final EntityQueryTemplatesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public EntityQueryTemplatesImpl(EntityQueryTemplatesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityQueryTemplateImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, kind, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EntityQueryTemplateImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String entityQueryTemplateId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, entityQueryTemplateId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EntityQueryTemplateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EntityQueryTemplate get(String resourceGroupName, String workspaceName, String entityQueryTemplateId) { + EntityQueryTemplateInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, entityQueryTemplateId); + if (inner != null) { + return new EntityQueryTemplateImpl(inner, this.manager()); + } else { + return null; + } + } + + private EntityQueryTemplatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityRelationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityRelationsClientImpl.java new file mode 100644 index 000000000000..5560c4462fb7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityRelationsClientImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.EntityRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EntityRelationsClient. + */ +public final class EntityRelationsClientImpl implements EntityRelationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final EntityRelationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of EntityRelationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EntityRelationsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(EntityRelationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsEntityRelations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsEnti") + public interface EntityRelationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getRelation(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("entityId") String entityId, @PathParam("relationName") String relationName, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRelationWithResponseAsync(String resourceGroupName, String workspaceName, + String entityId, String relationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getRelation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, relationName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRelationWithResponseAsync(String resourceGroupName, String workspaceName, + String entityId, String relationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (entityId == null) { + return Mono.error(new IllegalArgumentException("Parameter entityId is required and cannot be null.")); + } + if (relationName == null) { + return Mono.error(new IllegalArgumentException("Parameter relationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getRelation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, entityId, relationName, accept, context); + } + + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getRelationAsync(String resourceGroupName, String workspaceName, String entityId, + String relationName) { + return getRelationWithResponseAsync(resourceGroupName, workspaceName, entityId, relationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRelationWithResponse(String resourceGroupName, String workspaceName, + String entityId, String relationName, Context context) { + return getRelationWithResponseAsync(resourceGroupName, workspaceName, entityId, relationName, context).block(); + } + + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RelationInner getRelation(String resourceGroupName, String workspaceName, String entityId, + String relationName) { + return getRelationWithResponse(resourceGroupName, workspaceName, entityId, relationName, Context.NONE) + .getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityRelationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityRelationsImpl.java new file mode 100644 index 000000000000..f6cd3e1d1fd4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityRelationsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.EntityRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; +import com.azure.resourcemanager.securityinsights.models.EntityRelations; +import com.azure.resourcemanager.securityinsights.models.Relation; + +public final class EntityRelationsImpl implements EntityRelations { + private static final ClientLogger LOGGER = new ClientLogger(EntityRelationsImpl.class); + + private final EntityRelationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public EntityRelationsImpl(EntityRelationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getRelationWithResponse(String resourceGroupName, String workspaceName, String entityId, + String relationName, Context context) { + Response inner = this.serviceClient() + .getRelationWithResponse(resourceGroupName, workspaceName, entityId, relationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RelationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Relation getRelation(String resourceGroupName, String workspaceName, String entityId, String relationName) { + RelationInner inner + = this.serviceClient().getRelation(resourceGroupName, workspaceName, entityId, relationName); + if (inner != null) { + return new RelationImpl(inner, this.manager()); + } else { + return null; + } + } + + private EntityRelationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityTimelineResponseImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityTimelineResponseImpl.java new file mode 100644 index 000000000000..44393366ce73 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/EntityTimelineResponseImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityTimelineResponseInner; +import com.azure.resourcemanager.securityinsights.models.EntityTimelineItem; +import com.azure.resourcemanager.securityinsights.models.EntityTimelineResponse; +import com.azure.resourcemanager.securityinsights.models.TimelineResultsMetadata; +import java.util.Collections; +import java.util.List; + +public final class EntityTimelineResponseImpl implements EntityTimelineResponse { + private EntityTimelineResponseInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + EntityTimelineResponseImpl(EntityTimelineResponseInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public TimelineResultsMetadata metadata() { + return this.innerModel().metadata(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EntityTimelineResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportImpl.java new file mode 100644 index 000000000000..c819a8220a26 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.FileImportInner; +import com.azure.resourcemanager.securityinsights.models.FileImport; +import com.azure.resourcemanager.securityinsights.models.FileImportContentType; +import com.azure.resourcemanager.securityinsights.models.FileImportState; +import com.azure.resourcemanager.securityinsights.models.FileMetadata; +import com.azure.resourcemanager.securityinsights.models.IngestionMode; +import com.azure.resourcemanager.securityinsights.models.ValidationError; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class FileImportImpl implements FileImport, FileImport.Definition { + private FileImportInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + FileImportImpl(FileImportInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public IngestionMode ingestionMode() { + return this.innerModel().ingestionMode(); + } + + public FileImportContentType contentType() { + return this.innerModel().contentType(); + } + + public OffsetDateTime createdTimeUtc() { + return this.innerModel().createdTimeUtc(); + } + + public FileMetadata errorFile() { + return this.innerModel().errorFile(); + } + + public List errorsPreview() { + List inner = this.innerModel().errorsPreview(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public FileMetadata importFile() { + return this.innerModel().importFile(); + } + + public Integer ingestedRecordCount() { + return this.innerModel().ingestedRecordCount(); + } + + public String source() { + return this.innerModel().source(); + } + + public FileImportState state() { + return this.innerModel().state(); + } + + public Integer totalRecordCount() { + return this.innerModel().totalRecordCount(); + } + + public Integer validRecordCount() { + return this.innerModel().validRecordCount(); + } + + public OffsetDateTime filesValidUntilTimeUtc() { + return this.innerModel().filesValidUntilTimeUtc(); + } + + public OffsetDateTime importValidUntilTimeUtc() { + return this.innerModel().importValidUntilTimeUtc(); + } + + public FileImportInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String fileImportId; + + public FileImportImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public FileImport create() { + this.innerObject = serviceManager.serviceClient() + .getFileImports() + .createWithResponse(resourceGroupName, workspaceName, fileImportId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public FileImport create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFileImports() + .createWithResponse(resourceGroupName, workspaceName, fileImportId, this.innerModel(), context) + .getValue(); + return this; + } + + FileImportImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new FileImportInner(); + this.serviceManager = serviceManager; + this.fileImportId = name; + } + + public FileImport refresh() { + this.innerObject = serviceManager.serviceClient() + .getFileImports() + .getWithResponse(resourceGroupName, workspaceName, fileImportId, Context.NONE) + .getValue(); + return this; + } + + public FileImport refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFileImports() + .getWithResponse(resourceGroupName, workspaceName, fileImportId, context) + .getValue(); + return this; + } + + public FileImportImpl withIngestionMode(IngestionMode ingestionMode) { + this.innerModel().withIngestionMode(ingestionMode); + return this; + } + + public FileImportImpl withContentType(FileImportContentType contentType) { + this.innerModel().withContentType(contentType); + return this; + } + + public FileImportImpl withImportFile(FileMetadata importFile) { + this.innerModel().withImportFile(importFile); + return this; + } + + public FileImportImpl withSource(String source) { + this.innerModel().withSource(source); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportsClientImpl.java new file mode 100644 index 000000000000..c4e30a033481 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportsClientImpl.java @@ -0,0 +1,875 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.securityinsights.fluent.FileImportsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.FileImportInner; +import com.azure.resourcemanager.securityinsights.models.FileImportList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FileImportsClient. + */ +public final class FileImportsClientImpl implements FileImportsClient { + /** + * The proxy service used to perform REST calls. + */ + private final FileImportsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of FileImportsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FileImportsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(FileImportsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsFileImports to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsFile") + public interface FileImportsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, @QueryParam("$orderby") String orderby, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports/{fileImportId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("fileImportId") String fileImportId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports/{fileImportId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("fileImportId") String fileImportId, @BodyParam("application/json") FileImportInner fileImport, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports/{fileImportId}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("fileImportId") String fileImportId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, filter, orderby, top, skipToken, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, filter, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken)); + } + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, context)); + } + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String fileImportId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (fileImportId == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImportId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, fileImportId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String fileImportId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (fileImportId == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImportId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, fileImportId, accept, context); + } + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String fileImportId) { + return getWithResponseAsync(resourceGroupName, workspaceName, fileImportId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String fileImportId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, fileImportId, context).block(); + } + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FileImportInner get(String resourceGroupName, String workspaceName, String fileImportId) { + return getWithResponse(resourceGroupName, workspaceName, fileImportId, Context.NONE).getValue(); + } + + /** + * Creates the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param fileImport The file import. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String fileImportId, FileImportInner fileImport) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (fileImportId == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImportId is required and cannot be null.")); + } + if (fileImport == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImport is required and cannot be null.")); + } else { + fileImport.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, fileImportId, fileImport, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param fileImport The file import. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String fileImportId, FileImportInner fileImport, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (fileImportId == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImportId is required and cannot be null.")); + } + if (fileImport == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImport is required and cannot be null.")); + } else { + fileImport.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, fileImportId, fileImport, accept, context); + } + + /** + * Creates the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param fileImport The file import. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String workspaceName, String fileImportId, + FileImportInner fileImport) { + return createWithResponseAsync(resourceGroupName, workspaceName, fileImportId, fileImport) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param fileImport The file import. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String workspaceName, + String fileImportId, FileImportInner fileImport, Context context) { + return createWithResponseAsync(resourceGroupName, workspaceName, fileImportId, fileImport, context).block(); + } + + /** + * Creates the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param fileImport The file import. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FileImportInner create(String resourceGroupName, String workspaceName, String fileImportId, + FileImportInner fileImport) { + return createWithResponse(resourceGroupName, workspaceName, fileImportId, fileImport, Context.NONE).getValue(); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String fileImportId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (fileImportId == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImportId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, fileImportId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String fileImportId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (fileImportId == null) { + return Mono.error(new IllegalArgumentException("Parameter fileImportId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, fileImportId, accept, context); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FileImportInner> beginDeleteAsync(String resourceGroupName, + String workspaceName, String fileImportId) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceName, fileImportId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FileImportInner.class, FileImportInner.class, this.client.getContext()); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FileImportInner> beginDeleteAsync(String resourceGroupName, + String workspaceName, String fileImportId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, workspaceName, fileImportId, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FileImportInner.class, FileImportInner.class, context); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FileImportInner> beginDelete(String resourceGroupName, + String workspaceName, String fileImportId) { + return this.beginDeleteAsync(resourceGroupName, workspaceName, fileImportId).getSyncPoller(); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FileImportInner> beginDelete(String resourceGroupName, + String workspaceName, String fileImportId, Context context) { + return this.beginDeleteAsync(resourceGroupName, workspaceName, fileImportId, context).getSyncPoller(); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String fileImportId) { + return beginDeleteAsync(resourceGroupName, workspaceName, fileImportId).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String fileImportId, + Context context) { + return beginDeleteAsync(resourceGroupName, workspaceName, fileImportId, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FileImportInner delete(String resourceGroupName, String workspaceName, String fileImportId) { + return deleteAsync(resourceGroupName, workspaceName, fileImportId).block(); + } + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FileImportInner delete(String resourceGroupName, String workspaceName, String fileImportId, + Context context) { + return deleteAsync(resourceGroupName, workspaceName, fileImportId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the file imports along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the file imports along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportsImpl.java new file mode 100644 index 000000000000..1081453b2f4b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/FileImportsImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.FileImportsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.FileImportInner; +import com.azure.resourcemanager.securityinsights.models.FileImport; +import com.azure.resourcemanager.securityinsights.models.FileImports; + +public final class FileImportsImpl implements FileImports { + private static final ClientLogger LOGGER = new ClientLogger(FileImportsImpl.class); + + private final FileImportsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public FileImportsImpl(FileImportsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FileImportImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + Integer top, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, filter, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FileImportImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String fileImportId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, fileImportId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FileImportImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FileImport get(String resourceGroupName, String workspaceName, String fileImportId) { + FileImportInner inner = this.serviceClient().get(resourceGroupName, workspaceName, fileImportId); + if (inner != null) { + return new FileImportImpl(inner, this.manager()); + } else { + return null; + } + } + + public FileImport delete(String resourceGroupName, String workspaceName, String fileImportId) { + FileImportInner inner = this.serviceClient().delete(resourceGroupName, workspaceName, fileImportId); + if (inner != null) { + return new FileImportImpl(inner, this.manager()); + } else { + return null; + } + } + + public FileImport delete(String resourceGroupName, String workspaceName, String fileImportId, Context context) { + FileImportInner inner = this.serviceClient().delete(resourceGroupName, workspaceName, fileImportId, context); + if (inner != null) { + return new FileImportImpl(inner, this.manager()); + } else { + return null; + } + } + + public FileImport getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String fileImportId = ResourceManagerUtils.getValueFromIdByName(id, "fileImports"); + if (fileImportId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fileImports'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, fileImportId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String fileImportId = ResourceManagerUtils.getValueFromIdByName(id, "fileImports"); + if (fileImportId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fileImports'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, fileImportId, context); + } + + public FileImport deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String fileImportId = ResourceManagerUtils.getValueFromIdByName(id, "fileImports"); + if (fileImportId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fileImports'.", id))); + } + return this.delete(resourceGroupName, workspaceName, fileImportId, Context.NONE); + } + + public FileImport deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String fileImportId = ResourceManagerUtils.getValueFromIdByName(id, "fileImports"); + if (fileImportId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fileImports'.", id))); + } + return this.delete(resourceGroupName, workspaceName, fileImportId, context); + } + + private FileImportsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public FileImportImpl define(String name) { + return new FileImportImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetRecommendationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetRecommendationsClientImpl.java new file mode 100644 index 000000000000..b58f8f4b9402 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetRecommendationsClientImpl.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.GetRecommendationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import com.azure.resourcemanager.securityinsights.models.RecommendationList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GetRecommendationsClient. + */ +public final class GetRecommendationsClientImpl implements GetRecommendationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GetRecommendationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of GetRecommendationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GetRecommendationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(GetRecommendationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsGetRecommendations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsGetR") + public interface GetRecommendationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetRecommendationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetRecommendationsImpl.java new file mode 100644 index 000000000000..55516c7b32f2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetRecommendationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.GetRecommendationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import com.azure.resourcemanager.securityinsights.models.GetRecommendations; +import com.azure.resourcemanager.securityinsights.models.Recommendation; + +public final class GetRecommendationsImpl implements GetRecommendations { + private static final ClientLogger LOGGER = new ClientLogger(GetRecommendationsImpl.class); + + private final GetRecommendationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public GetRecommendationsImpl(GetRecommendationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RecommendationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RecommendationImpl(inner1, this.manager())); + } + + private GetRecommendationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetTriggeredAnalyticsRuleRunsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetTriggeredAnalyticsRuleRunsClientImpl.java new file mode 100644 index 000000000000..dfc6c73883e6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetTriggeredAnalyticsRuleRunsClientImpl.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.GetTriggeredAnalyticsRuleRunsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; +import com.azure.resourcemanager.securityinsights.models.TriggeredAnalyticsRuleRuns; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GetTriggeredAnalyticsRuleRunsClient. + */ +public final class GetTriggeredAnalyticsRuleRunsClientImpl implements GetTriggeredAnalyticsRuleRunsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GetTriggeredAnalyticsRuleRunsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of GetTriggeredAnalyticsRuleRunsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GetTriggeredAnalyticsRuleRunsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(GetTriggeredAnalyticsRuleRunsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsGetTriggeredAnalyticsRuleRuns to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsGetT") + public interface GetTriggeredAnalyticsRuleRunsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run array along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run array along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetTriggeredAnalyticsRuleRunsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetTriggeredAnalyticsRuleRunsImpl.java new file mode 100644 index 000000000000..47ee84555be9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetTriggeredAnalyticsRuleRunsImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.GetTriggeredAnalyticsRuleRunsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; +import com.azure.resourcemanager.securityinsights.models.GetTriggeredAnalyticsRuleRuns; +import com.azure.resourcemanager.securityinsights.models.TriggeredAnalyticsRuleRun; + +public final class GetTriggeredAnalyticsRuleRunsImpl implements GetTriggeredAnalyticsRuleRuns { + private static final ClientLogger LOGGER = new ClientLogger(GetTriggeredAnalyticsRuleRunsImpl.class); + + private final GetTriggeredAnalyticsRuleRunsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public GetTriggeredAnalyticsRuleRunsImpl(GetTriggeredAnalyticsRuleRunsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TriggeredAnalyticsRuleRunImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TriggeredAnalyticsRuleRunImpl(inner1, this.manager())); + } + + private GetTriggeredAnalyticsRuleRunsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetsClientImpl.java new file mode 100644 index 000000000000..d8a847648b49 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetsClientImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.GetsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GetsClient. + */ +public final class GetsClientImpl implements GetsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GetsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of GetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GetsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(GetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsGets to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsGets") + public interface GetsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> singleRecommendation(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("recommendationId") UUID recommendationId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> singleRecommendationWithResponseAsync(String resourceGroupName, + String workspaceName, UUID recommendationId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (recommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.singleRecommendation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, recommendationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> singleRecommendationWithResponseAsync(String resourceGroupName, + String workspaceName, UUID recommendationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (recommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.singleRecommendation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, recommendationId, accept, context); + } + + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono singleRecommendationAsync(String resourceGroupName, String workspaceName, + UUID recommendationId) { + return singleRecommendationWithResponseAsync(resourceGroupName, workspaceName, recommendationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response singleRecommendationWithResponse(String resourceGroupName, + String workspaceName, UUID recommendationId, Context context) { + return singleRecommendationWithResponseAsync(resourceGroupName, workspaceName, recommendationId, context) + .block(); + } + + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendationInner singleRecommendation(String resourceGroupName, String workspaceName, + UUID recommendationId) { + return singleRecommendationWithResponse(resourceGroupName, workspaceName, recommendationId, Context.NONE) + .getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetsImpl.java new file mode 100644 index 000000000000..ea90b74ef8db --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/GetsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.GetsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import com.azure.resourcemanager.securityinsights.models.Gets; +import com.azure.resourcemanager.securityinsights.models.Recommendation; +import java.util.UUID; + +public final class GetsImpl implements Gets { + private static final ClientLogger LOGGER = new ClientLogger(GetsImpl.class); + + private final GetsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public GetsImpl(GetsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response singleRecommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, Context context) { + Response inner = this.serviceClient() + .singleRecommendationWithResponse(resourceGroupName, workspaceName, recommendationId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RecommendationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Recommendation singleRecommendation(String resourceGroupName, String workspaceName, UUID recommendationId) { + RecommendationInner inner + = this.serviceClient().singleRecommendation(resourceGroupName, workspaceName, recommendationId); + if (inner != null) { + return new RecommendationImpl(inner, this.manager()); + } else { + return null; + } + } + + private GetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentImpl.java new file mode 100644 index 000000000000..5fbd6df41148 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntCommentInner; +import com.azure.resourcemanager.securityinsights.models.HuntComment; + +public final class HuntCommentImpl implements HuntComment, HuntComment.Definition, HuntComment.Update { + private HuntCommentInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String message() { + return this.innerModel().message(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public HuntCommentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String huntId; + + private String huntCommentId; + + public HuntCommentImpl withExistingHunt(String resourceGroupName, String workspaceName, String huntId) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + this.huntId = huntId; + return this; + } + + public HuntComment create() { + this.innerObject = serviceManager.serviceClient() + .getHuntComments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public HuntComment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHuntComments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, this.innerModel(), + context) + .getValue(); + return this; + } + + HuntCommentImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new HuntCommentInner(); + this.serviceManager = serviceManager; + this.huntCommentId = name; + } + + public HuntCommentImpl update() { + return this; + } + + public HuntComment apply() { + this.innerObject = serviceManager.serviceClient() + .getHuntComments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public HuntComment apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHuntComments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, this.innerModel(), + context) + .getValue(); + return this; + } + + HuntCommentImpl(HuntCommentInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.huntId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "hunts"); + this.huntCommentId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "comments"); + } + + public HuntComment refresh() { + this.innerObject = serviceManager.serviceClient() + .getHuntComments() + .getWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, Context.NONE) + .getValue(); + return this; + } + + public HuntComment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHuntComments() + .getWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, context) + .getValue(); + return this; + } + + public HuntCommentImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public HuntCommentImpl withMessage(String message) { + this.innerModel().withMessage(message); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentsClientImpl.java new file mode 100644 index 000000000000..f991e705e74d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentsClientImpl.java @@ -0,0 +1,824 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.HuntCommentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntCommentInner; +import com.azure.resourcemanager.securityinsights.models.HuntCommentList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in HuntCommentsClient. + */ +public final class HuntCommentsClientImpl implements HuntCommentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final HuntCommentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of HuntCommentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HuntCommentsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(HuntCommentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsHuntComments to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsHunt") + public interface HuntCommentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @QueryParam("$filter") String filter, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @PathParam("huntCommentId") String huntCommentId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @PathParam("huntCommentId") String huntCommentId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/comments/{huntCommentId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @PathParam("huntCommentId") String huntCommentId, + @BodyParam("application/json") HuntCommentInner huntComment, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String huntId, String filter, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, filter, orderby, top, + skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String huntId, String filter, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String huntId, + String filter, String orderby, Integer top, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String huntId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String huntId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, + skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken)); + } + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken, context)); + } + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId, String huntCommentId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntCommentId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntCommentId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntCommentId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId, String huntCommentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntCommentId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntCommentId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, huntCommentId, accept, context); + } + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId) { + return getWithResponseAsync(resourceGroupName, workspaceName, huntId, huntCommentId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, huntId, huntCommentId, context).block(); + } + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HuntCommentInner get(String resourceGroupName, String workspaceName, String huntId, String huntCommentId) { + return getWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, Context.NONE).getValue(); + } + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntCommentId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntCommentId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntCommentId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntCommentId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntCommentId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, huntCommentId, accept, context); + } + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, huntId, huntCommentId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, huntId, huntCommentId, context).block(); + } + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String huntId, String huntCommentId) { + deleteWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, Context.NONE); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param huntComment The hunt comment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Comment in Azure Security Insights along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String huntId, String huntCommentId, HuntCommentInner huntComment) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntCommentId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntCommentId is required and cannot be null.")); + } + if (huntComment == null) { + return Mono.error(new IllegalArgumentException("Parameter huntComment is required and cannot be null.")); + } else { + huntComment.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntCommentId, huntComment, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param huntComment The hunt comment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Comment in Azure Security Insights along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String huntId, String huntCommentId, HuntCommentInner huntComment, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntCommentId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntCommentId is required and cannot be null.")); + } + if (huntComment == null) { + return Mono.error(new IllegalArgumentException("Parameter huntComment is required and cannot be null.")); + } else { + huntComment.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntCommentId, huntComment, + accept, context); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param huntComment The hunt comment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Comment in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, HuntCommentInner huntComment) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, huntId, huntCommentId, huntComment) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param huntComment The hunt comment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Comment in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String huntId, String huntCommentId, HuntCommentInner huntComment, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, huntId, huntCommentId, huntComment, + context).block(); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param huntComment The hunt comment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Comment in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HuntCommentInner createOrUpdate(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, HuntCommentInner huntComment) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, huntComment, + Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all hunt comments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all hunt comments along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentsImpl.java new file mode 100644 index 000000000000..e40c62126cf7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntCommentsImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.HuntCommentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntCommentInner; +import com.azure.resourcemanager.securityinsights.models.HuntComment; +import com.azure.resourcemanager.securityinsights.models.HuntComments; + +public final class HuntCommentsImpl implements HuntComments { + private static final ClientLogger LOGGER = new ClientLogger(HuntCommentsImpl.class); + + private final HuntCommentsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public HuntCommentsImpl(HuntCommentsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, huntId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HuntCommentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId, String filter, + String orderby, Integer top, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HuntCommentImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HuntCommentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HuntComment get(String resourceGroupName, String workspaceName, String huntId, String huntCommentId) { + HuntCommentInner inner = this.serviceClient().get(resourceGroupName, workspaceName, huntId, huntCommentId); + if (inner != null) { + return new HuntCommentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, context); + } + + public void delete(String resourceGroupName, String workspaceName, String huntId, String huntCommentId) { + this.serviceClient().delete(resourceGroupName, workspaceName, huntId, huntCommentId); + } + + public HuntComment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntCommentId = ResourceManagerUtils.getValueFromIdByName(id, "comments"); + if (huntCommentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'comments'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntCommentId = ResourceManagerUtils.getValueFromIdByName(id, "comments"); + if (huntCommentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'comments'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntCommentId = ResourceManagerUtils.getValueFromIdByName(id, "comments"); + if (huntCommentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'comments'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntCommentId = ResourceManagerUtils.getValueFromIdByName(id, "comments"); + if (huntCommentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'comments'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, huntId, huntCommentId, context); + } + + private HuntCommentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public HuntCommentImpl define(String name) { + return new HuntCommentImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntImpl.java new file mode 100644 index 000000000000..273cdc730f18 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntInner; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.Hunt; +import com.azure.resourcemanager.securityinsights.models.HuntOwner; +import com.azure.resourcemanager.securityinsights.models.HypothesisStatus; +import com.azure.resourcemanager.securityinsights.models.Status; +import java.util.Collections; +import java.util.List; + +public final class HuntImpl implements Hunt, Hunt.Definition, Hunt.Update { + private HuntInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public Status status() { + return this.innerModel().status(); + } + + public HypothesisStatus hypothesisStatus() { + return this.innerModel().hypothesisStatus(); + } + + public List attackTactics() { + List inner = this.innerModel().attackTactics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List attackTechniques() { + List inner = this.innerModel().attackTechniques(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List labels() { + List inner = this.innerModel().labels(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public HuntOwner owner() { + return this.innerModel().owner(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public HuntInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String huntId; + + public HuntImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public Hunt create() { + this.innerObject = serviceManager.serviceClient() + .getHunts() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Hunt create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHunts() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, this.innerModel(), context) + .getValue(); + return this; + } + + HuntImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new HuntInner(); + this.serviceManager = serviceManager; + this.huntId = name; + } + + public HuntImpl update() { + return this; + } + + public Hunt apply() { + this.innerObject = serviceManager.serviceClient() + .getHunts() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Hunt apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHunts() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, this.innerModel(), context) + .getValue(); + return this; + } + + HuntImpl(HuntInner innerObject, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.huntId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "hunts"); + } + + public Hunt refresh() { + this.innerObject = serviceManager.serviceClient() + .getHunts() + .getWithResponse(resourceGroupName, workspaceName, huntId, Context.NONE) + .getValue(); + return this; + } + + public Hunt refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHunts() + .getWithResponse(resourceGroupName, workspaceName, huntId, context) + .getValue(); + return this; + } + + public HuntImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public HuntImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public HuntImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public HuntImpl withStatus(Status status) { + this.innerModel().withStatus(status); + return this; + } + + public HuntImpl withHypothesisStatus(HypothesisStatus hypothesisStatus) { + this.innerModel().withHypothesisStatus(hypothesisStatus); + return this; + } + + public HuntImpl withAttackTactics(List attackTactics) { + this.innerModel().withAttackTactics(attackTactics); + return this; + } + + public HuntImpl withAttackTechniques(List attackTechniques) { + this.innerModel().withAttackTechniques(attackTechniques); + return this; + } + + public HuntImpl withLabels(List labels) { + this.innerModel().withLabels(labels); + return this; + } + + public HuntImpl withOwner(HuntOwner owner) { + this.innerModel().withOwner(owner); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationImpl.java new file mode 100644 index 000000000000..a516b1002253 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntRelationInner; +import com.azure.resourcemanager.securityinsights.models.HuntRelation; +import java.util.Collections; +import java.util.List; + +public final class HuntRelationImpl implements HuntRelation, HuntRelation.Definition, HuntRelation.Update { + private HuntRelationInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String relatedResourceId() { + return this.innerModel().relatedResourceId(); + } + + public String relatedResourceName() { + return this.innerModel().relatedResourceName(); + } + + public String relationType() { + return this.innerModel().relationType(); + } + + public String relatedResourceKind() { + return this.innerModel().relatedResourceKind(); + } + + public List labels() { + List inner = this.innerModel().labels(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public HuntRelationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String huntId; + + private String huntRelationId; + + public HuntRelationImpl withExistingHunt(String resourceGroupName, String workspaceName, String huntId) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + this.huntId = huntId; + return this; + } + + public HuntRelation create() { + this.innerObject = serviceManager.serviceClient() + .getHuntRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public HuntRelation create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHuntRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, this.innerModel(), + context) + .getValue(); + return this; + } + + HuntRelationImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new HuntRelationInner(); + this.serviceManager = serviceManager; + this.huntRelationId = name; + } + + public HuntRelationImpl update() { + return this; + } + + public HuntRelation apply() { + this.innerObject = serviceManager.serviceClient() + .getHuntRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public HuntRelation apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHuntRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, this.innerModel(), + context) + .getValue(); + return this; + } + + HuntRelationImpl(HuntRelationInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.huntId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "hunts"); + this.huntRelationId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "relations"); + } + + public HuntRelation refresh() { + this.innerObject = serviceManager.serviceClient() + .getHuntRelations() + .getWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, Context.NONE) + .getValue(); + return this; + } + + public HuntRelation refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getHuntRelations() + .getWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, context) + .getValue(); + return this; + } + + public HuntRelationImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public HuntRelationImpl withRelatedResourceId(String relatedResourceId) { + this.innerModel().withRelatedResourceId(relatedResourceId); + return this; + } + + public HuntRelationImpl withLabels(List labels) { + this.innerModel().withLabels(labels); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationsClientImpl.java new file mode 100644 index 000000000000..8af8ad073fe1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationsClientImpl.java @@ -0,0 +1,824 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.HuntRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntRelationInner; +import com.azure.resourcemanager.securityinsights.models.HuntRelationList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in HuntRelationsClient. + */ +public final class HuntRelationsClientImpl implements HuntRelationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final HuntRelationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of HuntRelationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HuntRelationsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(HuntRelationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsHuntRelations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsHunt") + public interface HuntRelationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @QueryParam("$filter") String filter, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @PathParam("huntRelationId") String huntRelationId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @PathParam("huntRelationId") String huntRelationId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}/relations/{huntRelationId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @PathParam("huntRelationId") String huntRelationId, + @BodyParam("application/json") HuntRelationInner huntRelation, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String huntId, String filter, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, filter, orderby, top, + skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String huntId, String filter, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String huntId, + String filter, String orderby, Integer top, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String huntId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String huntId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, + skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken)); + } + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId, + String filter, String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken, context)); + } + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId, String huntRelationId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntRelationId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntRelationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId, String huntRelationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntRelationId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, huntRelationId, accept, context); + } + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId) { + return getWithResponseAsync(resourceGroupName, workspaceName, huntId, huntRelationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, huntId, huntRelationId, context).block(); + } + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HuntRelationInner get(String resourceGroupName, String workspaceName, String huntId, String huntRelationId) { + return getWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, Context.NONE).getValue(); + } + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntRelationId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntRelationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntRelationId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, huntRelationId, accept, context); + } + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, huntId, huntRelationId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, huntId, huntRelationId, context).block(); + } + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String huntId, String huntRelationId) { + deleteWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, Context.NONE); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param huntRelation The hunt relation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Relation in Azure Security Insights along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String huntId, String huntRelationId, HuntRelationInner huntRelation) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntRelationId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelationId is required and cannot be null.")); + } + if (huntRelation == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelation is required and cannot be null.")); + } else { + huntRelation.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntRelationId, huntRelation, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param huntRelation The hunt relation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Relation in Azure Security Insights along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String huntId, String huntRelationId, HuntRelationInner huntRelation, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (huntRelationId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelationId is required and cannot be null.")); + } + if (huntRelation == null) { + return Mono.error(new IllegalArgumentException("Parameter huntRelation is required and cannot be null.")); + } else { + huntRelation.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, huntRelationId, huntRelation, + accept, context); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param huntRelation The hunt relation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Relation in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, HuntRelationInner huntRelation) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, huntId, huntRelationId, huntRelation) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param huntRelation The hunt relation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Relation in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String huntId, String huntRelationId, HuntRelationInner huntRelation, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, huntId, huntRelationId, huntRelation, + context).block(); + } + + /** + * Creates or updates a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param huntRelation The hunt relation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt Relation in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HuntRelationInner createOrUpdate(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, HuntRelationInner huntRelation) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, huntRelation, + Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the hunt relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the hunt relations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationsImpl.java new file mode 100644 index 000000000000..98cab5b510c3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntRelationsImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.HuntRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntRelationInner; +import com.azure.resourcemanager.securityinsights.models.HuntRelation; +import com.azure.resourcemanager.securityinsights.models.HuntRelations; + +public final class HuntRelationsImpl implements HuntRelations { + private static final ClientLogger LOGGER = new ClientLogger(HuntRelationsImpl.class); + + private final HuntRelationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public HuntRelationsImpl(HuntRelationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, huntId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HuntRelationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String huntId, + String filter, String orderby, Integer top, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, huntId, filter, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HuntRelationImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HuntRelationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HuntRelation get(String resourceGroupName, String workspaceName, String huntId, String huntRelationId) { + HuntRelationInner inner = this.serviceClient().get(resourceGroupName, workspaceName, huntId, huntRelationId); + if (inner != null) { + return new HuntRelationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, context); + } + + public void delete(String resourceGroupName, String workspaceName, String huntId, String huntRelationId) { + this.serviceClient().delete(resourceGroupName, workspaceName, huntId, huntRelationId); + } + + public HuntRelation getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntRelationId = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (huntRelationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntRelationId = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (huntRelationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntRelationId = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (huntRelationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + String huntRelationId = ResourceManagerUtils.getValueFromIdByName(id, "relations"); + if (huntRelationId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, huntId, huntRelationId, context); + } + + private HuntRelationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public HuntRelationImpl define(String name) { + return new HuntRelationImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntsClientImpl.java new file mode 100644 index 000000000000..7ebb9d89122d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntsClientImpl.java @@ -0,0 +1,772 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.HuntsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntInner; +import com.azure.resourcemanager.securityinsights.models.HuntList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in HuntsClient. + */ +public final class HuntsClientImpl implements HuntsClient { + /** + * The proxy service used to perform REST calls. + */ + private final HuntsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of HuntsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HuntsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(HuntsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsHunts to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsHunt") + public interface HuntsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, @QueryParam("$orderby") String orderby, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/hunts/{huntId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("huntId") String huntId, @BodyParam("application/json") HuntInner hunt, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, filter, orderby, top, skipToken, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, filter, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken)); + } + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + Integer top, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, context)); + } + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, accept, context); + } + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String huntId) { + return getWithResponseAsync(resourceGroupName, workspaceName, huntId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, huntId, context).block(); + } + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HuntInner get(String resourceGroupName, String workspaceName, String huntId) { + return getWithResponse(resourceGroupName, workspaceName, huntId, Context.NONE).getValue(); + } + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, String huntId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, huntId, accept, context); + } + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String huntId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, huntId).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, huntId, context).block(); + } + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String huntId) { + deleteWithResponse(resourceGroupName, workspaceName, huntId, Context.NONE); + } + + /** + * Create or update a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param hunt The hunt. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt in Azure Security Insights along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId, HuntInner hunt) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (hunt == null) { + return Mono.error(new IllegalArgumentException("Parameter hunt is required and cannot be null.")); + } else { + hunt.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, hunt, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param hunt The hunt. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt in Azure Security Insights along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String workspaceName, + String huntId, HuntInner hunt, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (huntId == null) { + return Mono.error(new IllegalArgumentException("Parameter huntId is required and cannot be null.")); + } + if (hunt == null) { + return Mono.error(new IllegalArgumentException("Parameter hunt is required and cannot be null.")); + } else { + hunt.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, huntId, hunt, accept, context); + } + + /** + * Create or update a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param hunt The hunt. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String huntId, + HuntInner hunt) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, huntId, hunt) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param hunt The hunt. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, String huntId, + HuntInner hunt, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, huntId, hunt, context).block(); + } + + /** + * Create or update a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param hunt The hunt. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Hunt in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HuntInner createOrUpdate(String resourceGroupName, String workspaceName, String huntId, HuntInner hunt) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, huntId, hunt, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the hunts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the hunts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntsImpl.java new file mode 100644 index 000000000000..e5b931d19f31 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/HuntsImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.HuntsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntInner; +import com.azure.resourcemanager.securityinsights.models.Hunt; +import com.azure.resourcemanager.securityinsights.models.Hunts; + +public final class HuntsImpl implements Hunts { + private static final ClientLogger LOGGER = new ClientLogger(HuntsImpl.class); + + private final HuntsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public HuntsImpl(HuntsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HuntImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + Integer top, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, filter, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HuntImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, huntId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HuntImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Hunt get(String resourceGroupName, String workspaceName, String huntId) { + HuntInner inner = this.serviceClient().get(resourceGroupName, workspaceName, huntId); + if (inner != null) { + return new HuntImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, huntId, context); + } + + public void delete(String resourceGroupName, String workspaceName, String huntId) { + this.serviceClient().delete(resourceGroupName, workspaceName, huntId); + } + + public Hunt getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, huntId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, huntId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, huntId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String huntId = ResourceManagerUtils.getValueFromIdByName(id, "hunts"); + if (huntId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hunts'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, huntId, context); + } + + private HuntsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public HuntImpl define(String name) { + return new HuntImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentImpl.java index af654f974fbf..e20c119412a4 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentImpl.java @@ -36,6 +36,10 @@ public SystemData systemData() { return this.innerModel().systemData(); } + public String message() { + return this.innerModel().message(); + } + public OffsetDateTime createdTimeUtc() { return this.innerModel().createdTimeUtc(); } @@ -44,10 +48,6 @@ public OffsetDateTime lastModifiedTimeUtc() { return this.innerModel().lastModifiedTimeUtc(); } - public String message() { - return this.innerModel().message(); - } - public ClientInfo author() { return this.innerModel().author(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentsClientImpl.java index e3442d15b9f0..97c82da0283c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentsClientImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentCommentsClientImpl.java @@ -116,7 +116,7 @@ Mono> listNext(@PathParam(value = "nextLink", enco } /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -130,8 +130,7 @@ Mono> listNext(@PathParam(value = "nextLink", enco * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return all incident comments along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(String resourceGroupName, @@ -165,7 +164,7 @@ private Mono> listSinglePageAsync(String res } /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -180,8 +179,7 @@ private Mono> listSinglePageAsync(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return all incident comments along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(String resourceGroupName, @@ -215,7 +213,7 @@ private Mono> listSinglePageAsync(String res } /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -229,7 +227,7 @@ private Mono> listSinglePageAsync(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedFlux}. + * @return all incident comments as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String workspaceName, String incidentId, @@ -240,7 +238,7 @@ private PagedFlux listAsync(String resourceGroupName, Stri } /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -248,7 +246,7 @@ private PagedFlux listAsync(String resourceGroupName, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedFlux}. + * @return all incident comments as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String workspaceName, @@ -263,7 +261,7 @@ private PagedFlux listAsync(String resourceGroupName, Stri } /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -278,7 +276,7 @@ private PagedFlux listAsync(String resourceGroupName, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedFlux}. + * @return all incident comments as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String workspaceName, String incidentId, @@ -288,7 +286,7 @@ private PagedFlux listAsync(String resourceGroupName, Stri } /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -296,7 +294,7 @@ private PagedFlux listAsync(String resourceGroupName, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedIterable}. + * @return all incident comments as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId) { @@ -309,7 +307,7 @@ public PagedIterable list(String resourceGroupName, String } /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -324,7 +322,7 @@ public PagedIterable list(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedIterable}. + * @return all incident comments as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, @@ -334,7 +332,7 @@ public PagedIterable list(String resourceGroupName, String } /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -343,7 +341,7 @@ public PagedIterable list(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident along with {@link Response} on successful completion of {@link Mono}. + * @return an incident comment along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -379,7 +377,7 @@ private Mono> getWithResponseAsync(String resourc } /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -389,7 +387,7 @@ private Mono> getWithResponseAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident along with {@link Response} on successful completion of {@link Mono}. + * @return an incident comment along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -423,7 +421,7 @@ private Mono> getWithResponseAsync(String resourc } /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -432,7 +430,7 @@ private Mono> getWithResponseAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident on successful completion of {@link Mono}. + * @return an incident comment on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String workspaceName, String incidentId, @@ -442,7 +440,7 @@ private Mono getAsync(String resourceGroupName, String wor } /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -452,7 +450,7 @@ private Mono getAsync(String resourceGroupName, String wor * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident along with {@link Response}. + * @return an incident comment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String workspaceName, @@ -461,7 +459,7 @@ public Response getWithResponse(String resourceGroupName, } /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -470,7 +468,7 @@ public Response getWithResponse(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident. + * @return an incident comment. */ @ServiceMethod(returns = ReturnType.SINGLE) public IncidentCommentInner get(String resourceGroupName, String workspaceName, String incidentId, @@ -480,7 +478,7 @@ public IncidentCommentInner get(String resourceGroupName, String workspaceName, } /** - * Creates or updates a comment for a given incident. + * Creates or updates the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -532,7 +530,7 @@ private Mono> createOrUpdateWithResponseAsync(Str } /** - * Creates or updates a comment for a given incident. + * Creates or updates the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -585,7 +583,7 @@ private Mono> createOrUpdateWithResponseAsync(Str } /** - * Creates or updates a comment for a given incident. + * Creates or updates the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -605,7 +603,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, } /** - * Creates or updates a comment for a given incident. + * Creates or updates the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -626,7 +624,7 @@ public Response createOrUpdateWithResponse(String resource } /** - * Creates or updates a comment for a given incident. + * Creates or updates the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -646,7 +644,7 @@ public IncidentCommentInner createOrUpdate(String resourceGroupName, String work } /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -691,7 +689,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -735,7 +733,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -754,7 +752,7 @@ private Mono deleteAsync(String resourceGroupName, String workspaceName, S } /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -774,7 +772,7 @@ public Response deleteWithResponse(String resourceGroupName, String worksp } /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -796,7 +794,7 @@ public void delete(String resourceGroupName, String workspaceName, String incide * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of incident comments along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -822,7 +820,7 @@ private Mono> listNextSinglePageAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of incident comments along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentEntitiesResponseImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentEntitiesResponseImpl.java index 73760db49b7a..5d5a5679cacd 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentEntitiesResponseImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentEntitiesResponseImpl.java @@ -4,12 +4,14 @@ package com.azure.resourcemanager.securityinsights.implementation; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.IncidentEntitiesResponseInner; import com.azure.resourcemanager.securityinsights.models.Entity; import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResponse; import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResultsMetadata; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; public final class IncidentEntitiesResponseImpl implements IncidentEntitiesResponse { private IncidentEntitiesResponseInner innerObject; @@ -23,9 +25,10 @@ public final class IncidentEntitiesResponseImpl implements IncidentEntitiesRespo } public List entities() { - List inner = this.innerModel().entities(); + List inner = this.innerModel().entities(); if (inner != null) { - return Collections.unmodifiableList(inner); + return Collections.unmodifiableList( + inner.stream().map(inner1 -> new EntityImpl(inner1, this.manager())).collect(Collectors.toList())); } else { return Collections.emptyList(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentImpl.java index 471fb1e3d100..23aae8701615 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentImpl.java @@ -19,6 +19,7 @@ import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; import com.azure.resourcemanager.securityinsights.models.IncidentStatus; +import com.azure.resourcemanager.securityinsights.models.TeamInformation; import java.time.OffsetDateTime; import java.util.Collections; import java.util.List; @@ -48,40 +49,36 @@ public SystemData systemData() { return this.innerModel().systemData(); } - public IncidentAdditionalData additionalData() { - return this.innerModel().additionalData(); - } - - public IncidentClassification classification() { - return this.innerModel().classification(); + public String title() { + return this.innerModel().title(); } - public String classificationComment() { - return this.innerModel().classificationComment(); + public String description() { + return this.innerModel().description(); } - public IncidentClassificationReason classificationReason() { - return this.innerModel().classificationReason(); + public IncidentSeverity severity() { + return this.innerModel().severity(); } - public OffsetDateTime createdTimeUtc() { - return this.innerModel().createdTimeUtc(); + public IncidentStatus status() { + return this.innerModel().status(); } - public String description() { - return this.innerModel().description(); + public IncidentClassification classification() { + return this.innerModel().classification(); } - public OffsetDateTime firstActivityTimeUtc() { - return this.innerModel().firstActivityTimeUtc(); + public IncidentClassificationReason classificationReason() { + return this.innerModel().classificationReason(); } - public String incidentUrl() { - return this.innerModel().incidentUrl(); + public String classificationComment() { + return this.innerModel().classificationComment(); } - public Integer incidentNumber() { - return this.innerModel().incidentNumber(); + public IncidentOwnerInfo owner() { + return this.innerModel().owner(); } public List labels() { @@ -93,6 +90,10 @@ public List labels() { } } + public OffsetDateTime firstActivityTimeUtc() { + return this.innerModel().firstActivityTimeUtc(); + } + public OffsetDateTime lastActivityTimeUtc() { return this.innerModel().lastActivityTimeUtc(); } @@ -101,8 +102,16 @@ public OffsetDateTime lastModifiedTimeUtc() { return this.innerModel().lastModifiedTimeUtc(); } - public IncidentOwnerInfo owner() { - return this.innerModel().owner(); + public OffsetDateTime createdTimeUtc() { + return this.innerModel().createdTimeUtc(); + } + + public Integer incidentNumber() { + return this.innerModel().incidentNumber(); + } + + public IncidentAdditionalData additionalData() { + return this.innerModel().additionalData(); } public List relatedAnalyticRuleIds() { @@ -114,16 +123,20 @@ public List relatedAnalyticRuleIds() { } } - public IncidentSeverity severity() { - return this.innerModel().severity(); + public String incidentUrl() { + return this.innerModel().incidentUrl(); } - public IncidentStatus status() { - return this.innerModel().status(); + public String providerName() { + return this.innerModel().providerName(); } - public String title() { - return this.innerModel().title(); + public String providerIncidentId() { + return this.innerModel().providerIncidentId(); + } + + public TeamInformation teamInformation() { + return this.innerModel().teamInformation(); } public String resourceGroupName() { @@ -248,38 +261,38 @@ public IncidentImpl withEtag(String etag) { return this; } - public IncidentImpl withClassification(IncidentClassification classification) { - this.innerModel().withClassification(classification); + public IncidentImpl withTitle(String title) { + this.innerModel().withTitle(title); return this; } - public IncidentImpl withClassificationComment(String classificationComment) { - this.innerModel().withClassificationComment(classificationComment); + public IncidentImpl withDescription(String description) { + this.innerModel().withDescription(description); return this; } - public IncidentImpl withClassificationReason(IncidentClassificationReason classificationReason) { - this.innerModel().withClassificationReason(classificationReason); + public IncidentImpl withSeverity(IncidentSeverity severity) { + this.innerModel().withSeverity(severity); return this; } - public IncidentImpl withDescription(String description) { - this.innerModel().withDescription(description); + public IncidentImpl withStatus(IncidentStatus status) { + this.innerModel().withStatus(status); return this; } - public IncidentImpl withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) { - this.innerModel().withFirstActivityTimeUtc(firstActivityTimeUtc); + public IncidentImpl withClassification(IncidentClassification classification) { + this.innerModel().withClassification(classification); return this; } - public IncidentImpl withLabels(List labels) { - this.innerModel().withLabels(labels); + public IncidentImpl withClassificationReason(IncidentClassificationReason classificationReason) { + this.innerModel().withClassificationReason(classificationReason); return this; } - public IncidentImpl withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc) { - this.innerModel().withLastActivityTimeUtc(lastActivityTimeUtc); + public IncidentImpl withClassificationComment(String classificationComment) { + this.innerModel().withClassificationComment(classificationComment); return this; } @@ -288,18 +301,23 @@ public IncidentImpl withOwner(IncidentOwnerInfo owner) { return this; } - public IncidentImpl withSeverity(IncidentSeverity severity) { - this.innerModel().withSeverity(severity); + public IncidentImpl withLabels(List labels) { + this.innerModel().withLabels(labels); return this; } - public IncidentImpl withStatus(IncidentStatus status) { - this.innerModel().withStatus(status); + public IncidentImpl withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) { + this.innerModel().withFirstActivityTimeUtc(firstActivityTimeUtc); return this; } - public IncidentImpl withTitle(String title) { - this.innerModel().withTitle(title); + public IncidentImpl withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc) { + this.innerModel().withLastActivityTimeUtc(lastActivityTimeUtc); + return this; + } + + public IncidentImpl withTeamInformation(TeamInformation teamInformation) { + this.innerModel().withTeamInformation(teamInformation); return this; } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsClientImpl.java index eb6d0ddbea79..320f404c8593 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsClientImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsClientImpl.java @@ -116,7 +116,7 @@ Mono> listNext(@PathParam(value = "nextLink", encoded = t } /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -130,8 +130,7 @@ Mono> listNext(@PathParam(value = "nextLink", encoded = t * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return all incident relations along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, @@ -165,7 +164,7 @@ private Mono> listSinglePageAsync(String resourceGr } /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -180,8 +179,7 @@ private Mono> listSinglePageAsync(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return all incident relations along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, @@ -214,7 +212,7 @@ private Mono> listSinglePageAsync(String resourceGr } /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -228,7 +226,7 @@ private Mono> listSinglePageAsync(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedFlux}. + * @return all incident relations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String workspaceName, String incidentId, @@ -239,7 +237,7 @@ private PagedFlux listAsync(String resourceGroupName, String work } /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -247,7 +245,7 @@ private PagedFlux listAsync(String resourceGroupName, String work * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedFlux}. + * @return all incident relations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String workspaceName, String incidentId) { @@ -261,7 +259,7 @@ private PagedFlux listAsync(String resourceGroupName, String work } /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -276,7 +274,7 @@ private PagedFlux listAsync(String resourceGroupName, String work * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedFlux}. + * @return all incident relations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String workspaceName, String incidentId, @@ -286,7 +284,7 @@ private PagedFlux listAsync(String resourceGroupName, String work } /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -294,7 +292,7 @@ private PagedFlux listAsync(String resourceGroupName, String work * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedIterable}. + * @return all incident relations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId) { @@ -307,7 +305,7 @@ public PagedIterable list(String resourceGroupName, String worksp } /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -322,7 +320,7 @@ public PagedIterable list(String resourceGroupName, String worksp * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedIterable}. + * @return all incident relations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, @@ -332,7 +330,7 @@ public PagedIterable list(String resourceGroupName, String worksp } /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -341,7 +339,7 @@ public PagedIterable list(String resourceGroupName, String worksp * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident along with {@link Response} on successful completion of {@link Mono}. + * @return an incident relation along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -376,7 +374,7 @@ private Mono> getWithResponseAsync(String resourceGroupN } /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -386,7 +384,7 @@ private Mono> getWithResponseAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident along with {@link Response} on successful completion of {@link Mono}. + * @return an incident relation along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -419,7 +417,7 @@ private Mono> getWithResponseAsync(String resourceGroupN } /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -428,7 +426,7 @@ private Mono> getWithResponseAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident on successful completion of {@link Mono}. + * @return an incident relation on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String workspaceName, String incidentId, @@ -438,7 +436,7 @@ private Mono getAsync(String resourceGroupName, String workspaceN } /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -448,7 +446,7 @@ private Mono getAsync(String resourceGroupName, String workspaceN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident along with {@link Response}. + * @return an incident relation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, @@ -457,7 +455,7 @@ public Response getWithResponse(String resourceGroupName, String } /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -466,7 +464,7 @@ public Response getWithResponse(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident. + * @return an incident relation. */ @ServiceMethod(returns = ReturnType.SINGLE) public RelationInner get(String resourceGroupName, String workspaceName, String incidentId, String relationName) { @@ -474,7 +472,7 @@ public RelationInner get(String resourceGroupName, String workspaceName, String } /** - * Creates or updates a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -525,7 +523,7 @@ private Mono> createOrUpdateWithResponseAsync(String res } /** - * Creates or updates a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -576,7 +574,7 @@ private Mono> createOrUpdateWithResponseAsync(String res } /** - * Creates or updates a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -596,7 +594,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, String } /** - * Creates or updates a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -617,7 +615,7 @@ public Response createOrUpdateWithResponse(String resourceGroupNa } /** - * Creates or updates a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -637,7 +635,7 @@ public RelationInner createOrUpdate(String resourceGroupName, String workspaceNa } /** - * Deletes a relation for a given incident. + * Delete the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -681,7 +679,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } /** - * Deletes a relation for a given incident. + * Delete the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -724,7 +722,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } /** - * Deletes a relation for a given incident. + * Delete the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -743,7 +741,7 @@ private Mono deleteAsync(String resourceGroupName, String workspaceName, S } /** - * Deletes a relation for a given incident. + * Delete the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -762,7 +760,7 @@ public Response deleteWithResponse(String resourceGroupName, String worksp } /** - * Deletes a relation for a given incident. + * Delete the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsImpl.java index 8421e8e535be..3958a775cf78 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentRelationsImpl.java @@ -60,111 +60,37 @@ public Relation get(String resourceGroupName, String workspaceName, String incid } } - public Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, - String relationName, Context context) { - return this.serviceClient() - .deleteWithResponse(resourceGroupName, workspaceName, incidentId, relationName, context); - } - - public void delete(String resourceGroupName, String workspaceName, String incidentId, String relationName) { - this.serviceClient().delete(resourceGroupName, workspaceName, incidentId, relationName); - } - - public Relation getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); - if (workspaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); - } - String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); - if (incidentId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); - } - String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); - if (relationName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String incidentId, String relationName, RelationInner relation, Context context) { + Response inner = this.serviceClient() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, relationName, relation, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RelationImpl(inner.getValue(), this.manager())); + } else { + return null; } - return this.getWithResponse(resourceGroupName, workspaceName, incidentId, relationName, Context.NONE) - .getValue(); } - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); - if (workspaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); - } - String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); - if (incidentId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); - } - String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); - if (relationName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); + public Relation createOrUpdate(String resourceGroupName, String workspaceName, String incidentId, + String relationName, RelationInner relation) { + RelationInner inner + = this.serviceClient().createOrUpdate(resourceGroupName, workspaceName, incidentId, relationName, relation); + if (inner != null) { + return new RelationImpl(inner, this.manager()); + } else { + return null; } - return this.getWithResponse(resourceGroupName, workspaceName, incidentId, relationName, context); } - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); - if (workspaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); - } - String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); - if (incidentId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); - } - String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); - if (relationName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); - } - this.deleteWithResponse(resourceGroupName, workspaceName, incidentId, relationName, Context.NONE); + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String relationName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, incidentId, relationName, context); } - public Response deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); - if (workspaceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); - } - String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); - if (incidentId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); - } - String relationName = ResourceManagerUtils.getValueFromIdByName(id, "relations"); - if (relationName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'relations'.", id))); - } - return this.deleteWithResponse(resourceGroupName, workspaceName, incidentId, relationName, context); + public void delete(String resourceGroupName, String workspaceName, String incidentId, String relationName) { + this.serviceClient().delete(resourceGroupName, workspaceName, incidentId, relationName); } private IncidentRelationsClient serviceClient() { @@ -174,8 +100,4 @@ private IncidentRelationsClient serviceClient() { private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { return this.serviceManager; } - - public RelationImpl define(String name) { - return new RelationImpl(name, this.manager()); - } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTaskImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTaskImpl.java new file mode 100644 index 000000000000..13d3eeb5ea51 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTaskImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.IncidentTaskInner; +import com.azure.resourcemanager.securityinsights.models.ClientInfo; +import com.azure.resourcemanager.securityinsights.models.IncidentTask; +import com.azure.resourcemanager.securityinsights.models.IncidentTaskStatus; +import java.time.OffsetDateTime; + +public final class IncidentTaskImpl implements IncidentTask, IncidentTask.Definition, IncidentTask.Update { + private IncidentTaskInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + public IncidentTaskStatus status() { + return this.innerModel().status(); + } + + public OffsetDateTime createdTimeUtc() { + return this.innerModel().createdTimeUtc(); + } + + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerModel().lastModifiedTimeUtc(); + } + + public ClientInfo createdBy() { + return this.innerModel().createdBy(); + } + + public ClientInfo lastModifiedBy() { + return this.innerModel().lastModifiedBy(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public IncidentTaskInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String incidentId; + + private String incidentTaskId; + + public IncidentTaskImpl withExistingIncident(String resourceGroupName, String workspaceName, String incidentId) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + this.incidentId = incidentId; + return this; + } + + public IncidentTask create() { + this.innerObject = serviceManager.serviceClient() + .getIncidentTasks() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public IncidentTask create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getIncidentTasks() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, this.innerModel(), + context) + .getValue(); + return this; + } + + IncidentTaskImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new IncidentTaskInner(); + this.serviceManager = serviceManager; + this.incidentTaskId = name; + } + + public IncidentTaskImpl update() { + return this; + } + + public IncidentTask apply() { + this.innerObject = serviceManager.serviceClient() + .getIncidentTasks() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public IncidentTask apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getIncidentTasks() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, this.innerModel(), + context) + .getValue(); + return this; + } + + IncidentTaskImpl(IncidentTaskInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.incidentId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "incidents"); + this.incidentTaskId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "tasks"); + } + + public IncidentTask refresh() { + this.innerObject = serviceManager.serviceClient() + .getIncidentTasks() + .getWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, Context.NONE) + .getValue(); + return this; + } + + public IncidentTask refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getIncidentTasks() + .getWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, context) + .getValue(); + return this; + } + + public IncidentTaskImpl withTitle(String title) { + this.innerModel().withTitle(title); + return this; + } + + public IncidentTaskImpl withStatus(IncidentTaskStatus status) { + this.innerModel().withStatus(status); + return this; + } + + public IncidentTaskImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public IncidentTaskImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public IncidentTaskImpl withCreatedBy(ClientInfo createdBy) { + this.innerModel().withCreatedBy(createdBy); + return this; + } + + public IncidentTaskImpl withLastModifiedBy(ClientInfo lastModifiedBy) { + this.innerModel().withLastModifiedBy(lastModifiedBy); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTasksClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTasksClientImpl.java new file mode 100644 index 000000000000..0280c2407cec --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTasksClientImpl.java @@ -0,0 +1,765 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.IncidentTasksClient; +import com.azure.resourcemanager.securityinsights.fluent.models.IncidentTaskInner; +import com.azure.resourcemanager.securityinsights.models.IncidentTaskList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IncidentTasksClient. + */ +public final class IncidentTasksClientImpl implements IncidentTasksClient { + /** + * The proxy service used to perform REST calls. + */ + private final IncidentTasksService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of IncidentTasksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IncidentTasksClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(IncidentTasksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsIncidentTasks to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsInci") + public interface IncidentTasksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("incidentId") String incidentId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/tasks/{incidentTaskId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("incidentId") String incidentId, @PathParam("incidentTaskId") String incidentTaskId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/tasks/{incidentTaskId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("incidentId") String incidentId, @PathParam("incidentTaskId") String incidentTaskId, + @BodyParam("application/json") IncidentTaskInner incidentTask, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/tasks/{incidentTaskId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("incidentId") String incidentId, @PathParam("incidentTaskId") String incidentTaskId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String incidentId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, incidentId, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String incidentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, incidentId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String incidentId) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, incidentId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String incidentId, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, incidentId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, incidentId)); + } + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, incidentId, context)); + } + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + if (incidentTaskId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTaskId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, incidentId, incidentTaskId, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + if (incidentTaskId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTaskId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, incidentId, incidentTaskId, accept, context); + } + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId) { + return getWithResponseAsync(resourceGroupName, workspaceName, incidentId, incidentTaskId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, incidentId, incidentTaskId, context).block(); + } + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IncidentTaskInner get(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId) { + return getWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, Context.NONE).getValue(); + } + + /** + * Creates or updates the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param incidentTask The incident task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String incidentId, String incidentTaskId, IncidentTaskInner incidentTask) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + if (incidentTaskId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTaskId is required and cannot be null.")); + } + if (incidentTask == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTask is required and cannot be null.")); + } else { + incidentTask.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, incidentId, incidentTaskId, + incidentTask, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param incidentTask The incident task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String incidentId, String incidentTaskId, IncidentTaskInner incidentTask, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + if (incidentTaskId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTaskId is required and cannot be null.")); + } + if (incidentTask == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTask is required and cannot be null.")); + } else { + incidentTask.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, incidentId, incidentTaskId, incidentTask, + accept, context); + } + + /** + * Creates or updates the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param incidentTask The incident task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId, IncidentTaskInner incidentTask) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, incidentId, incidentTaskId, + incidentTask).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param incidentTask The incident task. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId, IncidentTaskInner incidentTask, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, incidentId, incidentTaskId, + incidentTask, context).block(); + } + + /** + * Creates or updates the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param incidentTask The incident task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IncidentTaskInner createOrUpdate(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, IncidentTaskInner incidentTask) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, incidentTask, + Context.NONE).getValue(); + } + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + if (incidentTaskId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTaskId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, incidentId, incidentTaskId, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String incidentId, String incidentTaskId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentId is required and cannot be null.")); + } + if (incidentTaskId == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentTaskId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, incidentId, incidentTaskId, accept, context); + } + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, incidentId, incidentTaskId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, incidentId, incidentTaskId, context).block(); + } + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String incidentId, String incidentTaskId) { + deleteWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTasksImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTasksImpl.java new file mode 100644 index 000000000000..aae16b461221 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentTasksImpl.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.IncidentTasksClient; +import com.azure.resourcemanager.securityinsights.fluent.models.IncidentTaskInner; +import com.azure.resourcemanager.securityinsights.models.IncidentTask; +import com.azure.resourcemanager.securityinsights.models.IncidentTasks; + +public final class IncidentTasksImpl implements IncidentTasks { + private static final ClientLogger LOGGER = new ClientLogger(IncidentTasksImpl.class); + + private final IncidentTasksClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public IncidentTasksImpl(IncidentTasksClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, incidentId); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IncidentTaskImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, incidentId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IncidentTaskImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new IncidentTaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IncidentTask get(String resourceGroupName, String workspaceName, String incidentId, String incidentTaskId) { + IncidentTaskInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, incidentId, incidentTaskId); + if (inner != null) { + return new IncidentTaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, context); + } + + public void delete(String resourceGroupName, String workspaceName, String incidentId, String incidentTaskId) { + this.serviceClient().delete(resourceGroupName, workspaceName, incidentId, incidentTaskId); + } + + public IncidentTask getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); + if (incidentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); + } + String incidentTaskId = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (incidentTaskId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); + if (incidentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); + } + String incidentTaskId = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (incidentTaskId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); + if (incidentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); + } + String incidentTaskId = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (incidentTaskId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String incidentId = ResourceManagerUtils.getValueFromIdByName(id, "incidents"); + if (incidentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'incidents'.", id))); + } + String incidentTaskId = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (incidentTaskId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, incidentId, incidentTaskId, context); + } + + private IncidentTasksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public IncidentTaskImpl define(String name) { + return new IncidentTaskImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsClientImpl.java index 9f723572a798..7cb380cae1a5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsClientImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsClientImpl.java @@ -35,6 +35,7 @@ import com.azure.resourcemanager.securityinsights.fluent.models.IncidentEntitiesResponseInner; import com.azure.resourcemanager.securityinsights.fluent.models.IncidentInner; import com.azure.resourcemanager.securityinsights.models.IncidentList; +import com.azure.resourcemanager.securityinsights.models.ManualTriggerRequestBody; import reactor.core.publisher.Mono; /** @@ -69,6 +70,17 @@ public final class IncidentsClientImpl implements IncidentsClient { @Host("{$host}") @ServiceInterface(name = "SecurityInsightsInci") public interface IncidentsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> runPlaybook(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("incidentIdentifier") String incidentIdentifier, + @BodyParam("application/json") ManualTriggerRequestBody requestBody, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents") @ExpectedResponses({ 200 }) @@ -143,6 +155,152 @@ Mono> listNext(@PathParam(value = "nextLink", encoded = t @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @param requestBody The requestBody parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runPlaybookWithResponseAsync(String resourceGroupName, String workspaceName, + String incidentIdentifier, ManualTriggerRequestBody requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter incidentIdentifier is required and cannot be null.")); + } + if (requestBody != null) { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.runPlaybook(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, incidentIdentifier, requestBody, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @param requestBody The requestBody parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runPlaybookWithResponseAsync(String resourceGroupName, String workspaceName, + String incidentIdentifier, ManualTriggerRequestBody requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (incidentIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter incidentIdentifier is required and cannot be null.")); + } + if (requestBody != null) { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.runPlaybook(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, incidentIdentifier, requestBody, accept, + context); + } + + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runPlaybookAsync(String resourceGroupName, String workspaceName, String incidentIdentifier) { + final ManualTriggerRequestBody requestBody = null; + return runPlaybookWithResponseAsync(resourceGroupName, workspaceName, incidentIdentifier, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @param requestBody The requestBody parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, + String incidentIdentifier, ManualTriggerRequestBody requestBody, Context context) { + return runPlaybookWithResponseAsync(resourceGroupName, workspaceName, incidentIdentifier, requestBody, context) + .block(); + } + + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object runPlaybook(String resourceGroupName, String workspaceName, String incidentIdentifier) { + final ManualTriggerRequestBody requestBody = null; + return runPlaybookWithResponse(resourceGroupName, workspaceName, incidentIdentifier, requestBody, Context.NONE) + .getValue(); + } + /** * Gets all incidents. * @@ -345,7 +503,7 @@ public PagedIterable list(String resourceGroupName, String worksp } /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -353,7 +511,7 @@ public PagedIterable list(String resourceGroupName, String worksp * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident along with {@link Response} on successful completion of {@link Mono}. + * @return an incident along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -384,7 +542,7 @@ private Mono> getWithResponseAsync(String resourceGroupN } /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -393,7 +551,7 @@ private Mono> getWithResponseAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident along with {@link Response} on successful completion of {@link Mono}. + * @return an incident along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -423,7 +581,7 @@ private Mono> getWithResponseAsync(String resourceGroupN } /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -431,7 +589,7 @@ private Mono> getWithResponseAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident on successful completion of {@link Mono}. + * @return an incident on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String workspaceName, String incidentId) { @@ -440,7 +598,7 @@ private Mono getAsync(String resourceGroupName, String workspaceN } /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -449,7 +607,7 @@ private Mono getAsync(String resourceGroupName, String workspaceN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident along with {@link Response}. + * @return an incident along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, @@ -458,7 +616,7 @@ public Response getWithResponse(String resourceGroupName, String } /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -466,7 +624,7 @@ public Response getWithResponse(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident. + * @return an incident. */ @ServiceMethod(returns = ReturnType.SINGLE) public IncidentInner get(String resourceGroupName, String workspaceName, String incidentId) { @@ -474,7 +632,7 @@ public IncidentInner get(String resourceGroupName, String workspaceName, String } /** - * Creates or updates an incident. + * Creates or updates the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -483,8 +641,7 @@ public IncidentInner get(String resourceGroupName, String workspaceName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents an incident in Azure Security Insights along with {@link Response} on successful completion of - * {@link Mono}. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, @@ -521,7 +678,7 @@ private Mono> createOrUpdateWithResponseAsync(String res } /** - * Creates or updates an incident. + * Creates or updates the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -531,8 +688,7 @@ private Mono> createOrUpdateWithResponseAsync(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents an incident in Azure Security Insights along with {@link Response} on successful completion of - * {@link Mono}. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, @@ -567,7 +723,7 @@ private Mono> createOrUpdateWithResponseAsync(String res } /** - * Creates or updates an incident. + * Creates or updates the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -576,7 +732,7 @@ private Mono> createOrUpdateWithResponseAsync(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents an incident in Azure Security Insights on successful completion of {@link Mono}. + * @return the response body on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String incidentId, @@ -586,7 +742,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, String } /** - * Creates or updates an incident. + * Creates or updates the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -596,7 +752,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents an incident in Azure Security Insights along with {@link Response}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, @@ -605,7 +761,7 @@ public Response createOrUpdateWithResponse(String resourceGroupNa } /** - * Creates or updates an incident. + * Creates or updates the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -614,7 +770,7 @@ public Response createOrUpdateWithResponse(String resourceGroupNa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents an incident in Azure Security Insights. + * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) public IncidentInner createOrUpdate(String resourceGroupName, String workspaceName, String incidentId, @@ -624,7 +780,7 @@ public IncidentInner createOrUpdate(String resourceGroupName, String workspaceNa } /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -663,7 +819,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -702,7 +858,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -718,7 +874,7 @@ private Mono deleteAsync(String resourceGroupName, String workspaceName, S } /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -736,7 +892,7 @@ public Response deleteWithResponse(String resourceGroupName, String worksp } /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -751,7 +907,7 @@ public void delete(String resourceGroupName, String workspaceName, String incide } /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -759,7 +915,7 @@ public void delete(String resourceGroupName, String workspaceName, String incide * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident along with {@link Response} on successful completion of {@link Mono}. + * @return all incident alerts along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listAlertsWithResponseAsync(String resourceGroupName, @@ -790,7 +946,7 @@ private Mono> listAlertsWithResponseAsync(Strin } /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -799,7 +955,7 @@ private Mono> listAlertsWithResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident along with {@link Response} on successful completion of {@link Mono}. + * @return all incident alerts along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listAlertsWithResponseAsync(String resourceGroupName, @@ -829,7 +985,7 @@ private Mono> listAlertsWithResponseAsync(Strin } /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -837,7 +993,7 @@ private Mono> listAlertsWithResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident on successful completion of {@link Mono}. + * @return all incident alerts on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono listAlertsAsync(String resourceGroupName, String workspaceName, @@ -847,7 +1003,7 @@ private Mono listAlertsAsync(String resourceGroupName, S } /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -856,7 +1012,7 @@ private Mono listAlertsAsync(String resourceGroupName, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident along with {@link Response}. + * @return all incident alerts along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response listAlertsWithResponse(String resourceGroupName, String workspaceName, @@ -865,7 +1021,7 @@ public Response listAlertsWithResponse(String resourceGr } /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -873,7 +1029,7 @@ public Response listAlertsWithResponse(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident. + * @return all incident alerts. */ @ServiceMethod(returns = ReturnType.SINGLE) public IncidentAlertListInner listAlerts(String resourceGroupName, String workspaceName, String incidentId) { @@ -881,7 +1037,7 @@ public IncidentAlertListInner listAlerts(String resourceGroupName, String worksp } /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -889,7 +1045,7 @@ public IncidentAlertListInner listAlerts(String resourceGroupName, String worksp * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident along with {@link Response} on successful completion of {@link Mono}. + * @return all incident bookmarks along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBookmarksWithResponseAsync(String resourceGroupName, @@ -920,7 +1076,7 @@ private Mono> listBookmarksWithResponseAsync } /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -929,7 +1085,7 @@ private Mono> listBookmarksWithResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident along with {@link Response} on successful completion of {@link Mono}. + * @return all incident bookmarks along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBookmarksWithResponseAsync(String resourceGroupName, @@ -959,7 +1115,7 @@ private Mono> listBookmarksWithResponseAsync } /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -967,7 +1123,7 @@ private Mono> listBookmarksWithResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident on successful completion of {@link Mono}. + * @return all incident bookmarks on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono listBookmarksAsync(String resourceGroupName, String workspaceName, @@ -977,7 +1133,7 @@ private Mono listBookmarksAsync(String resourceGroupN } /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -986,7 +1142,7 @@ private Mono listBookmarksAsync(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident along with {@link Response}. + * @return all incident bookmarks along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response listBookmarksWithResponse(String resourceGroupName, String workspaceName, @@ -995,7 +1151,7 @@ public Response listBookmarksWithResponse(String reso } /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -1003,7 +1159,7 @@ public Response listBookmarksWithResponse(String reso * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident. + * @return all incident bookmarks. */ @ServiceMethod(returns = ReturnType.SINGLE) public IncidentBookmarkListInner listBookmarks(String resourceGroupName, String workspaceName, String incidentId) { @@ -1011,7 +1167,7 @@ public IncidentBookmarkListInner listBookmarks(String resourceGroupName, String } /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -1019,7 +1175,7 @@ public IncidentBookmarkListInner listBookmarks(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident along with {@link Response} on successful completion of {@link Mono}. + * @return all incident related entities along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listEntitiesWithResponseAsync(String resourceGroupName, @@ -1050,7 +1206,7 @@ private Mono> listEntitiesWithResponseAs } /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -1059,7 +1215,7 @@ private Mono> listEntitiesWithResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident along with {@link Response} on successful completion of {@link Mono}. + * @return all incident related entities along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listEntitiesWithResponseAsync(String resourceGroupName, @@ -1089,7 +1245,7 @@ private Mono> listEntitiesWithResponseAs } /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -1097,7 +1253,7 @@ private Mono> listEntitiesWithResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident on successful completion of {@link Mono}. + * @return all incident related entities on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono listEntitiesAsync(String resourceGroupName, String workspaceName, @@ -1107,7 +1263,7 @@ private Mono listEntitiesAsync(String resourceGro } /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -1116,7 +1272,7 @@ private Mono listEntitiesAsync(String resourceGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident along with {@link Response}. + * @return all incident related entities along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response listEntitiesWithResponse(String resourceGroupName, @@ -1125,7 +1281,7 @@ public Response listEntitiesWithResponse(String r } /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -1133,7 +1289,7 @@ public Response listEntitiesWithResponse(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident. + * @return all incident related entities. */ @ServiceMethod(returns = ReturnType.SINGLE) public IncidentEntitiesResponseInner listEntities(String resourceGroupName, String workspaceName, diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsImpl.java index bebcafe951ff..d6124ffe7a22 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/IncidentsImpl.java @@ -19,6 +19,7 @@ import com.azure.resourcemanager.securityinsights.models.IncidentBookmarkList; import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResponse; import com.azure.resourcemanager.securityinsights.models.Incidents; +import com.azure.resourcemanager.securityinsights.models.ManualTriggerRequestBody; public final class IncidentsImpl implements Incidents { private static final ClientLogger LOGGER = new ClientLogger(IncidentsImpl.class); @@ -33,6 +34,16 @@ public IncidentsImpl(IncidentsClient innerClient, this.serviceManager = serviceManager; } + public Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, + String incidentIdentifier, ManualTriggerRequestBody requestBody, Context context) { + return this.serviceClient() + .runPlaybookWithResponse(resourceGroupName, workspaceName, incidentIdentifier, requestBody, context); + } + + public Object runPlaybook(String resourceGroupName, String workspaceName, String incidentIdentifier) { + return this.serviceClient().runPlaybook(resourceGroupName, workspaceName, incidentIdentifier); + } + public PagedIterable list(String resourceGroupName, String workspaceName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); return ResourceManagerUtils.mapPage(inner, inner1 -> new IncidentImpl(inner1, this.manager())); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/JobImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/JobImpl.java new file mode 100644 index 000000000000..b05ed8bde6d6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/JobImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.JobInner; +import com.azure.resourcemanager.securityinsights.models.Job; +import com.azure.resourcemanager.securityinsights.models.JobItem; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class JobImpl implements Job { + private JobInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + JobImpl(JobInner innerObject, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public List items() { + List inner = this.innerModel().items(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public JobInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadataModelImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadataModelImpl.java new file mode 100644 index 000000000000..d0a45a5ae837 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadataModelImpl.java @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.MetadataModelInner; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataModel; +import com.azure.resourcemanager.securityinsights.models.MetadataPatch; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; + +public final class MetadataModelImpl implements MetadataModel, MetadataModel.Definition, MetadataModel.Update { + private MetadataModelInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String contentId() { + return this.innerModel().contentId(); + } + + public String parentId() { + return this.innerModel().parentId(); + } + + public String version() { + return this.innerModel().version(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public MetadataSource source() { + return this.innerModel().source(); + } + + public MetadataAuthor author() { + return this.innerModel().author(); + } + + public MetadataSupport support() { + return this.innerModel().support(); + } + + public MetadataDependencies dependencies() { + return this.innerModel().dependencies(); + } + + public MetadataCategories categories() { + return this.innerModel().categories(); + } + + public List providers() { + List inner = this.innerModel().providers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public LocalDate firstPublishDate() { + return this.innerModel().firstPublishDate(); + } + + public LocalDate lastPublishDate() { + return this.innerModel().lastPublishDate(); + } + + public String customVersion() { + return this.innerModel().customVersion(); + } + + public String contentSchemaVersion() { + return this.innerModel().contentSchemaVersion(); + } + + public String icon() { + return this.innerModel().icon(); + } + + public List threatAnalysisTactics() { + List inner = this.innerModel().threatAnalysisTactics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List threatAnalysisTechniques() { + List inner = this.innerModel().threatAnalysisTechniques(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List previewImages() { + List inner = this.innerModel().previewImages(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List previewImagesDark() { + List inner = this.innerModel().previewImagesDark(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MetadataModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String metadataName; + + private MetadataPatch updateMetadataPatch; + + public MetadataModelImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public MetadataModel create() { + this.innerObject = serviceManager.serviceClient() + .getMetadatas() + .createWithResponse(resourceGroupName, workspaceName, metadataName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MetadataModel create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMetadatas() + .createWithResponse(resourceGroupName, workspaceName, metadataName, this.innerModel(), context) + .getValue(); + return this; + } + + MetadataModelImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new MetadataModelInner(); + this.serviceManager = serviceManager; + this.metadataName = name; + } + + public MetadataModelImpl update() { + this.updateMetadataPatch = new MetadataPatch(); + return this; + } + + public MetadataModel apply() { + this.innerObject = serviceManager.serviceClient() + .getMetadatas() + .updateWithResponse(resourceGroupName, workspaceName, metadataName, updateMetadataPatch, Context.NONE) + .getValue(); + return this; + } + + public MetadataModel apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMetadatas() + .updateWithResponse(resourceGroupName, workspaceName, metadataName, updateMetadataPatch, context) + .getValue(); + return this; + } + + MetadataModelImpl(MetadataModelInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.metadataName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "metadata"); + } + + public MetadataModel refresh() { + this.innerObject = serviceManager.serviceClient() + .getMetadatas() + .getWithResponse(resourceGroupName, workspaceName, metadataName, Context.NONE) + .getValue(); + return this; + } + + public MetadataModel refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMetadatas() + .getWithResponse(resourceGroupName, workspaceName, metadataName, context) + .getValue(); + return this; + } + + public MetadataModelImpl withEtag(String etag) { + if (isInCreateMode()) { + this.innerModel().withEtag(etag); + return this; + } else { + this.updateMetadataPatch.withEtag(etag); + return this; + } + } + + public MetadataModelImpl withContentId(String contentId) { + if (isInCreateMode()) { + this.innerModel().withContentId(contentId); + return this; + } else { + this.updateMetadataPatch.withContentId(contentId); + return this; + } + } + + public MetadataModelImpl withParentId(String parentId) { + if (isInCreateMode()) { + this.innerModel().withParentId(parentId); + return this; + } else { + this.updateMetadataPatch.withParentId(parentId); + return this; + } + } + + public MetadataModelImpl withVersion(String version) { + if (isInCreateMode()) { + this.innerModel().withVersion(version); + return this; + } else { + this.updateMetadataPatch.withVersion(version); + return this; + } + } + + public MetadataModelImpl withKind(String kind) { + if (isInCreateMode()) { + this.innerModel().withKind(kind); + return this; + } else { + this.updateMetadataPatch.withKind(kind); + return this; + } + } + + public MetadataModelImpl withSource(MetadataSource source) { + if (isInCreateMode()) { + this.innerModel().withSource(source); + return this; + } else { + this.updateMetadataPatch.withSource(source); + return this; + } + } + + public MetadataModelImpl withAuthor(MetadataAuthor author) { + if (isInCreateMode()) { + this.innerModel().withAuthor(author); + return this; + } else { + this.updateMetadataPatch.withAuthor(author); + return this; + } + } + + public MetadataModelImpl withSupport(MetadataSupport support) { + if (isInCreateMode()) { + this.innerModel().withSupport(support); + return this; + } else { + this.updateMetadataPatch.withSupport(support); + return this; + } + } + + public MetadataModelImpl withDependencies(MetadataDependencies dependencies) { + if (isInCreateMode()) { + this.innerModel().withDependencies(dependencies); + return this; + } else { + this.updateMetadataPatch.withDependencies(dependencies); + return this; + } + } + + public MetadataModelImpl withCategories(MetadataCategories categories) { + if (isInCreateMode()) { + this.innerModel().withCategories(categories); + return this; + } else { + this.updateMetadataPatch.withCategories(categories); + return this; + } + } + + public MetadataModelImpl withProviders(List providers) { + if (isInCreateMode()) { + this.innerModel().withProviders(providers); + return this; + } else { + this.updateMetadataPatch.withProviders(providers); + return this; + } + } + + public MetadataModelImpl withFirstPublishDate(LocalDate firstPublishDate) { + if (isInCreateMode()) { + this.innerModel().withFirstPublishDate(firstPublishDate); + return this; + } else { + this.updateMetadataPatch.withFirstPublishDate(firstPublishDate); + return this; + } + } + + public MetadataModelImpl withLastPublishDate(LocalDate lastPublishDate) { + if (isInCreateMode()) { + this.innerModel().withLastPublishDate(lastPublishDate); + return this; + } else { + this.updateMetadataPatch.withLastPublishDate(lastPublishDate); + return this; + } + } + + public MetadataModelImpl withCustomVersion(String customVersion) { + if (isInCreateMode()) { + this.innerModel().withCustomVersion(customVersion); + return this; + } else { + this.updateMetadataPatch.withCustomVersion(customVersion); + return this; + } + } + + public MetadataModelImpl withContentSchemaVersion(String contentSchemaVersion) { + if (isInCreateMode()) { + this.innerModel().withContentSchemaVersion(contentSchemaVersion); + return this; + } else { + this.updateMetadataPatch.withContentSchemaVersion(contentSchemaVersion); + return this; + } + } + + public MetadataModelImpl withIcon(String icon) { + if (isInCreateMode()) { + this.innerModel().withIcon(icon); + return this; + } else { + this.updateMetadataPatch.withIcon(icon); + return this; + } + } + + public MetadataModelImpl withThreatAnalysisTactics(List threatAnalysisTactics) { + if (isInCreateMode()) { + this.innerModel().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } else { + this.updateMetadataPatch.withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + } + + public MetadataModelImpl withThreatAnalysisTechniques(List threatAnalysisTechniques) { + if (isInCreateMode()) { + this.innerModel().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } else { + this.updateMetadataPatch.withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + } + + public MetadataModelImpl withPreviewImages(List previewImages) { + if (isInCreateMode()) { + this.innerModel().withPreviewImages(previewImages); + return this; + } else { + this.updateMetadataPatch.withPreviewImages(previewImages); + return this; + } + } + + public MetadataModelImpl withPreviewImagesDark(List previewImagesDark) { + if (isInCreateMode()) { + this.innerModel().withPreviewImagesDark(previewImagesDark); + return this; + } else { + this.updateMetadataPatch.withPreviewImagesDark(previewImagesDark); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadatasClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadatasClientImpl.java new file mode 100644 index 000000000000..a19926e4f98e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadatasClientImpl.java @@ -0,0 +1,919 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.MetadatasClient; +import com.azure.resourcemanager.securityinsights.fluent.models.MetadataModelInner; +import com.azure.resourcemanager.securityinsights.models.MetadataList; +import com.azure.resourcemanager.securityinsights.models.MetadataPatch; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MetadatasClient. + */ +public final class MetadatasClientImpl implements MetadatasClient { + /** + * The proxy service used to perform REST calls. + */ + private final MetadatasService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of MetadatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetadatasClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(MetadatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsMetadatas to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsMeta") + public interface MetadatasService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, @QueryParam("$orderby") String orderby, + @QueryParam("$top") Integer top, @QueryParam("$skip") Integer skip, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("metadataName") String metadataName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("metadataName") String metadataName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("metadataName") String metadataName, @BodyParam("application/json") MetadataModelInner metadata, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("metadataName") String metadataName, @BodyParam("application/json") MetadataPatch metadataPatch, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, Integer top, Integer skip) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, filter, orderby, top, skip, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, Integer top, Integer skip, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, filter, orderby, top, skip, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, Integer skip) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skip), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final Integer skip = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skip), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, Integer skip, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skip, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final Integer skip = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, filter, orderby, top, skip)); + } + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, Integer skip, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, filter, orderby, top, skip, context)); + } + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, metadataName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, metadataName, accept, context); + } + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String metadataName) { + return getWithResponseAsync(resourceGroupName, workspaceName, metadataName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String metadataName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, metadataName, context).block(); + } + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataModelInner get(String resourceGroupName, String workspaceName, String metadataName) { + return getWithResponse(resourceGroupName, workspaceName, metadataName, Context.NONE).getValue(); + } + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, metadataName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, metadataName, accept, context); + } + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String metadataName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, metadataName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String metadataName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, metadataName, context).block(); + } + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String metadataName) { + deleteWithResponse(resourceGroupName, workspaceName, metadataName, Context.NONE); + } + + /** + * Create a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadata Metadata resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName, MetadataModelInner metadata) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + if (metadata == null) { + return Mono.error(new IllegalArgumentException("Parameter metadata is required and cannot be null.")); + } else { + metadata.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, metadataName, metadata, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadata Metadata resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName, MetadataModelInner metadata, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + if (metadata == null) { + return Mono.error(new IllegalArgumentException("Parameter metadata is required and cannot be null.")); + } else { + metadata.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, metadataName, metadata, accept, context); + } + + /** + * Create a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadata Metadata resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String workspaceName, String metadataName, + MetadataModelInner metadata) { + return createWithResponseAsync(resourceGroupName, workspaceName, metadataName, metadata) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadata Metadata resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String workspaceName, + String metadataName, MetadataModelInner metadata, Context context) { + return createWithResponseAsync(resourceGroupName, workspaceName, metadataName, metadata, context).block(); + } + + /** + * Create a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadata Metadata resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataModelInner create(String resourceGroupName, String workspaceName, String metadataName, + MetadataModelInner metadata) { + return createWithResponse(resourceGroupName, workspaceName, metadataName, metadata, Context.NONE).getValue(); + } + + /** + * Update an existing Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadataPatch Partial metadata request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName, MetadataPatch metadataPatch) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + if (metadataPatch == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataPatch is required and cannot be null.")); + } else { + metadataPatch.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, metadataName, metadataPatch, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an existing Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadataPatch Partial metadata request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String workspaceName, + String metadataName, MetadataPatch metadataPatch, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + if (metadataPatch == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataPatch is required and cannot be null.")); + } else { + metadataPatch.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, metadataName, metadataPatch, accept, context); + } + + /** + * Update an existing Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadataPatch Partial metadata request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName, String metadataName, + MetadataPatch metadataPatch) { + return updateWithResponseAsync(resourceGroupName, workspaceName, metadataName, metadataPatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update an existing Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadataPatch Partial metadata request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String workspaceName, + String metadataName, MetadataPatch metadataPatch, Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceName, metadataName, metadataPatch, context).block(); + } + + /** + * Update an existing Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param metadataPatch Partial metadata request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataModelInner update(String resourceGroupName, String workspaceName, String metadataName, + MetadataPatch metadataPatch) { + return updateWithResponse(resourceGroupName, workspaceName, metadataName, metadataPatch, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadatasImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadatasImpl.java new file mode 100644 index 000000000000..3c9abf4b4645 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/MetadatasImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.MetadatasClient; +import com.azure.resourcemanager.securityinsights.fluent.models.MetadataModelInner; +import com.azure.resourcemanager.securityinsights.models.MetadataModel; +import com.azure.resourcemanager.securityinsights.models.Metadatas; + +public final class MetadatasImpl implements Metadatas { + private static final ClientLogger LOGGER = new ClientLogger(MetadatasImpl.class); + + private final MetadatasClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public MetadatasImpl(MetadatasClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MetadataModelImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, Integer skip, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, filter, orderby, top, skip, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MetadataModelImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String metadataName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, metadataName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MetadataModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetadataModel get(String resourceGroupName, String workspaceName, String metadataName) { + MetadataModelInner inner = this.serviceClient().get(resourceGroupName, workspaceName, metadataName); + if (inner != null) { + return new MetadataModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String metadataName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, metadataName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String metadataName) { + this.serviceClient().delete(resourceGroupName, workspaceName, metadataName); + } + + public MetadataModel getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String metadataName = ResourceManagerUtils.getValueFromIdByName(id, "metadata"); + if (metadataName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadata'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, metadataName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String metadataName = ResourceManagerUtils.getValueFromIdByName(id, "metadata"); + if (metadataName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadata'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, metadataName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String metadataName = ResourceManagerUtils.getValueFromIdByName(id, "metadata"); + if (metadataName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadata'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, metadataName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String metadataName = ResourceManagerUtils.getValueFromIdByName(id, "metadata"); + if (metadataName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadata'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, metadataName, context); + } + + private MetadatasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public MetadataModelImpl define(String name) { + return new MetadataModelImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentImpl.java new file mode 100644 index 000000000000..6531ecb84593 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeConsentInner; +import com.azure.resourcemanager.securityinsights.models.OfficeConsent; + +public final class OfficeConsentImpl implements OfficeConsent { + private OfficeConsentInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + OfficeConsentImpl(OfficeConsentInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String consentId() { + return this.innerModel().consentId(); + } + + public OfficeConsentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentsClientImpl.java new file mode 100644 index 000000000000..23eacbd1dd31 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentsClientImpl.java @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.OfficeConsentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeConsentInner; +import com.azure.resourcemanager.securityinsights.models.OfficeConsentList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OfficeConsentsClient. + */ +public final class OfficeConsentsClientImpl implements OfficeConsentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OfficeConsentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of OfficeConsentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OfficeConsentsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(OfficeConsentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsOfficeConsents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsOffi") + public interface OfficeConsentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("consentId") String consentId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("consentId") String consentId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String consentId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (consentId == null) { + return Mono.error(new IllegalArgumentException("Parameter consentId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, consentId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String consentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (consentId == null) { + return Mono.error(new IllegalArgumentException("Parameter consentId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, consentId, accept, context); + } + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String consentId) { + return getWithResponseAsync(resourceGroupName, workspaceName, consentId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String consentId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, consentId, context).block(); + } + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OfficeConsentInner get(String resourceGroupName, String workspaceName, String consentId) { + return getWithResponse(resourceGroupName, workspaceName, consentId, Context.NONE).getValue(); + } + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String consentId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (consentId == null) { + return Mono.error(new IllegalArgumentException("Parameter consentId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, consentId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String consentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (consentId == null) { + return Mono.error(new IllegalArgumentException("Parameter consentId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, consentId, accept, context); + } + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String consentId) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, consentId).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String consentId, + Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, consentId, context).block(); + } + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String consentId) { + deleteWithResponse(resourceGroupName, workspaceName, consentId, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the office365 consents along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the office365 consents along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentsImpl.java new file mode 100644 index 000000000000..800f6c607000 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/OfficeConsentsImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.OfficeConsentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeConsentInner; +import com.azure.resourcemanager.securityinsights.models.OfficeConsent; +import com.azure.resourcemanager.securityinsights.models.OfficeConsents; + +public final class OfficeConsentsImpl implements OfficeConsents { + private static final ClientLogger LOGGER = new ClientLogger(OfficeConsentsImpl.class); + + private final OfficeConsentsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public OfficeConsentsImpl(OfficeConsentsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OfficeConsentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OfficeConsentImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String consentId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, consentId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OfficeConsentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OfficeConsent get(String resourceGroupName, String workspaceName, String consentId) { + OfficeConsentInner inner = this.serviceClient().get(resourceGroupName, workspaceName, consentId); + if (inner != null) { + return new OfficeConsentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String consentId, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, consentId, context); + } + + public void delete(String resourceGroupName, String workspaceName, String consentId) { + this.serviceClient().delete(resourceGroupName, workspaceName, consentId); + } + + private OfficeConsentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/PackageModelImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/PackageModelImpl.java new file mode 100644 index 000000000000..13d58bd796e0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/PackageModelImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.PackageModel; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; + +public final class PackageModelImpl implements PackageModel, PackageModel.Definition, PackageModel.Update { + private PackageModelInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String contentId() { + return this.innerModel().contentId(); + } + + public String contentProductId() { + return this.innerModel().contentProductId(); + } + + public PackageKind contentKind() { + return this.innerModel().contentKind(); + } + + public String contentSchemaVersion() { + return this.innerModel().contentSchemaVersion(); + } + + public Flag isNew() { + return this.innerModel().isNew(); + } + + public Flag isPreview() { + return this.innerModel().isPreview(); + } + + public Flag isFeatured() { + return this.innerModel().isFeatured(); + } + + public Flag isDeprecated() { + return this.innerModel().isDeprecated(); + } + + public String version() { + return this.innerModel().version(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String publisherDisplayName() { + return this.innerModel().publisherDisplayName(); + } + + public MetadataSource source() { + return this.innerModel().source(); + } + + public MetadataAuthor author() { + return this.innerModel().author(); + } + + public MetadataSupport support() { + return this.innerModel().support(); + } + + public MetadataDependencies dependencies() { + return this.innerModel().dependencies(); + } + + public List providers() { + List inner = this.innerModel().providers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public LocalDate firstPublishDate() { + return this.innerModel().firstPublishDate(); + } + + public LocalDate lastPublishDate() { + return this.innerModel().lastPublishDate(); + } + + public MetadataCategories categories() { + return this.innerModel().categories(); + } + + public List threatAnalysisTactics() { + List inner = this.innerModel().threatAnalysisTactics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List threatAnalysisTechniques() { + List inner = this.innerModel().threatAnalysisTechniques(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String icon() { + return this.innerModel().icon(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PackageModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String packageId; + + public PackageModelImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public PackageModel create() { + this.innerObject = serviceManager.serviceClient() + .getContentPackageOperations() + .installWithResponse(resourceGroupName, workspaceName, packageId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PackageModel create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getContentPackageOperations() + .installWithResponse(resourceGroupName, workspaceName, packageId, this.innerModel(), context) + .getValue(); + return this; + } + + PackageModelImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new PackageModelInner(); + this.serviceManager = serviceManager; + this.packageId = name; + } + + public PackageModelImpl update() { + return this; + } + + public PackageModel apply() { + this.innerObject = serviceManager.serviceClient() + .getContentPackageOperations() + .installWithResponse(resourceGroupName, workspaceName, packageId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PackageModel apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getContentPackageOperations() + .installWithResponse(resourceGroupName, workspaceName, packageId, this.innerModel(), context) + .getValue(); + return this; + } + + PackageModelImpl(PackageModelInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.packageId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "contentPackages"); + } + + public PackageModelImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public PackageModelImpl withContentId(String contentId) { + this.innerModel().withContentId(contentId); + return this; + } + + public PackageModelImpl withContentProductId(String contentProductId) { + this.innerModel().withContentProductId(contentProductId); + return this; + } + + public PackageModelImpl withContentKind(PackageKind contentKind) { + this.innerModel().withContentKind(contentKind); + return this; + } + + public PackageModelImpl withContentSchemaVersion(String contentSchemaVersion) { + this.innerModel().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + public PackageModelImpl withIsNew(Flag isNew) { + this.innerModel().withIsNew(isNew); + return this; + } + + public PackageModelImpl withIsPreview(Flag isPreview) { + this.innerModel().withIsPreview(isPreview); + return this; + } + + public PackageModelImpl withIsFeatured(Flag isFeatured) { + this.innerModel().withIsFeatured(isFeatured); + return this; + } + + public PackageModelImpl withIsDeprecated(Flag isDeprecated) { + this.innerModel().withIsDeprecated(isDeprecated); + return this; + } + + public PackageModelImpl withVersion(String version) { + this.innerModel().withVersion(version); + return this; + } + + public PackageModelImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public PackageModelImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public PackageModelImpl withPublisherDisplayName(String publisherDisplayName) { + this.innerModel().withPublisherDisplayName(publisherDisplayName); + return this; + } + + public PackageModelImpl withSource(MetadataSource source) { + this.innerModel().withSource(source); + return this; + } + + public PackageModelImpl withAuthor(MetadataAuthor author) { + this.innerModel().withAuthor(author); + return this; + } + + public PackageModelImpl withSupport(MetadataSupport support) { + this.innerModel().withSupport(support); + return this; + } + + public PackageModelImpl withDependencies(MetadataDependencies dependencies) { + this.innerModel().withDependencies(dependencies); + return this; + } + + public PackageModelImpl withProviders(List providers) { + this.innerModel().withProviders(providers); + return this; + } + + public PackageModelImpl withFirstPublishDate(LocalDate firstPublishDate) { + this.innerModel().withFirstPublishDate(firstPublishDate); + return this; + } + + public PackageModelImpl withLastPublishDate(LocalDate lastPublishDate) { + this.innerModel().withLastPublishDate(lastPublishDate); + return this; + } + + public PackageModelImpl withCategories(MetadataCategories categories) { + this.innerModel().withCategories(categories); + return this; + } + + public PackageModelImpl withThreatAnalysisTactics(List threatAnalysisTactics) { + this.innerModel().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + public PackageModelImpl withThreatAnalysisTechniques(List threatAnalysisTechniques) { + this.innerModel().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + public PackageModelImpl withIcon(String icon) { + this.innerModel().withIcon(icon); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageModelImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageModelImpl.java new file mode 100644 index 000000000000..27614dca3f2c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageModelImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.ProductPackageModel; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; + +public final class ProductPackageModelImpl implements ProductPackageModel { + private ProductPackageModelInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + ProductPackageModelImpl(ProductPackageModelInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String installedVersion() { + return this.innerModel().installedVersion(); + } + + public String metadataResourceId() { + return this.innerModel().metadataResourceId(); + } + + public Object packagedContent() { + return this.innerModel().packagedContent(); + } + + public String contentId() { + return this.innerModel().contentId(); + } + + public String contentProductId() { + return this.innerModel().contentProductId(); + } + + public PackageKind contentKind() { + return this.innerModel().contentKind(); + } + + public String contentSchemaVersion() { + return this.innerModel().contentSchemaVersion(); + } + + public Flag isNew() { + return this.innerModel().isNew(); + } + + public Flag isPreview() { + return this.innerModel().isPreview(); + } + + public Flag isFeatured() { + return this.innerModel().isFeatured(); + } + + public Flag isDeprecated() { + return this.innerModel().isDeprecated(); + } + + public String version() { + return this.innerModel().version(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String publisherDisplayName() { + return this.innerModel().publisherDisplayName(); + } + + public MetadataSource source() { + return this.innerModel().source(); + } + + public MetadataAuthor author() { + return this.innerModel().author(); + } + + public MetadataSupport support() { + return this.innerModel().support(); + } + + public MetadataDependencies dependencies() { + return this.innerModel().dependencies(); + } + + public List providers() { + List inner = this.innerModel().providers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public LocalDate firstPublishDate() { + return this.innerModel().firstPublishDate(); + } + + public LocalDate lastPublishDate() { + return this.innerModel().lastPublishDate(); + } + + public MetadataCategories categories() { + return this.innerModel().categories(); + } + + public List threatAnalysisTactics() { + List inner = this.innerModel().threatAnalysisTactics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List threatAnalysisTechniques() { + List inner = this.innerModel().threatAnalysisTechniques(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String icon() { + return this.innerModel().icon(); + } + + public ProductPackageModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageOperationsClientImpl.java new file mode 100644 index 000000000000..a23d8ccaeaac --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageOperationsClientImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ProductPackageOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ProductPackageOperationsClient. + */ +public final class ProductPackageOperationsClientImpl implements ProductPackageOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProductPackageOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ProductPackageOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProductPackageOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(ProductPackageOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsProductPackageOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsProd") + public interface ProductPackageOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages/{packageId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("packageId") String packageId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String packageId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, packageId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String packageId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (packageId == null) { + return Mono.error(new IllegalArgumentException("Parameter packageId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, packageId, accept, context); + } + + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String packageId) { + return getWithResponseAsync(resourceGroupName, workspaceName, packageId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String packageId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, packageId, context).block(); + } + + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductPackageModelInner get(String resourceGroupName, String workspaceName, String packageId) { + return getWithResponse(resourceGroupName, workspaceName, packageId, Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageOperationsImpl.java new file mode 100644 index 000000000000..9b78072ee89e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackageOperationsImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ProductPackageOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; +import com.azure.resourcemanager.securityinsights.models.ProductPackageModel; +import com.azure.resourcemanager.securityinsights.models.ProductPackageOperations; + +public final class ProductPackageOperationsImpl implements ProductPackageOperations { + private static final ClientLogger LOGGER = new ClientLogger(ProductPackageOperationsImpl.class); + + private final ProductPackageOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ProductPackageOperationsImpl(ProductPackageOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String packageId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, packageId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ProductPackageModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ProductPackageModel get(String resourceGroupName, String workspaceName, String packageId) { + ProductPackageModelInner inner = this.serviceClient().get(resourceGroupName, workspaceName, packageId); + if (inner != null) { + return new ProductPackageModelImpl(inner, this.manager()); + } else { + return null; + } + } + + private ProductPackageOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackagesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackagesClientImpl.java new file mode 100644 index 000000000000..27bb8ffd03e3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackagesClientImpl.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ProductPackagesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; +import com.azure.resourcemanager.securityinsights.models.ProductPackageList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ProductPackagesClient. + */ +public final class ProductPackagesClientImpl implements ProductPackagesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProductPackagesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ProductPackagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProductPackagesClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(ProductPackagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsProductPackages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsProd") + public interface ProductPackagesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, @QueryParam("$orderby") String orderby, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @QueryParam("$search") String search, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param search Searches for a substring in the response. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String filter, String orderby, Integer top, String skipToken, String search) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, filter, orderby, top, skipToken, + search, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param search Searches for a substring in the response. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String filter, String orderby, Integer top, String skipToken, String search, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, filter, orderby, top, skipToken, search, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param search Searches for a substring in the response. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, String search) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, search), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + final String search = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, search), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param search Searches for a substring in the response. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, String search, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, top, + skipToken, search, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final Integer top = null; + final String skipToken = null; + final String search = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, search)); + } + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param search Searches for a substring in the response. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, String search, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, search, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list available packages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list available packages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackagesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackagesImpl.java new file mode 100644 index 000000000000..3962a0d10ab9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductPackagesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ProductPackagesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; +import com.azure.resourcemanager.securityinsights.models.ProductPackageModel; +import com.azure.resourcemanager.securityinsights.models.ProductPackages; + +public final class ProductPackagesImpl implements ProductPackages { + private static final ClientLogger LOGGER = new ClientLogger(ProductPackagesImpl.class); + + private final ProductPackagesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ProductPackagesImpl(ProductPackagesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProductPackageModelImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, String search, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, filter, orderby, top, skipToken, search, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProductPackageModelImpl(inner1, this.manager())); + } + + private ProductPackagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductSettingsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductSettingsClientImpl.java new file mode 100644 index 000000000000..a5a7a87e8d50 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductSettingsClientImpl.java @@ -0,0 +1,702 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ProductSettingsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import com.azure.resourcemanager.securityinsights.models.SettingList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ProductSettingsClient. + */ +public final class ProductSettingsClientImpl implements ProductSettingsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProductSettingsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ProductSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProductSettingsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(ProductSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsProductSettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsProd") + public interface ProductSettingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("settingsName") String settingsName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("settingsName") String settingsName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("settingsName") String settingsName, @BodyParam("application/json") SettingsInner settings, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String settingsName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (settingsName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, settingsName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String settingsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (settingsName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, settingsName, accept, context); + } + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String settingsName) { + return getWithResponseAsync(resourceGroupName, workspaceName, settingsName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, settingsName, context).block(); + } + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SettingsInner get(String resourceGroupName, String workspaceName, String settingsName) { + return getWithResponse(resourceGroupName, workspaceName, settingsName, Context.NONE).getValue(); + } + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String settingsName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (settingsName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingsName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, settingsName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String settingsName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (settingsName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingsName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, settingsName, accept, context); + } + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String settingsName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, settingsName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, settingsName, context).block(); + } + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String settingsName) { + deleteWithResponse(resourceGroupName, workspaceName, settingsName, Context.NONE); + } + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String workspaceName, + String settingsName, SettingsInner settings) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (settingsName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingsName is required and cannot be null.")); + } + if (settings == null) { + return Mono.error(new IllegalArgumentException("Parameter settings is required and cannot be null.")); + } else { + settings.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, settingsName, settings, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String workspaceName, + String settingsName, SettingsInner settings, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (settingsName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingsName is required and cannot be null.")); + } + if (settings == null) { + return Mono.error(new IllegalArgumentException("Parameter settings is required and cannot be null.")); + } else { + settings.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, settingsName, settings, accept, context); + } + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName, String settingsName, + SettingsInner settings) { + return updateWithResponseAsync(resourceGroupName, workspaceName, settingsName, settings) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String workspaceName, + String settingsName, SettingsInner settings, Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceName, settingsName, settings, context).block(); + } + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SettingsInner update(String resourceGroupName, String workspaceName, String settingsName, + SettingsInner settings) { + return updateWithResponse(resourceGroupName, workspaceName, settingsName, settings, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductSettingsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductSettingsImpl.java new file mode 100644 index 000000000000..a1beb4c52d9f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductSettingsImpl.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ProductSettingsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import com.azure.resourcemanager.securityinsights.models.ProductSettings; +import com.azure.resourcemanager.securityinsights.models.Settings; + +public final class ProductSettingsImpl implements ProductSettings { + private static final ClientLogger LOGGER = new ClientLogger(ProductSettingsImpl.class); + + private final ProductSettingsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ProductSettingsImpl(ProductSettingsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SettingsImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SettingsImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, settingsName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SettingsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Settings get(String resourceGroupName, String workspaceName, String settingsName) { + SettingsInner inner = this.serviceClient().get(resourceGroupName, workspaceName, settingsName); + if (inner != null) { + return new SettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, settingsName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String settingsName) { + this.serviceClient().delete(resourceGroupName, workspaceName, settingsName); + } + + public Response updateWithResponse(String resourceGroupName, String workspaceName, String settingsName, + SettingsInner settings, Context context) { + Response inner = this.serviceClient() + .updateWithResponse(resourceGroupName, workspaceName, settingsName, settings, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SettingsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Settings update(String resourceGroupName, String workspaceName, String settingsName, + SettingsInner settings) { + SettingsInner inner = this.serviceClient().update(resourceGroupName, workspaceName, settingsName, settings); + if (inner != null) { + return new SettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + private ProductSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateModelImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateModelImpl.java new file mode 100644 index 000000000000..6d3888e767c4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateModelImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.ProductTemplateModel; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; + +public final class ProductTemplateModelImpl implements ProductTemplateModel { + private ProductTemplateModelInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + ProductTemplateModelImpl(ProductTemplateModelInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Object packagedContent() { + return this.innerModel().packagedContent(); + } + + public String contentId() { + return this.innerModel().contentId(); + } + + public String contentProductId() { + return this.innerModel().contentProductId(); + } + + public String packageVersion() { + return this.innerModel().packageVersion(); + } + + public String version() { + return this.innerModel().version(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Kind contentKind() { + return this.innerModel().contentKind(); + } + + public MetadataSource source() { + return this.innerModel().source(); + } + + public MetadataAuthor author() { + return this.innerModel().author(); + } + + public MetadataSupport support() { + return this.innerModel().support(); + } + + public MetadataDependencies dependencies() { + return this.innerModel().dependencies(); + } + + public MetadataCategories categories() { + return this.innerModel().categories(); + } + + public List providers() { + List inner = this.innerModel().providers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public LocalDate firstPublishDate() { + return this.innerModel().firstPublishDate(); + } + + public LocalDate lastPublishDate() { + return this.innerModel().lastPublishDate(); + } + + public String customVersion() { + return this.innerModel().customVersion(); + } + + public String contentSchemaVersion() { + return this.innerModel().contentSchemaVersion(); + } + + public String icon() { + return this.innerModel().icon(); + } + + public List threatAnalysisTactics() { + List inner = this.innerModel().threatAnalysisTactics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List threatAnalysisTechniques() { + List inner = this.innerModel().threatAnalysisTechniques(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List previewImages() { + List inner = this.innerModel().previewImages(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List previewImagesDark() { + List inner = this.innerModel().previewImagesDark(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String packageId() { + return this.innerModel().packageId(); + } + + public PackageKind packageKind() { + return this.innerModel().packageKind(); + } + + public String packageName() { + return this.innerModel().packageName(); + } + + public Flag isDeprecated() { + return this.innerModel().isDeprecated(); + } + + public ProductTemplateModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateOperationsClientImpl.java new file mode 100644 index 000000000000..13b8f8edd848 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateOperationsClientImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ProductTemplateOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ProductTemplateOperationsClient. + */ +public final class ProductTemplateOperationsClientImpl implements ProductTemplateOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProductTemplateOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ProductTemplateOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProductTemplateOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(ProductTemplateOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsProductTemplateOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsProd") + public interface ProductTemplateOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentproducttemplates/{templateId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("templateId") String templateId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String templateId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, templateId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String templateId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (templateId == null) { + return Mono.error(new IllegalArgumentException("Parameter templateId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, templateId, accept, context); + } + + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String templateId) { + return getWithResponseAsync(resourceGroupName, workspaceName, templateId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String templateId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, templateId, context).block(); + } + + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductTemplateModelInner get(String resourceGroupName, String workspaceName, String templateId) { + return getWithResponse(resourceGroupName, workspaceName, templateId, Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateOperationsImpl.java new file mode 100644 index 000000000000..d4e394101606 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplateOperationsImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ProductTemplateOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; +import com.azure.resourcemanager.securityinsights.models.ProductTemplateModel; +import com.azure.resourcemanager.securityinsights.models.ProductTemplateOperations; + +public final class ProductTemplateOperationsImpl implements ProductTemplateOperations { + private static final ClientLogger LOGGER = new ClientLogger(ProductTemplateOperationsImpl.class); + + private final ProductTemplateOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ProductTemplateOperationsImpl(ProductTemplateOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String templateId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, templateId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ProductTemplateModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ProductTemplateModel get(String resourceGroupName, String workspaceName, String templateId) { + ProductTemplateModelInner inner = this.serviceClient().get(resourceGroupName, workspaceName, templateId); + if (inner != null) { + return new ProductTemplateModelImpl(inner, this.manager()); + } else { + return null; + } + } + + private ProductTemplateOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplatesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplatesClientImpl.java new file mode 100644 index 000000000000..c8692ad169af --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplatesClientImpl.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ProductTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; +import com.azure.resourcemanager.securityinsights.models.ProductTemplateList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ProductTemplatesClient. + */ +public final class ProductTemplatesClientImpl implements ProductTemplatesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProductTemplatesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ProductTemplatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProductTemplatesClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(ProductTemplatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsProductTemplates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsProd") + public interface ProductTemplatesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductTemplates") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$filter") String filter, @QueryParam("$orderby") String orderby, + @QueryParam("$search") String search, @QueryParam("$count") Boolean count, @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String filter, String orderby, String search, Boolean count, Integer top, Integer skip, + String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, filter, orderby, search, count, top, + skip, skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String filter, String orderby, String search, Boolean count, Integer top, Integer skip, + String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, search, + count, top, skip, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final String search = null; + final Boolean count = null; + final Integer top = null; + final Integer skip = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, search, + count, top, skip, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String filter, String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, filter, orderby, search, + count, top, skip, skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String filter = null; + final String orderby = null; + final String search = null; + final Boolean count = null; + final Integer top = null; + final Integer skip = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken)); + } + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the template along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the template along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplatesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplatesImpl.java new file mode 100644 index 000000000000..6cc74029fae6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ProductTemplatesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ProductTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; +import com.azure.resourcemanager.securityinsights.models.ProductTemplateModel; +import com.azure.resourcemanager.securityinsights.models.ProductTemplates; + +public final class ProductTemplatesImpl implements ProductTemplates { + private static final ClientLogger LOGGER = new ClientLogger(ProductTemplatesImpl.class); + + private final ProductTemplatesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ProductTemplatesImpl(ProductTemplatesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProductTemplateModelImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, filter, orderby, search, count, top, skip, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProductTemplateModelImpl(inner1, this.manager())); + } + + private ProductTemplatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RecommendationImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RecommendationImpl.java new file mode 100644 index 000000000000..12913b5f3d55 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RecommendationImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import com.azure.resourcemanager.securityinsights.models.Recommendation; +import com.azure.resourcemanager.securityinsights.models.RecommendedSuggestion; +import com.azure.resourcemanager.securityinsights.models.State; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class RecommendationImpl implements Recommendation { + private RecommendationInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + RecommendationImpl(RecommendationInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String recommendationTypeId() { + return this.innerModel().recommendationTypeId(); + } + + public State state() { + return this.innerModel().state(); + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + public OffsetDateTime creationTimeUtc() { + return this.innerModel().creationTimeUtc(); + } + + public OffsetDateTime lastEvaluatedTimeUtc() { + return this.innerModel().lastEvaluatedTimeUtc(); + } + + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerModel().lastModifiedTimeUtc(); + } + + public List suggestions() { + List inner = this.innerModel().suggestions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public Map additionalProperties() { + Map inner = this.innerModel().additionalProperties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public RecommendationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluateResponseImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluateResponseImpl.java new file mode 100644 index 000000000000..aebca6c4ab3f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluateResponseImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.ReevaluateResponseInner; +import com.azure.resourcemanager.securityinsights.models.ReevaluateResponse; +import java.time.OffsetDateTime; + +public final class ReevaluateResponseImpl implements ReevaluateResponse { + private ReevaluateResponseInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + ReevaluateResponseImpl(ReevaluateResponseInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime lastEvaluatedTimeUtc() { + return this.innerModel().lastEvaluatedTimeUtc(); + } + + public ReevaluateResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluatesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluatesClientImpl.java new file mode 100644 index 000000000000..56510d7eedb0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluatesClientImpl.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ReevaluatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ReevaluateResponseInner; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ReevaluatesClient. + */ +public final class ReevaluatesClientImpl implements ReevaluatesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ReevaluatesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ReevaluatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReevaluatesClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(ReevaluatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsReevaluates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsReev") + public interface ReevaluatesService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}/triggerEvaluation") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> recommendation(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("recommendationId") UUID recommendationId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> recommendationWithResponseAsync(String resourceGroupName, + String workspaceName, UUID recommendationId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (recommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.recommendation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, recommendationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> recommendationWithResponseAsync(String resourceGroupName, + String workspaceName, UUID recommendationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (recommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.recommendation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, recommendationId, accept, context); + } + + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono recommendationAsync(String resourceGroupName, String workspaceName, + UUID recommendationId) { + return recommendationWithResponseAsync(resourceGroupName, workspaceName, recommendationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, Context context) { + return recommendationWithResponseAsync(resourceGroupName, workspaceName, recommendationId, context).block(); + } + + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReevaluateResponseInner recommendation(String resourceGroupName, String workspaceName, + UUID recommendationId) { + return recommendationWithResponse(resourceGroupName, workspaceName, recommendationId, Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluatesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluatesImpl.java new file mode 100644 index 000000000000..e5c65d760d61 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ReevaluatesImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ReevaluatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ReevaluateResponseInner; +import com.azure.resourcemanager.securityinsights.models.ReevaluateResponse; +import com.azure.resourcemanager.securityinsights.models.Reevaluates; +import java.util.UUID; + +public final class ReevaluatesImpl implements Reevaluates { + private static final ClientLogger LOGGER = new ClientLogger(ReevaluatesImpl.class); + + private final ReevaluatesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ReevaluatesImpl(ReevaluatesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, Context context) { + Response inner = this.serviceClient() + .recommendationWithResponse(resourceGroupName, workspaceName, recommendationId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ReevaluateResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ReevaluateResponse recommendation(String resourceGroupName, String workspaceName, UUID recommendationId) { + ReevaluateResponseInner inner + = this.serviceClient().recommendation(resourceGroupName, workspaceName, recommendationId); + if (inner != null) { + return new ReevaluateResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ReevaluatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RelationImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RelationImpl.java index bd0182732144..938b55d507bb 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RelationImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RelationImpl.java @@ -66,21 +66,21 @@ private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manag private String workspaceName; - private String incidentId; + private String bookmarkId; private String relationName; - public RelationImpl withExistingIncident(String resourceGroupName, String workspaceName, String incidentId) { + public RelationImpl withExistingBookmark(String resourceGroupName, String workspaceName, String bookmarkId) { this.resourceGroupName = resourceGroupName; this.workspaceName = workspaceName; - this.incidentId = incidentId; + this.bookmarkId = bookmarkId; return this; } public Relation create() { this.innerObject = serviceManager.serviceClient() - .getIncidentRelations() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, relationName, this.innerModel(), + .getBookmarkRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, this.innerModel(), Context.NONE) .getValue(); return this; @@ -88,8 +88,8 @@ public Relation create() { public Relation create(Context context) { this.innerObject = serviceManager.serviceClient() - .getIncidentRelations() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, relationName, this.innerModel(), + .getBookmarkRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, this.innerModel(), context) .getValue(); return this; @@ -107,8 +107,8 @@ public RelationImpl update() { public Relation apply() { this.innerObject = serviceManager.serviceClient() - .getIncidentRelations() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, relationName, this.innerModel(), + .getBookmarkRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, this.innerModel(), Context.NONE) .getValue(); return this; @@ -116,8 +116,8 @@ public Relation apply() { public Relation apply(Context context) { this.innerObject = serviceManager.serviceClient() - .getIncidentRelations() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, incidentId, relationName, this.innerModel(), + .getBookmarkRelations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, this.innerModel(), context) .getValue(); return this; @@ -129,22 +129,22 @@ public Relation apply(Context context) { this.serviceManager = serviceManager; this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); - this.incidentId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "incidents"); + this.bookmarkId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "bookmarks"); this.relationName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "relations"); } public Relation refresh() { this.innerObject = serviceManager.serviceClient() - .getIncidentRelations() - .getWithResponse(resourceGroupName, workspaceName, incidentId, relationName, Context.NONE) + .getBookmarkRelations() + .getWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, Context.NONE) .getValue(); return this; } public Relation refresh(Context context) { this.innerObject = serviceManager.serviceClient() - .getIncidentRelations() - .getWithResponse(resourceGroupName, workspaceName, incidentId, relationName, context) + .getBookmarkRelations() + .getWithResponse(resourceGroupName, workspaceName, bookmarkId, relationName, context) .getValue(); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RepoImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RepoImpl.java new file mode 100644 index 000000000000..808c23a845e9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/RepoImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.RepoInner; +import com.azure.resourcemanager.securityinsights.models.Repo; +import java.util.Collections; +import java.util.List; + +public final class RepoImpl implements Repo { + private RepoInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + RepoImpl(RepoInner innerObject, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String url() { + return this.innerModel().url(); + } + + public String fullName() { + return this.innerModel().fullName(); + } + + public Long installationId() { + return this.innerModel().installationId(); + } + + public List branches() { + List inner = this.innerModel().branches(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RepoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ResourceProvidersClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..cc5d26f554f2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentDomainWhoisInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentIpGeodataInner; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentIpAddressBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentType; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** + * The proxy service used to perform REST calls. + */ + private final ResourceProvidersService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsResourceProviders to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsReso") + public interface ResourceProvidersService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/enrichment/{enrichmentType}/listGeodataByIp") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listGeodataByIp(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("enrichmentType") EnrichmentType enrichmentType, + @BodyParam("application/json") EnrichmentIpAddressBody ipAddressBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/enrichment/{enrichmentType}/listWhoisByDomain") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listWhoisByDomain(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("enrichmentType") EnrichmentType enrichmentType, + @BodyParam("application/json") EnrichmentDomainBody domainBody, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGeodataByIpWithResponseAsync(String resourceGroupName, + String workspaceName, EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (enrichmentType == null) { + return Mono.error(new IllegalArgumentException("Parameter enrichmentType is required and cannot be null.")); + } + if (ipAddressBody == null) { + return Mono.error(new IllegalArgumentException("Parameter ipAddressBody is required and cannot be null.")); + } else { + ipAddressBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listGeodataByIp(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, enrichmentType, ipAddressBody, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listGeodataByIpWithResponseAsync(String resourceGroupName, + String workspaceName, EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (enrichmentType == null) { + return Mono.error(new IllegalArgumentException("Parameter enrichmentType is required and cannot be null.")); + } + if (ipAddressBody == null) { + return Mono.error(new IllegalArgumentException("Parameter ipAddressBody is required and cannot be null.")); + } else { + ipAddressBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listGeodataByIp(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, enrichmentType, ipAddressBody, accept, + context); + } + + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listGeodataByIpAsync(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody) { + return listGeodataByIpWithResponseAsync(resourceGroupName, workspaceName, enrichmentType, ipAddressBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listGeodataByIpWithResponse(String resourceGroupName, + String workspaceName, EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody, Context context) { + return listGeodataByIpWithResponseAsync(resourceGroupName, workspaceName, enrichmentType, ipAddressBody, + context).block(); + } + + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnrichmentIpGeodataInner listGeodataByIp(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody) { + return listGeodataByIpWithResponse(resourceGroupName, workspaceName, enrichmentType, ipAddressBody, + Context.NONE).getValue(); + } + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWhoisByDomainWithResponseAsync(String resourceGroupName, + String workspaceName, EnrichmentType enrichmentType, EnrichmentDomainBody domainBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (enrichmentType == null) { + return Mono.error(new IllegalArgumentException("Parameter enrichmentType is required and cannot be null.")); + } + if (domainBody == null) { + return Mono.error(new IllegalArgumentException("Parameter domainBody is required and cannot be null.")); + } else { + domainBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listWhoisByDomain(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, enrichmentType, domainBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWhoisByDomainWithResponseAsync(String resourceGroupName, + String workspaceName, EnrichmentType enrichmentType, EnrichmentDomainBody domainBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (enrichmentType == null) { + return Mono.error(new IllegalArgumentException("Parameter enrichmentType is required and cannot be null.")); + } + if (domainBody == null) { + return Mono.error(new IllegalArgumentException("Parameter domainBody is required and cannot be null.")); + } else { + domainBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listWhoisByDomain(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, enrichmentType, domainBody, accept, + context); + } + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listWhoisByDomainAsync(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody) { + return listWhoisByDomainWithResponseAsync(resourceGroupName, workspaceName, enrichmentType, domainBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWhoisByDomainWithResponse(String resourceGroupName, + String workspaceName, EnrichmentType enrichmentType, EnrichmentDomainBody domainBody, Context context) { + return listWhoisByDomainWithResponseAsync(resourceGroupName, workspaceName, enrichmentType, domainBody, context) + .block(); + } + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnrichmentDomainWhoisInner listWhoisByDomain(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody) { + return listWhoisByDomainWithResponse(resourceGroupName, workspaceName, enrichmentType, domainBody, Context.NONE) + .getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ResourceProvidersImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..2a701d01f411 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ResourceProvidersImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentDomainWhoisInner; +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentIpGeodataInner; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainWhois; +import com.azure.resourcemanager.securityinsights.models.EnrichmentIpAddressBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentIpGeodata; +import com.azure.resourcemanager.securityinsights.models.EnrichmentType; +import com.azure.resourcemanager.securityinsights.models.ResourceProviders; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listGeodataByIpWithResponse(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody, Context context) { + Response inner = this.serviceClient() + .listGeodataByIpWithResponse(resourceGroupName, workspaceName, enrichmentType, ipAddressBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnrichmentIpGeodataImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EnrichmentIpGeodata listGeodataByIp(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody) { + EnrichmentIpGeodataInner inner + = this.serviceClient().listGeodataByIp(resourceGroupName, workspaceName, enrichmentType, ipAddressBody); + if (inner != null) { + return new EnrichmentIpGeodataImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWhoisByDomainWithResponse(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody, Context context) { + Response inner = this.serviceClient() + .listWhoisByDomainWithResponse(resourceGroupName, workspaceName, enrichmentType, domainBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnrichmentDomainWhoisImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EnrichmentDomainWhois listWhoisByDomain(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody) { + EnrichmentDomainWhoisInner inner + = this.serviceClient().listWhoisByDomain(resourceGroupName, workspaceName, enrichmentType, domainBody); + if (inner != null) { + return new EnrichmentDomainWhoisImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsBuilder.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsBuilder.java index 4fa4da61617c..da10300b2756 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsBuilder.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsBuilder.java @@ -20,12 +20,12 @@ @ServiceClientBuilder(serviceClients = { SecurityInsightsImpl.class }) public final class SecurityInsightsBuilder { /* - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private String subscriptionId; /** - * Sets The ID of the target subscription. + * Sets The ID of the target subscription. The value must be an UUID. * * @param subscriptionId the subscriptionId value. * @return the SecurityInsightsBuilder. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsImpl.java index 5888fc900e7b..fd5138248195 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SecurityInsightsImpl.java @@ -24,23 +24,69 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.securityinsights.fluent.ActionsClient; +import com.azure.resourcemanager.securityinsights.fluent.AlertRuleOperationsClient; import com.azure.resourcemanager.securityinsights.fluent.AlertRuleTemplatesClient; import com.azure.resourcemanager.securityinsights.fluent.AlertRulesClient; import com.azure.resourcemanager.securityinsights.fluent.AutomationRulesClient; +import com.azure.resourcemanager.securityinsights.fluent.BillingStatisticsClient; +import com.azure.resourcemanager.securityinsights.fluent.BookmarkOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.BookmarkRelationsClient; import com.azure.resourcemanager.securityinsights.fluent.BookmarksClient; +import com.azure.resourcemanager.securityinsights.fluent.BusinessApplicationAgentOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.BusinessApplicationAgentsClient; +import com.azure.resourcemanager.securityinsights.fluent.ContentPackageOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.ContentPackagesClient; +import com.azure.resourcemanager.securityinsights.fluent.ContentTemplateOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.ContentTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.DataConnectorDefinitionsClient; +import com.azure.resourcemanager.securityinsights.fluent.DataConnectorsCheckRequirementsOperationsClient; import com.azure.resourcemanager.securityinsights.fluent.DataConnectorsClient; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesClient; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesGetTimelinesClient; +import com.azure.resourcemanager.securityinsights.fluent.EntitiesRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.EntityQueriesClient; +import com.azure.resourcemanager.securityinsights.fluent.EntityQueryTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.EntityRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.FileImportsClient; +import com.azure.resourcemanager.securityinsights.fluent.GetRecommendationsClient; +import com.azure.resourcemanager.securityinsights.fluent.GetTriggeredAnalyticsRuleRunsClient; +import com.azure.resourcemanager.securityinsights.fluent.GetsClient; +import com.azure.resourcemanager.securityinsights.fluent.HuntCommentsClient; +import com.azure.resourcemanager.securityinsights.fluent.HuntRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.HuntsClient; import com.azure.resourcemanager.securityinsights.fluent.IncidentCommentsClient; import com.azure.resourcemanager.securityinsights.fluent.IncidentRelationsClient; +import com.azure.resourcemanager.securityinsights.fluent.IncidentTasksClient; import com.azure.resourcemanager.securityinsights.fluent.IncidentsClient; +import com.azure.resourcemanager.securityinsights.fluent.MetadatasClient; +import com.azure.resourcemanager.securityinsights.fluent.OfficeConsentsClient; import com.azure.resourcemanager.securityinsights.fluent.OperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.ProductPackageOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.ProductPackagesClient; +import com.azure.resourcemanager.securityinsights.fluent.ProductSettingsClient; +import com.azure.resourcemanager.securityinsights.fluent.ProductTemplateOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.ProductTemplatesClient; +import com.azure.resourcemanager.securityinsights.fluent.ReevaluatesClient; +import com.azure.resourcemanager.securityinsights.fluent.ResourceProvidersClient; import com.azure.resourcemanager.securityinsights.fluent.SecurityInsights; import com.azure.resourcemanager.securityinsights.fluent.SecurityMLAnalyticsSettingsClient; import com.azure.resourcemanager.securityinsights.fluent.SentinelOnboardingStatesClient; +import com.azure.resourcemanager.securityinsights.fluent.SourceControlsClient; +import com.azure.resourcemanager.securityinsights.fluent.SourceControlsOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.SystemsClient; import com.azure.resourcemanager.securityinsights.fluent.ThreatIntelligenceIndicatorMetricsClient; import com.azure.resourcemanager.securityinsights.fluent.ThreatIntelligenceIndicatorsClient; import com.azure.resourcemanager.securityinsights.fluent.ThreatIntelligenceIndicatorsOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.ThreatIntelligencesClient; +import com.azure.resourcemanager.securityinsights.fluent.TriggeredAnalyticsRuleRunOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.UpdatesClient; import com.azure.resourcemanager.securityinsights.fluent.WatchlistItemsClient; import com.azure.resourcemanager.securityinsights.fluent.WatchlistsClient; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerAssignmentJobsClient; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerAssignmentsClient; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerConfigurationsClient; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerGroupsClient; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerMembersClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -56,12 +102,12 @@ @ServiceClient(builder = SecurityInsightsBuilder.class) public final class SecurityInsightsImpl implements SecurityInsights { /** - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private final String subscriptionId; /** - * Gets The ID of the target subscription. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -195,6 +241,48 @@ public AutomationRulesClient getAutomationRules() { return this.automationRules; } + /** + * The EntitiesClient object to access its operations. + */ + private final EntitiesClient entities; + + /** + * Gets the EntitiesClient object to access its operations. + * + * @return the EntitiesClient object. + */ + public EntitiesClient getEntities() { + return this.entities; + } + + /** + * The IncidentsClient object to access its operations. + */ + private final IncidentsClient incidents; + + /** + * Gets the IncidentsClient object to access its operations. + * + * @return the IncidentsClient object. + */ + public IncidentsClient getIncidents() { + return this.incidents; + } + + /** + * The BillingStatisticsClient object to access its operations. + */ + private final BillingStatisticsClient billingStatistics; + + /** + * Gets the BillingStatisticsClient object to access its operations. + * + * @return the BillingStatisticsClient object. + */ + public BillingStatisticsClient getBillingStatistics() { + return this.billingStatistics; + } + /** * The BookmarksClient object to access its operations. */ @@ -209,6 +297,202 @@ public BookmarksClient getBookmarks() { return this.bookmarks; } + /** + * The BookmarkRelationsClient object to access its operations. + */ + private final BookmarkRelationsClient bookmarkRelations; + + /** + * Gets the BookmarkRelationsClient object to access its operations. + * + * @return the BookmarkRelationsClient object. + */ + public BookmarkRelationsClient getBookmarkRelations() { + return this.bookmarkRelations; + } + + /** + * The BookmarkOperationsClient object to access its operations. + */ + private final BookmarkOperationsClient bookmarkOperations; + + /** + * Gets the BookmarkOperationsClient object to access its operations. + * + * @return the BookmarkOperationsClient object. + */ + public BookmarkOperationsClient getBookmarkOperations() { + return this.bookmarkOperations; + } + + /** + * The BusinessApplicationAgentsClient object to access its operations. + */ + private final BusinessApplicationAgentsClient businessApplicationAgents; + + /** + * Gets the BusinessApplicationAgentsClient object to access its operations. + * + * @return the BusinessApplicationAgentsClient object. + */ + public BusinessApplicationAgentsClient getBusinessApplicationAgents() { + return this.businessApplicationAgents; + } + + /** + * The BusinessApplicationAgentOperationsClient object to access its operations. + */ + private final BusinessApplicationAgentOperationsClient businessApplicationAgentOperations; + + /** + * Gets the BusinessApplicationAgentOperationsClient object to access its operations. + * + * @return the BusinessApplicationAgentOperationsClient object. + */ + public BusinessApplicationAgentOperationsClient getBusinessApplicationAgentOperations() { + return this.businessApplicationAgentOperations; + } + + /** + * The SystemsClient object to access its operations. + */ + private final SystemsClient systems; + + /** + * Gets the SystemsClient object to access its operations. + * + * @return the SystemsClient object. + */ + public SystemsClient getSystems() { + return this.systems; + } + + /** + * The ContentPackagesClient object to access its operations. + */ + private final ContentPackagesClient contentPackages; + + /** + * Gets the ContentPackagesClient object to access its operations. + * + * @return the ContentPackagesClient object. + */ + public ContentPackagesClient getContentPackages() { + return this.contentPackages; + } + + /** + * The ContentPackageOperationsClient object to access its operations. + */ + private final ContentPackageOperationsClient contentPackageOperations; + + /** + * Gets the ContentPackageOperationsClient object to access its operations. + * + * @return the ContentPackageOperationsClient object. + */ + public ContentPackageOperationsClient getContentPackageOperations() { + return this.contentPackageOperations; + } + + /** + * The ProductPackagesClient object to access its operations. + */ + private final ProductPackagesClient productPackages; + + /** + * Gets the ProductPackagesClient object to access its operations. + * + * @return the ProductPackagesClient object. + */ + public ProductPackagesClient getProductPackages() { + return this.productPackages; + } + + /** + * The ProductPackageOperationsClient object to access its operations. + */ + private final ProductPackageOperationsClient productPackageOperations; + + /** + * Gets the ProductPackageOperationsClient object to access its operations. + * + * @return the ProductPackageOperationsClient object. + */ + public ProductPackageOperationsClient getProductPackageOperations() { + return this.productPackageOperations; + } + + /** + * The ProductTemplatesClient object to access its operations. + */ + private final ProductTemplatesClient productTemplates; + + /** + * Gets the ProductTemplatesClient object to access its operations. + * + * @return the ProductTemplatesClient object. + */ + public ProductTemplatesClient getProductTemplates() { + return this.productTemplates; + } + + /** + * The ProductTemplateOperationsClient object to access its operations. + */ + private final ProductTemplateOperationsClient productTemplateOperations; + + /** + * Gets the ProductTemplateOperationsClient object to access its operations. + * + * @return the ProductTemplateOperationsClient object. + */ + public ProductTemplateOperationsClient getProductTemplateOperations() { + return this.productTemplateOperations; + } + + /** + * The ContentTemplatesClient object to access its operations. + */ + private final ContentTemplatesClient contentTemplates; + + /** + * Gets the ContentTemplatesClient object to access its operations. + * + * @return the ContentTemplatesClient object. + */ + public ContentTemplatesClient getContentTemplates() { + return this.contentTemplates; + } + + /** + * The ContentTemplateOperationsClient object to access its operations. + */ + private final ContentTemplateOperationsClient contentTemplateOperations; + + /** + * Gets the ContentTemplateOperationsClient object to access its operations. + * + * @return the ContentTemplateOperationsClient object. + */ + public ContentTemplateOperationsClient getContentTemplateOperations() { + return this.contentTemplateOperations; + } + + /** + * The DataConnectorDefinitionsClient object to access its operations. + */ + private final DataConnectorDefinitionsClient dataConnectorDefinitions; + + /** + * Gets the DataConnectorDefinitionsClient object to access its operations. + * + * @return the DataConnectorDefinitionsClient object. + */ + public DataConnectorDefinitionsClient getDataConnectorDefinitions() { + return this.dataConnectorDefinitions; + } + /** * The DataConnectorsClient object to access its operations. */ @@ -224,17 +508,157 @@ public DataConnectorsClient getDataConnectors() { } /** - * The IncidentsClient object to access its operations. + * The DataConnectorsCheckRequirementsOperationsClient object to access its operations. */ - private final IncidentsClient incidents; + private final DataConnectorsCheckRequirementsOperationsClient dataConnectorsCheckRequirementsOperations; /** - * Gets the IncidentsClient object to access its operations. + * Gets the DataConnectorsCheckRequirementsOperationsClient object to access its operations. * - * @return the IncidentsClient object. + * @return the DataConnectorsCheckRequirementsOperationsClient object. */ - public IncidentsClient getIncidents() { - return this.incidents; + public DataConnectorsCheckRequirementsOperationsClient getDataConnectorsCheckRequirementsOperations() { + return this.dataConnectorsCheckRequirementsOperations; + } + + /** + * The ResourceProvidersClient object to access its operations. + */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** + * The EntitiesGetTimelinesClient object to access its operations. + */ + private final EntitiesGetTimelinesClient entitiesGetTimelines; + + /** + * Gets the EntitiesGetTimelinesClient object to access its operations. + * + * @return the EntitiesGetTimelinesClient object. + */ + public EntitiesGetTimelinesClient getEntitiesGetTimelines() { + return this.entitiesGetTimelines; + } + + /** + * The EntitiesRelationsClient object to access its operations. + */ + private final EntitiesRelationsClient entitiesRelations; + + /** + * Gets the EntitiesRelationsClient object to access its operations. + * + * @return the EntitiesRelationsClient object. + */ + public EntitiesRelationsClient getEntitiesRelations() { + return this.entitiesRelations; + } + + /** + * The EntityRelationsClient object to access its operations. + */ + private final EntityRelationsClient entityRelations; + + /** + * Gets the EntityRelationsClient object to access its operations. + * + * @return the EntityRelationsClient object. + */ + public EntityRelationsClient getEntityRelations() { + return this.entityRelations; + } + + /** + * The EntityQueriesClient object to access its operations. + */ + private final EntityQueriesClient entityQueries; + + /** + * Gets the EntityQueriesClient object to access its operations. + * + * @return the EntityQueriesClient object. + */ + public EntityQueriesClient getEntityQueries() { + return this.entityQueries; + } + + /** + * The EntityQueryTemplatesClient object to access its operations. + */ + private final EntityQueryTemplatesClient entityQueryTemplates; + + /** + * Gets the EntityQueryTemplatesClient object to access its operations. + * + * @return the EntityQueryTemplatesClient object. + */ + public EntityQueryTemplatesClient getEntityQueryTemplates() { + return this.entityQueryTemplates; + } + + /** + * The FileImportsClient object to access its operations. + */ + private final FileImportsClient fileImports; + + /** + * Gets the FileImportsClient object to access its operations. + * + * @return the FileImportsClient object. + */ + public FileImportsClient getFileImports() { + return this.fileImports; + } + + /** + * The HuntsClient object to access its operations. + */ + private final HuntsClient hunts; + + /** + * Gets the HuntsClient object to access its operations. + * + * @return the HuntsClient object. + */ + public HuntsClient getHunts() { + return this.hunts; + } + + /** + * The HuntRelationsClient object to access its operations. + */ + private final HuntRelationsClient huntRelations; + + /** + * Gets the HuntRelationsClient object to access its operations. + * + * @return the HuntRelationsClient object. + */ + public HuntRelationsClient getHuntRelations() { + return this.huntRelations; + } + + /** + * The HuntCommentsClient object to access its operations. + */ + private final HuntCommentsClient huntComments; + + /** + * Gets the HuntCommentsClient object to access its operations. + * + * @return the HuntCommentsClient object. + */ + public HuntCommentsClient getHuntComments() { + return this.huntComments; } /** @@ -265,6 +689,48 @@ public IncidentRelationsClient getIncidentRelations() { return this.incidentRelations; } + /** + * The IncidentTasksClient object to access its operations. + */ + private final IncidentTasksClient incidentTasks; + + /** + * Gets the IncidentTasksClient object to access its operations. + * + * @return the IncidentTasksClient object. + */ + public IncidentTasksClient getIncidentTasks() { + return this.incidentTasks; + } + + /** + * The MetadatasClient object to access its operations. + */ + private final MetadatasClient metadatas; + + /** + * Gets the MetadatasClient object to access its operations. + * + * @return the MetadatasClient object. + */ + public MetadatasClient getMetadatas() { + return this.metadatas; + } + + /** + * The OfficeConsentsClient object to access its operations. + */ + private final OfficeConsentsClient officeConsents; + + /** + * Gets the OfficeConsentsClient object to access its operations. + * + * @return the OfficeConsentsClient object. + */ + public OfficeConsentsClient getOfficeConsents() { + return this.officeConsents; + } + /** * The SentinelOnboardingStatesClient object to access its operations. */ @@ -279,6 +745,76 @@ public SentinelOnboardingStatesClient getSentinelOnboardingStates() { return this.sentinelOnboardingStates; } + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The GetRecommendationsClient object to access its operations. + */ + private final GetRecommendationsClient getRecommendations; + + /** + * Gets the GetRecommendationsClient object to access its operations. + * + * @return the GetRecommendationsClient object. + */ + public GetRecommendationsClient getGetRecommendations() { + return this.getRecommendations; + } + + /** + * The GetsClient object to access its operations. + */ + private final GetsClient gets; + + /** + * Gets the GetsClient object to access its operations. + * + * @return the GetsClient object. + */ + public GetsClient getGets() { + return this.gets; + } + + /** + * The UpdatesClient object to access its operations. + */ + private final UpdatesClient updates; + + /** + * Gets the UpdatesClient object to access its operations. + * + * @return the UpdatesClient object. + */ + public UpdatesClient getUpdates() { + return this.updates; + } + + /** + * The ReevaluatesClient object to access its operations. + */ + private final ReevaluatesClient reevaluates; + + /** + * Gets the ReevaluatesClient object to access its operations. + * + * @return the ReevaluatesClient object. + */ + public ReevaluatesClient getReevaluates() { + return this.reevaluates; + } + /** * The SecurityMLAnalyticsSettingsClient object to access its operations. */ @@ -293,6 +829,48 @@ public SecurityMLAnalyticsSettingsClient getSecurityMLAnalyticsSettings() { return this.securityMLAnalyticsSettings; } + /** + * The ProductSettingsClient object to access its operations. + */ + private final ProductSettingsClient productSettings; + + /** + * Gets the ProductSettingsClient object to access its operations. + * + * @return the ProductSettingsClient object. + */ + public ProductSettingsClient getProductSettings() { + return this.productSettings; + } + + /** + * The SourceControlsClient object to access its operations. + */ + private final SourceControlsClient sourceControls; + + /** + * Gets the SourceControlsClient object to access its operations. + * + * @return the SourceControlsClient object. + */ + public SourceControlsClient getSourceControls() { + return this.sourceControls; + } + + /** + * The SourceControlsOperationsClient object to access its operations. + */ + private final SourceControlsOperationsClient sourceControlsOperations; + + /** + * Gets the SourceControlsOperationsClient object to access its operations. + * + * @return the SourceControlsOperationsClient object. + */ + public SourceControlsOperationsClient getSourceControlsOperations() { + return this.sourceControlsOperations; + } + /** * The ThreatIntelligenceIndicatorsClient object to access its operations. */ @@ -335,6 +913,62 @@ public ThreatIntelligenceIndicatorMetricsClient getThreatIntelligenceIndicatorMe return this.threatIntelligenceIndicatorMetrics; } + /** + * The ThreatIntelligencesClient object to access its operations. + */ + private final ThreatIntelligencesClient threatIntelligences; + + /** + * Gets the ThreatIntelligencesClient object to access its operations. + * + * @return the ThreatIntelligencesClient object. + */ + public ThreatIntelligencesClient getThreatIntelligences() { + return this.threatIntelligences; + } + + /** + * The TriggeredAnalyticsRuleRunOperationsClient object to access its operations. + */ + private final TriggeredAnalyticsRuleRunOperationsClient triggeredAnalyticsRuleRunOperations; + + /** + * Gets the TriggeredAnalyticsRuleRunOperationsClient object to access its operations. + * + * @return the TriggeredAnalyticsRuleRunOperationsClient object. + */ + public TriggeredAnalyticsRuleRunOperationsClient getTriggeredAnalyticsRuleRunOperations() { + return this.triggeredAnalyticsRuleRunOperations; + } + + /** + * The GetTriggeredAnalyticsRuleRunsClient object to access its operations. + */ + private final GetTriggeredAnalyticsRuleRunsClient getTriggeredAnalyticsRuleRuns; + + /** + * Gets the GetTriggeredAnalyticsRuleRunsClient object to access its operations. + * + * @return the GetTriggeredAnalyticsRuleRunsClient object. + */ + public GetTriggeredAnalyticsRuleRunsClient getGetTriggeredAnalyticsRuleRuns() { + return this.getTriggeredAnalyticsRuleRuns; + } + + /** + * The AlertRuleOperationsClient object to access its operations. + */ + private final AlertRuleOperationsClient alertRuleOperations; + + /** + * Gets the AlertRuleOperationsClient object to access its operations. + * + * @return the AlertRuleOperationsClient object. + */ + public AlertRuleOperationsClient getAlertRuleOperations() { + return this.alertRuleOperations; + } + /** * The WatchlistsClient object to access its operations. */ @@ -364,17 +998,73 @@ public WatchlistItemsClient getWatchlistItems() { } /** - * The OperationsClient object to access its operations. + * The WorkspaceManagerAssignmentsClient object to access its operations. */ - private final OperationsClient operations; + private final WorkspaceManagerAssignmentsClient workspaceManagerAssignments; /** - * Gets the OperationsClient object to access its operations. + * Gets the WorkspaceManagerAssignmentsClient object to access its operations. * - * @return the OperationsClient object. + * @return the WorkspaceManagerAssignmentsClient object. */ - public OperationsClient getOperations() { - return this.operations; + public WorkspaceManagerAssignmentsClient getWorkspaceManagerAssignments() { + return this.workspaceManagerAssignments; + } + + /** + * The WorkspaceManagerAssignmentJobsClient object to access its operations. + */ + private final WorkspaceManagerAssignmentJobsClient workspaceManagerAssignmentJobs; + + /** + * Gets the WorkspaceManagerAssignmentJobsClient object to access its operations. + * + * @return the WorkspaceManagerAssignmentJobsClient object. + */ + public WorkspaceManagerAssignmentJobsClient getWorkspaceManagerAssignmentJobs() { + return this.workspaceManagerAssignmentJobs; + } + + /** + * The WorkspaceManagerConfigurationsClient object to access its operations. + */ + private final WorkspaceManagerConfigurationsClient workspaceManagerConfigurations; + + /** + * Gets the WorkspaceManagerConfigurationsClient object to access its operations. + * + * @return the WorkspaceManagerConfigurationsClient object. + */ + public WorkspaceManagerConfigurationsClient getWorkspaceManagerConfigurations() { + return this.workspaceManagerConfigurations; + } + + /** + * The WorkspaceManagerGroupsClient object to access its operations. + */ + private final WorkspaceManagerGroupsClient workspaceManagerGroups; + + /** + * Gets the WorkspaceManagerGroupsClient object to access its operations. + * + * @return the WorkspaceManagerGroupsClient object. + */ + public WorkspaceManagerGroupsClient getWorkspaceManagerGroups() { + return this.workspaceManagerGroups; + } + + /** + * The WorkspaceManagerMembersClient object to access its operations. + */ + private final WorkspaceManagerMembersClient workspaceManagerMembers; + + /** + * Gets the WorkspaceManagerMembersClient object to access its operations. + * + * @return the WorkspaceManagerMembersClient object. + */ + public WorkspaceManagerMembersClient getWorkspaceManagerMembers() { + return this.workspaceManagerMembers; } /** @@ -384,7 +1074,7 @@ public OperationsClient getOperations() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. * @param endpoint server parameter. */ SecurityInsightsImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, @@ -394,24 +1084,70 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2022-11-01"; + this.apiVersion = "2025-04-01-preview"; this.alertRules = new AlertRulesClientImpl(this); this.actions = new ActionsClientImpl(this); this.alertRuleTemplates = new AlertRuleTemplatesClientImpl(this); this.automationRules = new AutomationRulesClientImpl(this); + this.entities = new EntitiesClientImpl(this); + this.incidents = new IncidentsClientImpl(this); + this.billingStatistics = new BillingStatisticsClientImpl(this); this.bookmarks = new BookmarksClientImpl(this); + this.bookmarkRelations = new BookmarkRelationsClientImpl(this); + this.bookmarkOperations = new BookmarkOperationsClientImpl(this); + this.businessApplicationAgents = new BusinessApplicationAgentsClientImpl(this); + this.businessApplicationAgentOperations = new BusinessApplicationAgentOperationsClientImpl(this); + this.systems = new SystemsClientImpl(this); + this.contentPackages = new ContentPackagesClientImpl(this); + this.contentPackageOperations = new ContentPackageOperationsClientImpl(this); + this.productPackages = new ProductPackagesClientImpl(this); + this.productPackageOperations = new ProductPackageOperationsClientImpl(this); + this.productTemplates = new ProductTemplatesClientImpl(this); + this.productTemplateOperations = new ProductTemplateOperationsClientImpl(this); + this.contentTemplates = new ContentTemplatesClientImpl(this); + this.contentTemplateOperations = new ContentTemplateOperationsClientImpl(this); + this.dataConnectorDefinitions = new DataConnectorDefinitionsClientImpl(this); this.dataConnectors = new DataConnectorsClientImpl(this); - this.incidents = new IncidentsClientImpl(this); + this.dataConnectorsCheckRequirementsOperations = new DataConnectorsCheckRequirementsOperationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.entitiesGetTimelines = new EntitiesGetTimelinesClientImpl(this); + this.entitiesRelations = new EntitiesRelationsClientImpl(this); + this.entityRelations = new EntityRelationsClientImpl(this); + this.entityQueries = new EntityQueriesClientImpl(this); + this.entityQueryTemplates = new EntityQueryTemplatesClientImpl(this); + this.fileImports = new FileImportsClientImpl(this); + this.hunts = new HuntsClientImpl(this); + this.huntRelations = new HuntRelationsClientImpl(this); + this.huntComments = new HuntCommentsClientImpl(this); this.incidentComments = new IncidentCommentsClientImpl(this); this.incidentRelations = new IncidentRelationsClientImpl(this); + this.incidentTasks = new IncidentTasksClientImpl(this); + this.metadatas = new MetadatasClientImpl(this); + this.officeConsents = new OfficeConsentsClientImpl(this); this.sentinelOnboardingStates = new SentinelOnboardingStatesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.getRecommendations = new GetRecommendationsClientImpl(this); + this.gets = new GetsClientImpl(this); + this.updates = new UpdatesClientImpl(this); + this.reevaluates = new ReevaluatesClientImpl(this); this.securityMLAnalyticsSettings = new SecurityMLAnalyticsSettingsClientImpl(this); + this.productSettings = new ProductSettingsClientImpl(this); + this.sourceControls = new SourceControlsClientImpl(this); + this.sourceControlsOperations = new SourceControlsOperationsClientImpl(this); this.threatIntelligenceIndicators = new ThreatIntelligenceIndicatorsClientImpl(this); this.threatIntelligenceIndicatorsOperations = new ThreatIntelligenceIndicatorsOperationsClientImpl(this); this.threatIntelligenceIndicatorMetrics = new ThreatIntelligenceIndicatorMetricsClientImpl(this); + this.threatIntelligences = new ThreatIntelligencesClientImpl(this); + this.triggeredAnalyticsRuleRunOperations = new TriggeredAnalyticsRuleRunOperationsClientImpl(this); + this.getTriggeredAnalyticsRuleRuns = new GetTriggeredAnalyticsRuleRunsClientImpl(this); + this.alertRuleOperations = new AlertRuleOperationsClientImpl(this); this.watchlists = new WatchlistsClientImpl(this); this.watchlistItems = new WatchlistItemsClientImpl(this); - this.operations = new OperationsClientImpl(this); + this.workspaceManagerAssignments = new WorkspaceManagerAssignmentsClientImpl(this); + this.workspaceManagerAssignmentJobs = new WorkspaceManagerAssignmentJobsClientImpl(this); + this.workspaceManagerConfigurations = new WorkspaceManagerConfigurationsClientImpl(this); + this.workspaceManagerGroups = new WorkspaceManagerGroupsClientImpl(this); + this.workspaceManagerMembers = new WorkspaceManagerMembersClientImpl(this); } /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SettingsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SettingsImpl.java new file mode 100644 index 000000000000..bc4fd3cc973f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SettingsImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import com.azure.resourcemanager.securityinsights.models.SettingKind; +import com.azure.resourcemanager.securityinsights.models.Settings; + +public final class SettingsImpl implements Settings { + private SettingsInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + SettingsImpl(SettingsInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SettingKind kind() { + return this.innerModel().kind(); + } + + public SettingsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlImpl.java new file mode 100644 index 000000000000..4bf4fb6d064d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RepositoryAccess; +import com.azure.resourcemanager.securityinsights.fluent.models.SourceControlInner; +import com.azure.resourcemanager.securityinsights.models.ContentType; +import com.azure.resourcemanager.securityinsights.models.DeploymentInfo; +import com.azure.resourcemanager.securityinsights.models.PullRequest; +import com.azure.resourcemanager.securityinsights.models.RepoType; +import com.azure.resourcemanager.securityinsights.models.Repository; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; +import com.azure.resourcemanager.securityinsights.models.RepositoryResourceInfo; +import com.azure.resourcemanager.securityinsights.models.ServicePrincipal; +import com.azure.resourcemanager.securityinsights.models.SourceControl; +import com.azure.resourcemanager.securityinsights.models.Version; +import com.azure.resourcemanager.securityinsights.models.Warning; +import java.util.Collections; +import java.util.List; + +public final class SourceControlImpl implements SourceControl, SourceControl.Definition { + private SourceControlInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + SourceControlImpl(SourceControlInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String idPropertiesId() { + return this.innerModel().idPropertiesId(); + } + + public Version version() { + return this.innerModel().version(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public RepoType repoType() { + return this.innerModel().repoType(); + } + + public List contentTypes() { + List inner = this.innerModel().contentTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Repository repository() { + return this.innerModel().repository(); + } + + public ServicePrincipal servicePrincipal() { + return this.innerModel().servicePrincipal(); + } + + public RepositoryAccess repositoryAccess() { + return this.innerModel().repositoryAccess(); + } + + public RepositoryResourceInfo repositoryResourceInfo() { + return this.innerModel().repositoryResourceInfo(); + } + + public DeploymentInfo lastDeploymentInfo() { + return this.innerModel().lastDeploymentInfo(); + } + + public PullRequest pullRequest() { + return this.innerModel().pullRequest(); + } + + public SourceControlInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String sourceControlId; + + public SourceControlImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public SourceControl create() { + this.innerObject = serviceManager.serviceClient() + .getSourceControlsOperations() + .createWithResponse(resourceGroupName, workspaceName, sourceControlId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SourceControl create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSourceControlsOperations() + .createWithResponse(resourceGroupName, workspaceName, sourceControlId, this.innerModel(), context) + .getValue(); + return this; + } + + SourceControlImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new SourceControlInner(); + this.serviceManager = serviceManager; + this.sourceControlId = name; + } + + public SourceControl refresh() { + this.innerObject = serviceManager.serviceClient() + .getSourceControlsOperations() + .getWithResponse(resourceGroupName, workspaceName, sourceControlId, Context.NONE) + .getValue(); + return this; + } + + public SourceControl refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSourceControlsOperations() + .getWithResponse(resourceGroupName, workspaceName, sourceControlId, context) + .getValue(); + return this; + } + + public Response deleteWithResponse(RepositoryAccessProperties repositoryAccess, Context context) { + return serviceManager.sourceControlsOperations() + .deleteWithResponse(resourceGroupName, workspaceName, sourceControlId, repositoryAccess, context); + } + + public Warning delete(RepositoryAccessProperties repositoryAccess) { + return serviceManager.sourceControlsOperations() + .delete(resourceGroupName, workspaceName, sourceControlId, repositoryAccess); + } + + public SourceControlImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public SourceControlImpl withRepoType(RepoType repoType) { + this.innerModel().withRepoType(repoType); + return this; + } + + public SourceControlImpl withContentTypes(List contentTypes) { + this.innerModel().withContentTypes(contentTypes); + return this; + } + + public SourceControlImpl withRepository(Repository repository) { + this.innerModel().withRepository(repository); + return this; + } + + public SourceControlImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public SourceControlImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public SourceControlImpl withServicePrincipal(ServicePrincipal servicePrincipal) { + this.innerModel().withServicePrincipal(servicePrincipal); + return this; + } + + public SourceControlImpl withRepositoryAccess(RepositoryAccess repositoryAccess) { + this.innerModel().withRepositoryAccess(repositoryAccess); + return this; + } + + public SourceControlImpl withRepositoryResourceInfo(RepositoryResourceInfo repositoryResourceInfo) { + this.innerModel().withRepositoryResourceInfo(repositoryResourceInfo); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsClientImpl.java new file mode 100644 index 000000000000..c3f03401e161 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsClientImpl.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.SourceControlsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RepoInner; +import com.azure.resourcemanager.securityinsights.models.RepoList; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SourceControlsClient. + */ +public final class SourceControlsClientImpl implements SourceControlsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SourceControlsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of SourceControlsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SourceControlsClientImpl(SecurityInsightsImpl client) { + this.service + = RestProxy.create(SourceControlsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsSourceControls to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsSour") + public interface SourceControlsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRepositories(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @BodyParam("application/json") RepositoryAccessProperties repositoryAccess, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRepositoriesNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRepositoriesSinglePageAsync(String resourceGroupName, + String workspaceName, RepositoryAccessProperties repositoryAccess) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (repositoryAccess == null) { + return Mono + .error(new IllegalArgumentException("Parameter repositoryAccess is required and cannot be null.")); + } else { + repositoryAccess.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listRepositories(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, repositoryAccess, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRepositoriesSinglePageAsync(String resourceGroupName, + String workspaceName, RepositoryAccessProperties repositoryAccess, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (repositoryAccess == null) { + return Mono + .error(new IllegalArgumentException("Parameter repositoryAccess is required and cannot be null.")); + } else { + repositoryAccess.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRepositories(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, repositoryAccess, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRepositoriesAsync(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess) { + return new PagedFlux<>( + () -> listRepositoriesSinglePageAsync(resourceGroupName, workspaceName, repositoryAccess), + nextLink -> listRepositoriesNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRepositoriesAsync(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess, Context context) { + return new PagedFlux<>( + () -> listRepositoriesSinglePageAsync(resourceGroupName, workspaceName, repositoryAccess, context), + nextLink -> listRepositoriesNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess) { + return new PagedIterable<>(listRepositoriesAsync(resourceGroupName, workspaceName, repositoryAccess)); + } + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess, Context context) { + return new PagedIterable<>(listRepositoriesAsync(resourceGroupName, workspaceName, repositoryAccess, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the source controls along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRepositoriesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listRepositoriesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the source controls along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRepositoriesNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listRepositoriesNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsImpl.java new file mode 100644 index 000000000000..61ac2a70ec3f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.SourceControlsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RepoInner; +import com.azure.resourcemanager.securityinsights.models.Repo; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; +import com.azure.resourcemanager.securityinsights.models.SourceControls; + +public final class SourceControlsImpl implements SourceControls { + private static final ClientLogger LOGGER = new ClientLogger(SourceControlsImpl.class); + + private final SourceControlsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public SourceControlsImpl(SourceControlsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess) { + PagedIterable inner + = this.serviceClient().listRepositories(resourceGroupName, workspaceName, repositoryAccess); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RepoImpl(inner1, this.manager())); + } + + public PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess, Context context) { + PagedIterable inner + = this.serviceClient().listRepositories(resourceGroupName, workspaceName, repositoryAccess, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RepoImpl(inner1, this.manager())); + } + + private SourceControlsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsOperationsClientImpl.java new file mode 100644 index 000000000000..1a92a9e5b411 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsOperationsClientImpl.java @@ -0,0 +1,747 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.SourceControlsOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.SourceControlInner; +import com.azure.resourcemanager.securityinsights.fluent.models.WarningInner; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; +import com.azure.resourcemanager.securityinsights.models.SourceControlList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SourceControlsOperationsClient. + */ +public final class SourceControlsOperationsClientImpl implements SourceControlsOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SourceControlsOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of SourceControlsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SourceControlsOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(SourceControlsOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsSourceControlsOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsSour") + public interface SourceControlsOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("sourceControlId") String sourceControlId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("sourceControlId") String sourceControlId, + @BodyParam("application/json") SourceControlInner sourceControl, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}/delete") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("sourceControlId") String sourceControlId, + @BodyParam("application/json") RepositoryAccessProperties repositoryAccess, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName)); + } + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String sourceControlId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (sourceControlId == null) { + return Mono + .error(new IllegalArgumentException("Parameter sourceControlId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, sourceControlId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String sourceControlId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (sourceControlId == null) { + return Mono + .error(new IllegalArgumentException("Parameter sourceControlId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, sourceControlId, accept, context); + } + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String sourceControlId) { + return getWithResponseAsync(resourceGroupName, workspaceName, sourceControlId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String sourceControlId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, sourceControlId, context).block(); + } + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SourceControlInner get(String resourceGroupName, String workspaceName, String sourceControlId) { + return getWithResponse(resourceGroupName, workspaceName, sourceControlId, Context.NONE).getValue(); + } + + /** + * Creates a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param sourceControl The SourceControl. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SourceControl in Azure Security Insights along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String sourceControlId, SourceControlInner sourceControl) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (sourceControlId == null) { + return Mono + .error(new IllegalArgumentException("Parameter sourceControlId is required and cannot be null.")); + } + if (sourceControl == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceControl is required and cannot be null.")); + } else { + sourceControl.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, sourceControlId, sourceControl, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param sourceControl The SourceControl. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SourceControl in Azure Security Insights along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String sourceControlId, SourceControlInner sourceControl, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (sourceControlId == null) { + return Mono + .error(new IllegalArgumentException("Parameter sourceControlId is required and cannot be null.")); + } + if (sourceControl == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceControl is required and cannot be null.")); + } else { + sourceControl.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, sourceControlId, sourceControl, accept, context); + } + + /** + * Creates a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param sourceControl The SourceControl. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SourceControl in Azure Security Insights on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String workspaceName, String sourceControlId, + SourceControlInner sourceControl) { + return createWithResponseAsync(resourceGroupName, workspaceName, sourceControlId, sourceControl) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param sourceControl The SourceControl. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SourceControl in Azure Security Insights along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String workspaceName, + String sourceControlId, SourceControlInner sourceControl, Context context) { + return createWithResponseAsync(resourceGroupName, workspaceName, sourceControlId, sourceControl, context) + .block(); + } + + /** + * Creates a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param sourceControl The SourceControl. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SourceControl in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SourceControlInner create(String resourceGroupName, String workspaceName, String sourceControlId, + SourceControlInner sourceControl) { + return createWithResponse(resourceGroupName, workspaceName, sourceControlId, sourceControl, Context.NONE) + .getValue(); + } + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String sourceControlId, RepositoryAccessProperties repositoryAccess) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (sourceControlId == null) { + return Mono + .error(new IllegalArgumentException("Parameter sourceControlId is required and cannot be null.")); + } + if (repositoryAccess == null) { + return Mono + .error(new IllegalArgumentException("Parameter repositoryAccess is required and cannot be null.")); + } else { + repositoryAccess.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, sourceControlId, repositoryAccess, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String sourceControlId, RepositoryAccessProperties repositoryAccess, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (sourceControlId == null) { + return Mono + .error(new IllegalArgumentException("Parameter sourceControlId is required and cannot be null.")); + } + if (repositoryAccess == null) { + return Mono + .error(new IllegalArgumentException("Parameter repositoryAccess is required and cannot be null.")); + } else { + repositoryAccess.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, sourceControlId, repositoryAccess, accept, context); + } + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, sourceControlId, repositoryAccess) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String sourceControlId, RepositoryAccessProperties repositoryAccess, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, sourceControlId, repositoryAccess, context) + .block(); + } + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WarningInner delete(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess) { + return deleteWithResponse(resourceGroupName, workspaceName, sourceControlId, repositoryAccess, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the source controls along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the source controls along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsOperationsImpl.java new file mode 100644 index 000000000000..841d14498402 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SourceControlsOperationsImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.SourceControlsOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.SourceControlInner; +import com.azure.resourcemanager.securityinsights.fluent.models.WarningInner; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; +import com.azure.resourcemanager.securityinsights.models.SourceControl; +import com.azure.resourcemanager.securityinsights.models.SourceControlsOperations; +import com.azure.resourcemanager.securityinsights.models.Warning; + +public final class SourceControlsOperationsImpl implements SourceControlsOperations { + private static final ClientLogger LOGGER = new ClientLogger(SourceControlsOperationsImpl.class); + + private final SourceControlsOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public SourceControlsOperationsImpl(SourceControlsOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SourceControlImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SourceControlImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String sourceControlId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, sourceControlId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SourceControlImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SourceControl get(String resourceGroupName, String workspaceName, String sourceControlId) { + SourceControlInner inner = this.serviceClient().get(resourceGroupName, workspaceName, sourceControlId); + if (inner != null) { + return new SourceControlImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess, Context context) { + Response inner = this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, sourceControlId, repositoryAccess, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WarningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Warning delete(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess) { + WarningInner inner + = this.serviceClient().delete(resourceGroupName, workspaceName, sourceControlId, repositoryAccess); + if (inner != null) { + return new WarningImpl(inner, this.manager()); + } else { + return null; + } + } + + public SourceControl getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String sourceControlId = ResourceManagerUtils.getValueFromIdByName(id, "sourcecontrols"); + if (sourceControlId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sourcecontrols'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, sourceControlId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String sourceControlId = ResourceManagerUtils.getValueFromIdByName(id, "sourcecontrols"); + if (sourceControlId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sourcecontrols'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, sourceControlId, context); + } + + private SourceControlsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public SourceControlImpl define(String name) { + return new SourceControlImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemResourceImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemResourceImpl.java new file mode 100644 index 000000000000..87c2e3b0b383 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemResourceImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.SystemResourceInner; +import com.azure.resourcemanager.securityinsights.models.Action; +import com.azure.resourcemanager.securityinsights.models.ReportActionStatusPayload; +import com.azure.resourcemanager.securityinsights.models.SystemResource; +import com.azure.resourcemanager.securityinsights.models.SystemStatusType; +import com.azure.resourcemanager.securityinsights.models.SystemsConfiguration; +import com.azure.resourcemanager.securityinsights.models.UndoActionPayload; +import java.time.OffsetDateTime; + +public final class SystemResourceImpl implements SystemResource, SystemResource.Definition, SystemResource.Update { + private SystemResourceInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SystemStatusType status() { + return this.innerModel().status(); + } + + public SystemsConfiguration configuration() { + return this.innerModel().configuration(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerModel().lastModifiedTimeUtc(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SystemResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String agentResourceName; + + private String systemResourceName; + + public SystemResourceImpl withExistingBusinessApplicationAgent(String resourceGroupName, String workspaceName, + String agentResourceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + this.agentResourceName = agentResourceName; + return this; + } + + public SystemResource create() { + this.innerObject = serviceManager.serviceClient() + .getSystems() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SystemResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSystems() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + this.innerModel(), context) + .getValue(); + return this; + } + + SystemResourceImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new SystemResourceInner(); + this.serviceManager = serviceManager; + this.systemResourceName = name; + } + + public SystemResourceImpl update() { + return this; + } + + public SystemResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSystems() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SystemResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSystems() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + this.innerModel(), context) + .getValue(); + return this; + } + + SystemResourceImpl(SystemResourceInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.agentResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "businessApplicationAgents"); + this.systemResourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "systems"); + } + + public SystemResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSystems() + .getWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, Context.NONE) + .getValue(); + return this; + } + + public SystemResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSystems() + .getWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context) + .getValue(); + return this; + } + + public PagedIterable listActions() { + return serviceManager.systems() + .listActions(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + } + + public PagedIterable listActions(Context context) { + return serviceManager.systems() + .listActions(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context); + } + + public Response undoActionWithResponse(UndoActionPayload payload, Context context) { + return serviceManager.systems() + .undoActionWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, payload, + context); + } + + public void undoAction() { + serviceManager.systems().undoAction(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + } + + public Response reportActionStatusWithResponse(ReportActionStatusPayload payload, Context context) { + return serviceManager.systems() + .reportActionStatusWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + payload, context); + } + + public void reportActionStatus() { + serviceManager.systems() + .reportActionStatus(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + } + + public SystemResourceImpl withConfiguration(SystemsConfiguration configuration) { + this.innerModel().withConfiguration(configuration); + return this; + } + + public SystemResourceImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public SystemResourceImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public SystemResourceImpl withStatus(SystemStatusType status) { + this.innerModel().withStatus(status); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemsClientImpl.java new file mode 100644 index 000000000000..b07134295fac --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemsClientImpl.java @@ -0,0 +1,1433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.SystemsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; +import com.azure.resourcemanager.securityinsights.fluent.models.SystemResourceInner; +import com.azure.resourcemanager.securityinsights.models.ListActionsResponse; +import com.azure.resourcemanager.securityinsights.models.ReportActionStatusPayload; +import com.azure.resourcemanager.securityinsights.models.SystemsList; +import com.azure.resourcemanager.securityinsights.models.UndoActionPayload; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SystemsClient. + */ +public final class SystemsClientImpl implements SystemsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SystemsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of SystemsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SystemsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(SystemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsSystems to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsSyst") + public interface SystemsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}/systems/{systemResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, + @PathParam("systemResourceName") String systemResourceName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SystemResourceInner systemToUpsert, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}/systems/{systemResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, + @PathParam("systemResourceName") String systemResourceName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}/systems/{systemResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, + @PathParam("systemResourceName") String systemResourceName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}/systems") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}/systems/{systemResourceName}/listActions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listActions(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, + @PathParam("systemResourceName") String systemResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}/systems/{systemResourceName}/undoAction") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> undoAction(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, + @PathParam("systemResourceName") String systemResourceName, + @BodyParam("application/json") UndoActionPayload payload, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/businessApplicationAgents/{agentResourceName}/systems/{systemResourceName}/reportActionStatus") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> reportActionStatus(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("agentResourceName") String agentResourceName, + @PathParam("systemResourceName") String systemResourceName, + @BodyParam("application/json") ReportActionStatusPayload payload, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listActionsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Creates or updates the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param systemToUpsert The system to upsert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the system within the agent along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String agentResourceName, String systemResourceName, SystemResourceInner systemToUpsert) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + if (systemToUpsert != null) { + systemToUpsert.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, agentResourceName, systemResourceName, this.client.getApiVersion(), + systemToUpsert, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param systemToUpsert The system to upsert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the system within the agent along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String agentResourceName, String systemResourceName, SystemResourceInner systemToUpsert, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + if (systemToUpsert != null) { + systemToUpsert.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, agentResourceName, systemResourceName, this.client.getApiVersion(), systemToUpsert, accept, + context); + } + + /** + * Creates or updates the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the system within the agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName) { + final SystemResourceInner systemToUpsert = null; + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + systemToUpsert).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param systemToUpsert The system to upsert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the system within the agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, SystemResourceInner systemToUpsert, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + systemToUpsert, context).block(); + } + + /** + * Creates or updates the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the system within the agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SystemResourceInner createOrUpdate(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + final SystemResourceInner systemToUpsert = null; + return createOrUpdateWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + systemToUpsert, Context.NONE).getValue(); + } + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, agentResourceName, systemResourceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + agentResourceName, systemResourceName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + return getWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context) + .block(); + } + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SystemResourceInner get(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + return getWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, Context.NONE) + .getValue(); + } + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, agentResourceName, systemResourceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, agentResourceName, systemResourceName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context) + .block(); + } + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, Context.NONE); + } + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String filter, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + workspaceName, agentResourceName, this.client.getApiVersion(), filter, skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String filter, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + agentResourceName, this.client.getApiVersion(), filter, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String filter, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, agentResourceName, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String agentResourceName) { + final String filter = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, agentResourceName, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String filter, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, agentResourceName, filter, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String agentResourceName) { + final String filter = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, agentResourceName, filter, skipToken)); + } + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String agentResourceName, String filter, String skipToken, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, agentResourceName, filter, skipToken, context)); + } + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listActionsSinglePageAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listActions(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, agentResourceName, + systemResourceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listActionsSinglePageAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listActions(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, agentResourceName, systemResourceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listActionsAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName) { + return new PagedFlux<>( + () -> listActionsSinglePageAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName), + nextLink -> listActionsNextSinglePageAsync(nextLink)); + } + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listActionsAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context) { + return new PagedFlux<>(() -> listActionsSinglePageAsync(resourceGroupName, workspaceName, agentResourceName, + systemResourceName, context), nextLink -> listActionsNextSinglePageAsync(nextLink, context)); + } + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listActions(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName) { + return new PagedIterable<>( + listActionsAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName)); + } + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listActions(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context) { + return new PagedIterable<>( + listActionsAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context)); + } + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Undo action, based on the actionId. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> undoActionWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, UndoActionPayload payload) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + if (payload != null) { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.undoAction(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, agentResourceName, + systemResourceName, payload, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Undo action, based on the actionId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> undoActionWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, UndoActionPayload payload, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + if (payload != null) { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.undoAction(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, agentResourceName, systemResourceName, + payload, accept, context); + } + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono undoActionAsync(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + final UndoActionPayload payload = null; + return undoActionWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + payload).flatMap(ignored -> Mono.empty()); + } + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Undo action, based on the actionId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response undoActionWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, UndoActionPayload payload, Context context) { + return undoActionWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + payload, context).block(); + } + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void undoAction(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + final UndoActionPayload payload = null; + undoActionWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, payload, + Context.NONE); + } + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Report a status of the action that was performed by the agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> reportActionStatusWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, ReportActionStatusPayload payload) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + if (payload != null) { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.reportActionStatus(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, agentResourceName, + systemResourceName, payload, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Report a status of the action that was performed by the agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> reportActionStatusWithResponseAsync(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, ReportActionStatusPayload payload, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (agentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter agentResourceName is required and cannot be null.")); + } + if (systemResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter systemResourceName is required and cannot be null.")); + } + if (payload != null) { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.reportActionStatus(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, agentResourceName, systemResourceName, + payload, accept, context); + } + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono reportActionStatusAsync(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + final ReportActionStatusPayload payload = null; + return reportActionStatusWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, + systemResourceName, payload).flatMap(ignored -> Mono.empty()); + } + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Report a status of the action that was performed by the agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response reportActionStatusWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, ReportActionStatusPayload payload, Context context) { + return reportActionStatusWithResponseAsync(resourceGroupName, workspaceName, agentResourceName, + systemResourceName, payload, context).block(); + } + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void reportActionStatus(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + final ReportActionStatusPayload payload = null; + reportActionStatusWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, payload, + Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listActionsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listActionsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listActionsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listActionsNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemsImpl.java new file mode 100644 index 000000000000..169ce74a33eb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/SystemsImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.SystemsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; +import com.azure.resourcemanager.securityinsights.fluent.models.SystemResourceInner; +import com.azure.resourcemanager.securityinsights.models.Action; +import com.azure.resourcemanager.securityinsights.models.ReportActionStatusPayload; +import com.azure.resourcemanager.securityinsights.models.SystemResource; +import com.azure.resourcemanager.securityinsights.models.Systems; +import com.azure.resourcemanager.securityinsights.models.UndoActionPayload; + +public final class SystemsImpl implements Systems { + private static final ClientLogger LOGGER = new ClientLogger(SystemsImpl.class); + + private final SystemsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public SystemsImpl(SystemsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SystemResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SystemResource get(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + SystemResourceInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + if (inner != null) { + return new SystemResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + this.serviceClient().delete(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + String agentResourceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, agentResourceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SystemResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String agentResourceName, + String filter, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, agentResourceName, filter, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SystemResourceImpl(inner1, this.manager())); + } + + public PagedIterable listActions(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + PagedIterable inner + = this.serviceClient().listActions(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ActionImpl(inner1, this.manager())); + } + + public PagedIterable listActions(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context) { + PagedIterable inner = this.serviceClient() + .listActions(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ActionImpl(inner1, this.manager())); + } + + public Response undoActionWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, UndoActionPayload payload, Context context) { + return this.serviceClient() + .undoActionWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, payload, + context); + } + + public void undoAction(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + this.serviceClient().undoAction(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + } + + public Response reportActionStatusWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, ReportActionStatusPayload payload, Context context) { + return this.serviceClient() + .reportActionStatusWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + payload, context); + } + + public void reportActionStatus(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName) { + this.serviceClient() + .reportActionStatus(resourceGroupName, workspaceName, agentResourceName, systemResourceName); + } + + public SystemResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String agentResourceName = ResourceManagerUtils.getValueFromIdByName(id, "businessApplicationAgents"); + if (agentResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'businessApplicationAgents'.", id))); + } + String systemResourceName = ResourceManagerUtils.getValueFromIdByName(id, "systems"); + if (systemResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'systems'.", id))); + } + return this + .getWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String agentResourceName = ResourceManagerUtils.getValueFromIdByName(id, "businessApplicationAgents"); + if (agentResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'businessApplicationAgents'.", id))); + } + String systemResourceName = ResourceManagerUtils.getValueFromIdByName(id, "systems"); + if (systemResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'systems'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String agentResourceName = ResourceManagerUtils.getValueFromIdByName(id, "businessApplicationAgents"); + if (agentResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'businessApplicationAgents'.", id))); + } + String systemResourceName = ResourceManagerUtils.getValueFromIdByName(id, "systems"); + if (systemResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'systems'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String agentResourceName = ResourceManagerUtils.getValueFromIdByName(id, "businessApplicationAgents"); + if (agentResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'businessApplicationAgents'.", id))); + } + String systemResourceName = ResourceManagerUtils.getValueFromIdByName(id, "systems"); + if (systemResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'systems'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, agentResourceName, systemResourceName, + context); + } + + private SystemsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public SystemResourceImpl define(String name) { + return new SystemResourceImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TIObjectImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TIObjectImpl.java new file mode 100644 index 000000000000..d752ab8383e1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TIObjectImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import com.azure.resourcemanager.securityinsights.models.RelationshipHint; +import com.azure.resourcemanager.securityinsights.models.TIObject; +import com.azure.resourcemanager.securityinsights.models.TIObjectKind; +import com.azure.resourcemanager.securityinsights.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public final class TIObjectImpl implements TIObject { + private TIObjectInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + TIObjectImpl(TIObjectInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public TIObjectKind kind() { + return this.innerModel().kind(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Map data() { + Map inner = this.innerModel().data(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public UserInfo createdBy() { + return this.innerModel().createdBy(); + } + + public String source() { + return this.innerModel().source(); + } + + public OffsetDateTime firstIngestedTimeUtc() { + return this.innerModel().firstIngestedTimeUtc(); + } + + public OffsetDateTime lastIngestedTimeUtc() { + return this.innerModel().lastIngestedTimeUtc(); + } + + public UUID ingestionRulesVersion() { + return this.innerModel().ingestionRulesVersion(); + } + + public String lastUpdateMethod() { + return this.innerModel().lastUpdateMethod(); + } + + public UserInfo lastModifiedBy() { + return this.innerModel().lastModifiedBy(); + } + + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.innerModel().lastUpdatedDateTimeUtc(); + } + + public List relationshipHints() { + List inner = this.innerModel().relationshipHints(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TIObjectInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TemplateModelImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TemplateModelImpl.java new file mode 100644 index 000000000000..0915520eafab --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TemplateModelImpl.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateProperties; +import com.azure.resourcemanager.securityinsights.models.Flag; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.TemplateModel; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; + +public final class TemplateModelImpl implements TemplateModel, TemplateModel.Definition, TemplateModel.Update { + private TemplateModelInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Object mainTemplate() { + return this.innerModel().mainTemplate(); + } + + public List dependantTemplates() { + List inner = this.innerModel().dependantTemplates(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String contentId() { + return this.innerModel().contentId(); + } + + public String contentProductId() { + return this.innerModel().contentProductId(); + } + + public String packageVersion() { + return this.innerModel().packageVersion(); + } + + public String version() { + return this.innerModel().version(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Kind contentKind() { + return this.innerModel().contentKind(); + } + + public MetadataSource source() { + return this.innerModel().source(); + } + + public MetadataAuthor author() { + return this.innerModel().author(); + } + + public MetadataSupport support() { + return this.innerModel().support(); + } + + public MetadataDependencies dependencies() { + return this.innerModel().dependencies(); + } + + public MetadataCategories categories() { + return this.innerModel().categories(); + } + + public List providers() { + List inner = this.innerModel().providers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public LocalDate firstPublishDate() { + return this.innerModel().firstPublishDate(); + } + + public LocalDate lastPublishDate() { + return this.innerModel().lastPublishDate(); + } + + public String customVersion() { + return this.innerModel().customVersion(); + } + + public String contentSchemaVersion() { + return this.innerModel().contentSchemaVersion(); + } + + public String icon() { + return this.innerModel().icon(); + } + + public List threatAnalysisTactics() { + List inner = this.innerModel().threatAnalysisTactics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List threatAnalysisTechniques() { + List inner = this.innerModel().threatAnalysisTechniques(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List previewImages() { + List inner = this.innerModel().previewImages(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List previewImagesDark() { + List inner = this.innerModel().previewImagesDark(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String packageId() { + return this.innerModel().packageId(); + } + + public PackageKind packageKind() { + return this.innerModel().packageKind(); + } + + public String packageName() { + return this.innerModel().packageName(); + } + + public Flag isDeprecated() { + return this.innerModel().isDeprecated(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TemplateModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String templateId; + + public TemplateModelImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public TemplateModel create() { + this.innerObject = serviceManager.serviceClient() + .getContentTemplateOperations() + .installWithResponse(resourceGroupName, workspaceName, templateId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public TemplateModel create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getContentTemplateOperations() + .installWithResponse(resourceGroupName, workspaceName, templateId, this.innerModel(), context) + .getValue(); + return this; + } + + TemplateModelImpl(String name, com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new TemplateModelInner(); + this.serviceManager = serviceManager; + this.templateId = name; + } + + public TemplateModelImpl update() { + return this; + } + + public TemplateModel apply() { + this.innerObject = serviceManager.serviceClient() + .getContentTemplateOperations() + .installWithResponse(resourceGroupName, workspaceName, templateId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public TemplateModel apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getContentTemplateOperations() + .installWithResponse(resourceGroupName, workspaceName, templateId, this.innerModel(), context) + .getValue(); + return this; + } + + TemplateModelImpl(TemplateModelInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.templateId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "contentTemplates"); + } + + public TemplateModel refresh() { + this.innerObject = serviceManager.serviceClient() + .getContentTemplateOperations() + .getWithResponse(resourceGroupName, workspaceName, templateId, Context.NONE) + .getValue(); + return this; + } + + public TemplateModel refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getContentTemplateOperations() + .getWithResponse(resourceGroupName, workspaceName, templateId, context) + .getValue(); + return this; + } + + public TemplateModelImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public TemplateModelImpl withMainTemplate(Object mainTemplate) { + this.innerModel().withMainTemplate(mainTemplate); + return this; + } + + public TemplateModelImpl withContentId(String contentId) { + this.innerModel().withContentId(contentId); + return this; + } + + public TemplateModelImpl withContentProductId(String contentProductId) { + this.innerModel().withContentProductId(contentProductId); + return this; + } + + public TemplateModelImpl withPackageVersion(String packageVersion) { + this.innerModel().withPackageVersion(packageVersion); + return this; + } + + public TemplateModelImpl withVersion(String version) { + this.innerModel().withVersion(version); + return this; + } + + public TemplateModelImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public TemplateModelImpl withContentKind(Kind contentKind) { + this.innerModel().withContentKind(contentKind); + return this; + } + + public TemplateModelImpl withSource(MetadataSource source) { + this.innerModel().withSource(source); + return this; + } + + public TemplateModelImpl withAuthor(MetadataAuthor author) { + this.innerModel().withAuthor(author); + return this; + } + + public TemplateModelImpl withSupport(MetadataSupport support) { + this.innerModel().withSupport(support); + return this; + } + + public TemplateModelImpl withDependencies(MetadataDependencies dependencies) { + this.innerModel().withDependencies(dependencies); + return this; + } + + public TemplateModelImpl withCategories(MetadataCategories categories) { + this.innerModel().withCategories(categories); + return this; + } + + public TemplateModelImpl withProviders(List providers) { + this.innerModel().withProviders(providers); + return this; + } + + public TemplateModelImpl withFirstPublishDate(LocalDate firstPublishDate) { + this.innerModel().withFirstPublishDate(firstPublishDate); + return this; + } + + public TemplateModelImpl withLastPublishDate(LocalDate lastPublishDate) { + this.innerModel().withLastPublishDate(lastPublishDate); + return this; + } + + public TemplateModelImpl withCustomVersion(String customVersion) { + this.innerModel().withCustomVersion(customVersion); + return this; + } + + public TemplateModelImpl withContentSchemaVersion(String contentSchemaVersion) { + this.innerModel().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + public TemplateModelImpl withIcon(String icon) { + this.innerModel().withIcon(icon); + return this; + } + + public TemplateModelImpl withThreatAnalysisTactics(List threatAnalysisTactics) { + this.innerModel().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + public TemplateModelImpl withThreatAnalysisTechniques(List threatAnalysisTechniques) { + this.innerModel().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + public TemplateModelImpl withPreviewImages(List previewImages) { + this.innerModel().withPreviewImages(previewImages); + return this; + } + + public TemplateModelImpl withPreviewImagesDark(List previewImagesDark) { + this.innerModel().withPreviewImagesDark(previewImagesDark); + return this; + } + + public TemplateModelImpl withPackageId(String packageId) { + this.innerModel().withPackageId(packageId); + return this; + } + + public TemplateModelImpl withPackageKind(PackageKind packageKind) { + this.innerModel().withPackageKind(packageKind); + return this; + } + + public TemplateModelImpl withPackageName(String packageName) { + this.innerModel().withPackageName(packageName); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligenceCountImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligenceCountImpl.java new file mode 100644 index 000000000000..51d2b73e67f6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligenceCountImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceCountInner; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceCount; + +public final class ThreatIntelligenceCountImpl implements ThreatIntelligenceCount { + private ThreatIntelligenceCountInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + ThreatIntelligenceCountImpl(ThreatIntelligenceCountInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public int count() { + return this.innerModel().count(); + } + + public ThreatIntelligenceCountInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligencesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligencesClientImpl.java new file mode 100644 index 000000000000..4589f8d78608 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligencesClientImpl.java @@ -0,0 +1,480 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.ThreatIntelligencesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceCountInner; +import com.azure.resourcemanager.securityinsights.models.CountQuery; +import com.azure.resourcemanager.securityinsights.models.Query; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceList; +import com.azure.resourcemanager.securityinsights.models.TiType; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ThreatIntelligencesClient. + */ +public final class ThreatIntelligencesClientImpl implements ThreatIntelligencesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ThreatIntelligencesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of ThreatIntelligencesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ThreatIntelligencesClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(ThreatIntelligencesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsThreatIntelligences to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsThre") + public interface ThreatIntelligencesService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/{tiType}/count") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> count(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("tiType") TiType tiType, @BodyParam("application/json") CountQuery query, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/{tiType}/query") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> query(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("tiType") TiType tiType, @BodyParam("application/json") Query query, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> queryNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countWithResponseAsync(String resourceGroupName, + String workspaceName, TiType tiType, CountQuery query) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tiType == null) { + return Mono.error(new IllegalArgumentException("Parameter tiType is required and cannot be null.")); + } + if (query != null) { + query.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.count(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, tiType, query, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countWithResponseAsync(String resourceGroupName, + String workspaceName, TiType tiType, CountQuery query, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tiType == null) { + return Mono.error(new IllegalArgumentException("Parameter tiType is required and cannot be null.")); + } + if (query != null) { + query.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.count(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, tiType, query, accept, context); + } + + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono countAsync(String resourceGroupName, String workspaceName, + TiType tiType) { + final CountQuery query = null; + return countWithResponseAsync(resourceGroupName, workspaceName, tiType, query) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response countWithResponse(String resourceGroupName, String workspaceName, + TiType tiType, CountQuery query, Context context) { + return countWithResponseAsync(resourceGroupName, workspaceName, tiType, query, context).block(); + } + + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ThreatIntelligenceCountInner count(String resourceGroupName, String workspaceName, TiType tiType) { + final CountQuery query = null; + return countWithResponse(resourceGroupName, workspaceName, tiType, query, Context.NONE).getValue(); + } + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> querySinglePageAsync(String resourceGroupName, String workspaceName, + TiType tiType, Query query) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tiType == null) { + return Mono.error(new IllegalArgumentException("Parameter tiType is required and cannot be null.")); + } + if (query != null) { + query.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.query(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, tiType, query, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> querySinglePageAsync(String resourceGroupName, String workspaceName, + TiType tiType, Query query, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (tiType == null) { + return Mono.error(new IllegalArgumentException("Parameter tiType is required and cannot be null.")); + } + if (query != null) { + query.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .query(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, tiType, query, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux queryAsync(String resourceGroupName, String workspaceName, TiType tiType, + Query query) { + return new PagedFlux<>(() -> querySinglePageAsync(resourceGroupName, workspaceName, tiType, query), + nextLink -> queryNextSinglePageAsync(nextLink)); + } + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux queryAsync(String resourceGroupName, String workspaceName, TiType tiType) { + final Query query = null; + return new PagedFlux<>(() -> querySinglePageAsync(resourceGroupName, workspaceName, tiType, query), + nextLink -> queryNextSinglePageAsync(nextLink)); + } + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux queryAsync(String resourceGroupName, String workspaceName, TiType tiType, + Query query, Context context) { + return new PagedFlux<>(() -> querySinglePageAsync(resourceGroupName, workspaceName, tiType, query, context), + nextLink -> queryNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType) { + final Query query = null; + return new PagedIterable<>(queryAsync(resourceGroupName, workspaceName, tiType, query)); + } + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType, + Query query, Context context) { + return new PagedIterable<>(queryAsync(resourceGroupName, workspaceName, tiType, query, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the threat intelligence objects on the workspace that match the provided query along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> queryNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.queryNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the threat intelligence objects on the workspace that match the provided query along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> queryNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.queryNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligencesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligencesImpl.java new file mode 100644 index 000000000000..e7d7f435a859 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/ThreatIntelligencesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.ThreatIntelligencesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceCountInner; +import com.azure.resourcemanager.securityinsights.models.CountQuery; +import com.azure.resourcemanager.securityinsights.models.Query; +import com.azure.resourcemanager.securityinsights.models.TIObject; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceCount; +import com.azure.resourcemanager.securityinsights.models.ThreatIntelligences; +import com.azure.resourcemanager.securityinsights.models.TiType; + +public final class ThreatIntelligencesImpl implements ThreatIntelligences { + private static final ClientLogger LOGGER = new ClientLogger(ThreatIntelligencesImpl.class); + + private final ThreatIntelligencesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public ThreatIntelligencesImpl(ThreatIntelligencesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response countWithResponse(String resourceGroupName, String workspaceName, + TiType tiType, CountQuery query, Context context) { + Response inner + = this.serviceClient().countWithResponse(resourceGroupName, workspaceName, tiType, query, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ThreatIntelligenceCountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ThreatIntelligenceCount count(String resourceGroupName, String workspaceName, TiType tiType) { + ThreatIntelligenceCountInner inner = this.serviceClient().count(resourceGroupName, workspaceName, tiType); + if (inner != null) { + return new ThreatIntelligenceCountImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType) { + PagedIterable inner = this.serviceClient().query(resourceGroupName, workspaceName, tiType); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TIObjectImpl(inner1, this.manager())); + } + + public PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType, Query query, + Context context) { + PagedIterable inner + = this.serviceClient().query(resourceGroupName, workspaceName, tiType, query, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TIObjectImpl(inner1, this.manager())); + } + + private ThreatIntelligencesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunImpl.java new file mode 100644 index 000000000000..63ed17ed336c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import com.azure.resourcemanager.securityinsights.models.TriggeredAnalyticsRuleRun; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class TriggeredAnalyticsRuleRunImpl implements TriggeredAnalyticsRuleRun { + private TriggeredAnalyticsRuleRunInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + TriggeredAnalyticsRuleRunImpl(TriggeredAnalyticsRuleRunInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public OffsetDateTime executionTimeUtc() { + return this.innerModel().executionTimeUtc(); + } + + public String ruleId() { + return this.innerModel().ruleId(); + } + + public String triggeredAnalyticsRuleRunId() { + return this.innerModel().triggeredAnalyticsRuleRunId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Map ruleRunAdditionalData() { + Map inner = this.innerModel().ruleRunAdditionalData(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TriggeredAnalyticsRuleRunInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunOperationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunOperationsClientImpl.java new file mode 100644 index 000000000000..a76a2039799f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunOperationsClientImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.TriggeredAnalyticsRuleRunOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TriggeredAnalyticsRuleRunOperationsClient. + */ +public final class TriggeredAnalyticsRuleRunOperationsClientImpl implements TriggeredAnalyticsRuleRunOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final TriggeredAnalyticsRuleRunOperationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of TriggeredAnalyticsRuleRunOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TriggeredAnalyticsRuleRunOperationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(TriggeredAnalyticsRuleRunOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsTriggeredAnalyticsRuleRunOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsTrig") + public interface TriggeredAnalyticsRuleRunOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/triggeredAnalyticsRuleRuns/{ruleRunId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("ruleRunId") String ruleRunId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String ruleRunId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (ruleRunId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleRunId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, ruleRunId, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String ruleRunId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (ruleRunId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleRunId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, + ruleRunId, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String ruleRunId) { + return getWithResponseAsync(resourceGroupName, workspaceName, ruleRunId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String ruleRunId, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, ruleRunId, context).block(); + } + + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TriggeredAnalyticsRuleRunInner get(String resourceGroupName, String workspaceName, String ruleRunId) { + return getWithResponse(resourceGroupName, workspaceName, ruleRunId, Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunOperationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunOperationsImpl.java new file mode 100644 index 000000000000..f9f0e988dd44 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/TriggeredAnalyticsRuleRunOperationsImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.TriggeredAnalyticsRuleRunOperationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; +import com.azure.resourcemanager.securityinsights.models.TriggeredAnalyticsRuleRun; +import com.azure.resourcemanager.securityinsights.models.TriggeredAnalyticsRuleRunOperations; + +public final class TriggeredAnalyticsRuleRunOperationsImpl implements TriggeredAnalyticsRuleRunOperations { + private static final ClientLogger LOGGER = new ClientLogger(TriggeredAnalyticsRuleRunOperationsImpl.class); + + private final TriggeredAnalyticsRuleRunOperationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public TriggeredAnalyticsRuleRunOperationsImpl(TriggeredAnalyticsRuleRunOperationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String ruleRunId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, ruleRunId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TriggeredAnalyticsRuleRunImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TriggeredAnalyticsRuleRun get(String resourceGroupName, String workspaceName, String ruleRunId) { + TriggeredAnalyticsRuleRunInner inner = this.serviceClient().get(resourceGroupName, workspaceName, ruleRunId); + if (inner != null) { + return new TriggeredAnalyticsRuleRunImpl(inner, this.manager()); + } else { + return null; + } + } + + private TriggeredAnalyticsRuleRunOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/UpdatesClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/UpdatesClientImpl.java new file mode 100644 index 000000000000..fa60b882f6ee --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/UpdatesClientImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.UpdatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import com.azure.resourcemanager.securityinsights.models.RecommendationPatch; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UpdatesClient. + */ +public final class UpdatesClientImpl implements UpdatesClient { + /** + * The proxy service used to perform REST calls. + */ + private final UpdatesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of UpdatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UpdatesClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(UpdatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsUpdates to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsUpda") + public interface UpdatesService { + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> recommendation(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("recommendationId") UUID recommendationId, + @BodyParam("application/json") RecommendationPatch recommendationPatch, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> recommendationWithResponseAsync(String resourceGroupName, + String workspaceName, UUID recommendationId, RecommendationPatch recommendationPatch) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (recommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); + } + if (recommendationPatch == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationPatch is required and cannot be null.")); + } else { + recommendationPatch.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.recommendation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, recommendationId, + recommendationPatch, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> recommendationWithResponseAsync(String resourceGroupName, + String workspaceName, UUID recommendationId, RecommendationPatch recommendationPatch, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (recommendationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); + } + if (recommendationPatch == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendationPatch is required and cannot be null.")); + } else { + recommendationPatch.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.recommendation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, recommendationId, recommendationPatch, + accept, context); + } + + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono recommendationAsync(String resourceGroupName, String workspaceName, + UUID recommendationId, RecommendationPatch recommendationPatch) { + return recommendationWithResponseAsync(resourceGroupName, workspaceName, recommendationId, recommendationPatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, RecommendationPatch recommendationPatch, Context context) { + return recommendationWithResponseAsync(resourceGroupName, workspaceName, recommendationId, recommendationPatch, + context).block(); + } + + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendationInner recommendation(String resourceGroupName, String workspaceName, UUID recommendationId, + RecommendationPatch recommendationPatch) { + return recommendationWithResponse(resourceGroupName, workspaceName, recommendationId, recommendationPatch, + Context.NONE).getValue(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/UpdatesImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/UpdatesImpl.java new file mode 100644 index 000000000000..f0111f561d12 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/UpdatesImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.UpdatesClient; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import com.azure.resourcemanager.securityinsights.models.Recommendation; +import com.azure.resourcemanager.securityinsights.models.RecommendationPatch; +import com.azure.resourcemanager.securityinsights.models.Updates; +import java.util.UUID; + +public final class UpdatesImpl implements Updates { + private static final ClientLogger LOGGER = new ClientLogger(UpdatesImpl.class); + + private final UpdatesClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public UpdatesImpl(UpdatesClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, RecommendationPatch recommendationPatch, Context context) { + Response inner = this.serviceClient() + .recommendationWithResponse(resourceGroupName, workspaceName, recommendationId, recommendationPatch, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RecommendationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Recommendation recommendation(String resourceGroupName, String workspaceName, UUID recommendationId, + RecommendationPatch recommendationPatch) { + RecommendationInner inner = this.serviceClient() + .recommendation(resourceGroupName, workspaceName, recommendationId, recommendationPatch); + if (inner != null) { + return new RecommendationImpl(inner, this.manager()); + } else { + return null; + } + } + + private UpdatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WarningImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WarningImpl.java new file mode 100644 index 000000000000..f340b57b9a36 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WarningImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.resourcemanager.securityinsights.fluent.models.WarningInner; +import com.azure.resourcemanager.securityinsights.models.Warning; +import com.azure.resourcemanager.securityinsights.models.WarningBody; + +public final class WarningImpl implements Warning { + private WarningInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + WarningImpl(WarningInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public WarningBody warning() { + return this.innerModel().warning(); + } + + public WarningInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistImpl.java index 20323d728268..c8f1e9c38b98 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistImpl.java @@ -7,7 +7,8 @@ import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.securityinsights.fluent.models.WatchlistInner; -import com.azure.resourcemanager.securityinsights.models.Source; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import com.azure.resourcemanager.securityinsights.models.SourceType; import com.azure.resourcemanager.securityinsights.models.UserInfo; import com.azure.resourcemanager.securityinsights.models.Watchlist; import java.time.Duration; @@ -52,10 +53,14 @@ public String provider() { return this.innerModel().provider(); } - public Source source() { + public String source() { return this.innerModel().source(); } + public SourceType sourceType() { + return this.innerModel().sourceType(); + } + public OffsetDateTime created() { return this.innerModel().created(); } @@ -125,6 +130,10 @@ public String uploadStatus() { return this.innerModel().uploadStatus(); } + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + public String resourceGroupName() { return resourceGroupName; } @@ -152,17 +161,14 @@ public WatchlistImpl withExistingWorkspace(String resourceGroupName, String work public Watchlist create() { this.innerObject = serviceManager.serviceClient() .getWatchlists() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), - Context.NONE) - .getValue(); + .createOrUpdate(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), Context.NONE); return this; } public Watchlist create(Context context) { this.innerObject = serviceManager.serviceClient() .getWatchlists() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), context) - .getValue(); + .createOrUpdate(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), context); return this; } @@ -179,17 +185,14 @@ public WatchlistImpl update() { public Watchlist apply() { this.innerObject = serviceManager.serviceClient() .getWatchlists() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), - Context.NONE) - .getValue(); + .createOrUpdate(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), Context.NONE); return this; } public Watchlist apply(Context context) { this.innerObject = serviceManager.serviceClient() .getWatchlists() - .createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), context) - .getValue(); + .createOrUpdate(resourceGroupName, workspaceName, watchlistAlias, this.innerModel(), context); return this; } @@ -238,11 +241,16 @@ public WatchlistImpl withProvider(String provider) { return this; } - public WatchlistImpl withSource(Source source) { + public WatchlistImpl withSource(String source) { this.innerModel().withSource(source); return this; } + public WatchlistImpl withSourceType(SourceType sourceType) { + this.innerModel().withSourceType(sourceType); + return this; + } + public WatchlistImpl withCreated(OffsetDateTime created) { this.innerModel().withCreated(created); return this; @@ -322,4 +330,9 @@ public WatchlistImpl withUploadStatus(String uploadStatus) { this.innerModel().withUploadStatus(uploadStatus); return this; } + + public WatchlistImpl withProvisioningState(ProvisioningState provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistItemsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistItemsClientImpl.java index a56a0dfd5984..fdfeca6e0257 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistItemsClientImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistItemsClientImpl.java @@ -115,11 +115,11 @@ Mono> listNext(@PathParam(value = "nextLink", encode } /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies * a starting point to use for subsequent calls. Optional. @@ -160,11 +160,11 @@ private Mono> listSinglePageAsync(String resou } /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies * a starting point to use for subsequent calls. Optional. @@ -205,11 +205,11 @@ private Mono> listSinglePageAsync(String resou } /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies * a starting point to use for subsequent calls. Optional. @@ -226,11 +226,11 @@ private PagedFlux listAsync(String resourceGroupName, String } /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -245,11 +245,11 @@ private PagedFlux listAsync(String resourceGroupName, String } /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies * a starting point to use for subsequent calls. Optional. @@ -268,11 +268,11 @@ private PagedFlux listAsync(String resourceGroupName, String } /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -286,11 +286,11 @@ public PagedIterable list(String resourceGroupName, String w } /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies * a starting point to use for subsequent calls. Optional. @@ -307,16 +307,17 @@ public PagedIterable list(String resourceGroupName, String w } /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item along with {@link Response} on successful completion of {@link Mono}. + * @return a watchlist, without its watchlist items along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -352,17 +353,18 @@ private Mono> getWithResponseAsync(String resourceG } /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item along with {@link Response} on successful completion of {@link Mono}. + * @return a watchlist, without its watchlist items along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, @@ -396,16 +398,16 @@ private Mono> getWithResponseAsync(String resourceG } /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item on successful completion of {@link Mono}. + * @return a watchlist, without its watchlist items on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String workspaceName, String watchlistAlias, @@ -415,17 +417,17 @@ private Mono getAsync(String resourceGroupName, String works } /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item along with {@link Response}. + * @return a watchlist, without its watchlist items along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceGroupName, String workspaceName, @@ -434,16 +436,16 @@ public Response getWithResponse(String resourceGroupName, St } /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item. + * @return a watchlist, without its watchlist items. */ @ServiceMethod(returns = ReturnType.SINGLE) public WatchlistItemInner get(String resourceGroupName, String workspaceName, String watchlistAlias, @@ -457,8 +459,8 @@ public WatchlistItemInner get(String resourceGroupName, String workspaceName, St * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -502,8 +504,8 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -546,8 +548,8 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -565,8 +567,8 @@ private Mono deleteAsync(String resourceGroupName, String workspaceName, S * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -585,8 +587,8 @@ public Response deleteWithResponse(String resourceGroupName, String worksp * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -597,17 +599,17 @@ public void delete(String resourceGroupName, String workspaceName, String watchl } /** - * Create or update a watchlist item. + * Creates or updates a watchlist item. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param watchlistItem The watchlist item. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist Item in Azure Security Insights along with {@link Response} on successful + * @return represents a Watchlist item in Azure Security Insights along with {@link Response} on successful * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -649,18 +651,18 @@ private Mono> createOrUpdateWithResponseAsync(Strin } /** - * Create or update a watchlist item. + * Creates or updates a watchlist item. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param watchlistItem The watchlist item. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist Item in Azure Security Insights along with {@link Response} on successful + * @return represents a Watchlist item in Azure Security Insights along with {@link Response} on successful * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -702,17 +704,17 @@ private Mono> createOrUpdateWithResponseAsync(Strin } /** - * Create or update a watchlist item. + * Creates or updates a watchlist item. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param watchlistItem The watchlist item. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist Item in Azure Security Insights on successful completion of {@link Mono}. + * @return represents a Watchlist item in Azure Security Insights on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, @@ -722,18 +724,18 @@ private Mono createOrUpdateAsync(String resourceGroupName, S } /** - * Create or update a watchlist item. + * Creates or updates a watchlist item. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param watchlistItem The watchlist item. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist Item in Azure Security Insights along with {@link Response}. + * @return represents a Watchlist item in Azure Security Insights along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, @@ -743,17 +745,17 @@ public Response createOrUpdateWithResponse(String resourceGr } /** - * Create or update a watchlist item. + * Creates or updates a watchlist item. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param watchlistItem The watchlist item. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist Item in Azure Security Insights. + * @return represents a Watchlist item in Azure Security Insights. */ @ServiceMethod(returns = ReturnType.SINGLE) public WatchlistItemInner createOrUpdate(String resourceGroupName, String workspaceName, String watchlistAlias, diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsClientImpl.java index e64ae3003dbc..cd255deeac0b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsClientImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsClientImpl.java @@ -26,11 +26,16 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.securityinsights.fluent.WatchlistsClient; import com.azure.resourcemanager.securityinsights.fluent.models.WatchlistInner; import com.azure.resourcemanager.securityinsights.models.WatchlistList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** @@ -85,10 +90,10 @@ Mono> get(@HostParam("$host") String endpoint, @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}") - @ExpectedResponses({ 200, 204 }) + @ExpectedResponses({ 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, @PathParam("watchlistAlias") String watchlistAlias, @HeaderParam("Accept") String accept, Context context); @@ -96,7 +101,7 @@ Mono> delete(@HostParam("$host") String endpoint, @QueryParam("ap @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, + Mono>> createOrUpdate(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, @PathParam("watchlistAlias") String watchlistAlias, @BodyParam("application/json") WatchlistInner watchlist, @@ -111,7 +116,7 @@ Mono> listNext(@PathParam(value = "nextLink", encoded = } /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -152,7 +157,7 @@ private Mono> listSinglePageAsync(String resourceG } /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -194,7 +199,7 @@ private Mono> listSinglePageAsync(String resourceG } /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -213,7 +218,7 @@ private PagedFlux listAsync(String resourceGroupName, String wor } /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -230,7 +235,7 @@ private PagedFlux listAsync(String resourceGroupName, String wor } /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -251,7 +256,7 @@ private PagedFlux listAsync(String resourceGroupName, String wor } /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -267,7 +272,7 @@ public PagedIterable list(String resourceGroupName, String works } /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -287,11 +292,11 @@ public PagedIterable list(String resourceGroupName, String works } /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -327,11 +332,11 @@ private Mono> getWithResponseAsync(String resourceGroup } /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -367,11 +372,11 @@ private Mono> getWithResponseAsync(String resourceGroup } /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -384,11 +389,11 @@ private Mono getAsync(String resourceGroupName, String workspace } /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -402,11 +407,11 @@ public Response getWithResponse(String resourceGroupName, String } /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -422,14 +427,14 @@ public WatchlistInner get(String resourceGroupName, String workspaceName, String * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + private Mono>> deleteWithResponseAsync(String resourceGroupName, String workspaceName, String watchlistAlias) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -461,7 +466,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -469,7 +474,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + private Mono>> deleteWithResponseAsync(String resourceGroupName, String workspaceName, String watchlistAlias, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -500,7 +505,84 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String workspaceName, + String watchlistAlias) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a watchlist. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String workspaceName, + String watchlistAlias, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a watchlist. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String watchlistAlias) { + return this.beginDeleteAsync(resourceGroupName, workspaceName, watchlistAlias).getSyncPoller(); + } + + /** + * Delete a watchlist. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String watchlistAlias, Context context) { + return this.beginDeleteAsync(resourceGroupName, workspaceName, watchlistAlias, context).getSyncPoller(); + } + + /** + * Delete a watchlist. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -508,8 +590,8 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String workspaceName, String watchlistAlias) { - return deleteWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias) - .flatMap(ignored -> Mono.empty()); + return beginDeleteAsync(resourceGroupName, workspaceName, watchlistAlias).last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -517,17 +599,18 @@ private Mono deleteAsync(String resourceGroupName, String workspaceName, S * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String workspaceName, String watchlistAlias, + private Mono deleteAsync(String resourceGroupName, String workspaceName, String watchlistAlias, Context context) { - return deleteWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias, context).block(); + return beginDeleteAsync(resourceGroupName, workspaceName, watchlistAlias, context).last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -535,23 +618,42 @@ public Response deleteWithResponse(String resourceGroupName, String worksp * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String workspaceName, String watchlistAlias) { - deleteWithResponse(resourceGroupName, workspaceName, watchlistAlias, Context.NONE); + deleteAsync(resourceGroupName, workspaceName, watchlistAlias).block(); + } + + /** + * Delete a watchlist. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String watchlistAlias, Context context) { + deleteAsync(resourceGroupName, workspaceName, watchlistAlias, context).block(); } /** * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To - * create a Watchlist and its Items, we should call this endpoint with rawContent and contentType properties. + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param watchlist The watchlist. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -560,7 +662,7 @@ public void delete(String resourceGroupName, String workspaceName, String watchl * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String workspaceName, String watchlistAlias, WatchlistInner watchlist) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -595,11 +697,14 @@ private Mono> createOrUpdateWithResponseAsync(String re /** * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To - * create a Watchlist and its Items, we should call this endpoint with rawContent and contentType properties. + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param watchlist The watchlist. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -609,7 +714,7 @@ private Mono> createOrUpdateWithResponseAsync(String re * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String workspaceName, String watchlistAlias, WatchlistInner watchlist, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -643,11 +748,113 @@ private Mono> createOrUpdateWithResponseAsync(String re /** * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To - * create a Watchlist and its Items, we should call this endpoint with rawContent and contentType properties. + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. + * @param watchlist The watchlist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Watchlist in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WatchlistInner> beginCreateOrUpdateAsync(String resourceGroupName, + String workspaceName, String watchlistAlias, WatchlistInner watchlist) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + WatchlistInner.class, WatchlistInner.class, this.client.getContext()); + } + + /** + * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param watchlist The watchlist. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Watchlist in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WatchlistInner> beginCreateOrUpdateAsync(String resourceGroupName, + String workspaceName, String watchlistAlias, WatchlistInner watchlist, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + WatchlistInner.class, WatchlistInner.class, context); + } + + /** + * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param watchlist The watchlist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Watchlist in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WatchlistInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String watchlistAlias, WatchlistInner watchlist) { + return this.beginCreateOrUpdateAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist) + .getSyncPoller(); + } + + /** + * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param watchlist The watchlist. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Watchlist in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WatchlistInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String watchlistAlias, WatchlistInner watchlist, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist, context) + .getSyncPoller(); + } + + /** + * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. * @param watchlist The watchlist. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -657,38 +864,44 @@ private Mono> createOrUpdateWithResponseAsync(String re @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String watchlistAlias, WatchlistInner watchlist) { - return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist).last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To - * create a Watchlist and its Items, we should call this endpoint with rawContent and contentType properties. + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param watchlist The watchlist. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Watchlist in Azure Security Insights along with {@link Response}. + * @return represents a Watchlist in Azure Security Insights on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String watchlistAlias, WatchlistInner watchlist, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist, context) - .block(); + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist, context).last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To - * create a Watchlist and its Items, we should call this endpoint with rawContent and contentType properties. + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param watchlist The watchlist. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -698,8 +911,30 @@ public Response createOrUpdateWithResponse(String resourceGroupN @ServiceMethod(returns = ReturnType.SINGLE) public WatchlistInner createOrUpdate(String resourceGroupName, String workspaceName, String watchlistAlias, WatchlistInner watchlist) { - return createOrUpdateWithResponse(resourceGroupName, workspaceName, watchlistAlias, watchlist, Context.NONE) - .getValue(); + return createOrUpdateAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist).block(); + } + + /** + * Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To + * create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and + * contentType properties. The rawContent is mainly used for small watchlist (content size below 3.8 MB). The SAS + * URI enables the creation of large watchlist, where the content size can go up to 500 MB. The status of processing + * such large file can be polled through the URL returned in Azure-AsyncOperation header. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param watchlistAlias Watchlist Alias. + * @param watchlist The watchlist. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Watchlist in Azure Security Insights. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WatchlistInner createOrUpdate(String resourceGroupName, String workspaceName, String watchlistAlias, + WatchlistInner watchlist, Context context) { + return createOrUpdateAsync(resourceGroupName, workspaceName, watchlistAlias, watchlist, context).block(); } /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsImpl.java index 0bbd9efd655f..1d908a7bab7c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsImpl.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WatchlistsImpl.java @@ -60,15 +60,14 @@ public Watchlist get(String resourceGroupName, String workspaceName, String watc } } - public Response deleteWithResponse(String resourceGroupName, String workspaceName, String watchlistAlias, - Context context) { - return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, watchlistAlias, context); - } - public void delete(String resourceGroupName, String workspaceName, String watchlistAlias) { this.serviceClient().delete(resourceGroupName, workspaceName, watchlistAlias); } + public void delete(String resourceGroupName, String workspaceName, String watchlistAlias, Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, watchlistAlias, context); + } + public Watchlist getById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { @@ -123,10 +122,10 @@ public void deleteById(String id) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'watchlists'.", id))); } - this.deleteWithResponse(resourceGroupName, workspaceName, watchlistAlias, Context.NONE); + this.delete(resourceGroupName, workspaceName, watchlistAlias, Context.NONE); } - public Response deleteByIdWithResponse(String id, Context context) { + public void deleteByIdWithResponse(String id, Context context) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( @@ -142,7 +141,7 @@ public Response deleteByIdWithResponse(String id, Context context) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'watchlists'.", id))); } - return this.deleteWithResponse(resourceGroupName, workspaceName, watchlistAlias, context); + this.delete(resourceGroupName, workspaceName, watchlistAlias, context); } private WatchlistsClient serviceClient() { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentImpl.java new file mode 100644 index 000000000000..ba5f6993c654 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerAssignmentInner; +import com.azure.resourcemanager.securityinsights.models.AssignmentItem; +import com.azure.resourcemanager.securityinsights.models.ProvisioningState; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerAssignment; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class WorkspaceManagerAssignmentImpl + implements WorkspaceManagerAssignment, WorkspaceManagerAssignment.Definition, WorkspaceManagerAssignment.Update { + private WorkspaceManagerAssignmentInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String targetResourceName() { + return this.innerModel().targetResourceName(); + } + + public OffsetDateTime lastJobEndTime() { + return this.innerModel().lastJobEndTime(); + } + + public ProvisioningState lastJobProvisioningState() { + return this.innerModel().lastJobProvisioningState(); + } + + public List items() { + List inner = this.innerModel().items(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspaceManagerAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String workspaceManagerAssignmentName; + + public WorkspaceManagerAssignmentImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public WorkspaceManagerAssignment create() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerAssignments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerAssignment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerAssignments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, + this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceManagerAssignmentImpl(String name, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new WorkspaceManagerAssignmentInner(); + this.serviceManager = serviceManager; + this.workspaceManagerAssignmentName = name; + } + + public WorkspaceManagerAssignmentImpl update() { + return this; + } + + public WorkspaceManagerAssignment apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerAssignments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerAssignment apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerAssignments() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, + this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceManagerAssignmentImpl(WorkspaceManagerAssignmentInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.workspaceManagerAssignmentName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaceManagerAssignments"); + } + + public WorkspaceManagerAssignment refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerAssignments() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerAssignment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerAssignments() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context) + .getValue(); + return this; + } + + public WorkspaceManagerAssignmentImpl withTargetResourceName(String targetResourceName) { + this.innerModel().withTargetResourceName(targetResourceName); + return this; + } + + public WorkspaceManagerAssignmentImpl withItems(List items) { + this.innerModel().withItems(items); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentJobsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentJobsClientImpl.java new file mode 100644 index 000000000000..a03d9f603ad4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentJobsClientImpl.java @@ -0,0 +1,804 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerAssignmentJobsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.JobInner; +import com.azure.resourcemanager.securityinsights.models.JobList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerAssignmentJobsClient. + */ +public final class WorkspaceManagerAssignmentJobsClientImpl implements WorkspaceManagerAssignmentJobsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspaceManagerAssignmentJobsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of WorkspaceManagerAssignmentJobsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceManagerAssignmentJobsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(WorkspaceManagerAssignmentJobsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsWorkspaceManagerAssignmentJobs to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsWork") + public interface WorkspaceManagerAssignmentJobsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerAssignmentName") String workspaceManagerAssignmentName, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerAssignmentName") String workspaceManagerAssignmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerAssignmentName") String workspaceManagerAssignmentName, + @PathParam("jobName") String jobName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}/jobs/{jobName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerAssignmentName") String workspaceManagerAssignmentName, + @PathParam("jobName") String jobName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + orderby, top, skipToken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerAssignmentName, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String orderby, Integer top, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, + workspaceManagerAssignmentName, orderby, top, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, + workspaceManagerAssignmentName, orderby, top, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, + workspaceManagerAssignmentName, orderby, top, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>( + listAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, orderby, top, skipToken)); + } + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, orderby, + top, skipToken, context)); + } + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerAssignmentName, accept, context); + } + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + return createWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + return createWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context) + .block(); + } + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobInner create(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName) { + return createWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, Context.NONE) + .getValue(); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + jobName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, accept, context); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, context) + .block(); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobInner get(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, + String jobName) { + return getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, Context.NONE) + .getValue(); + } + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + jobName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, accept, context); + } + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, + context).block(); + } + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, + String jobName) { + deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the jobs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the jobs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentJobsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentJobsImpl.java new file mode 100644 index 000000000000..c47970288ead --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentJobsImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerAssignmentJobsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.JobInner; +import com.azure.resourcemanager.securityinsights.models.Job; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerAssignmentJobs; + +public final class WorkspaceManagerAssignmentJobsImpl implements WorkspaceManagerAssignmentJobs { + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerAssignmentJobsImpl.class); + + private final WorkspaceManagerAssignmentJobsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public WorkspaceManagerAssignmentJobsImpl(WorkspaceManagerAssignmentJobsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, workspaceManagerAssignmentName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JobImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String orderby, Integer top, String skipToken, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, workspaceName, workspaceManagerAssignmentName, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new JobImpl(inner1, this.manager())); + } + + public Response createWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + Response inner = this.serviceClient() + .createWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new JobImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Job create(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName) { + JobInner inner = this.serviceClient().create(resourceGroupName, workspaceName, workspaceManagerAssignmentName); + if (inner != null) { + return new JobImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new JobImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Job get(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, + String jobName) { + JobInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName); + if (inner != null) { + return new JobImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, + String jobName) { + this.serviceClient().delete(resourceGroupName, workspaceName, workspaceManagerAssignmentName, jobName); + } + + private WorkspaceManagerAssignmentJobsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentsClientImpl.java new file mode 100644 index 000000000000..fe85aab89f1f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentsClientImpl.java @@ -0,0 +1,794 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerAssignmentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerAssignmentInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerAssignmentList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerAssignmentsClient. + */ +public final class WorkspaceManagerAssignmentsClientImpl implements WorkspaceManagerAssignmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspaceManagerAssignmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of WorkspaceManagerAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceManagerAssignmentsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(WorkspaceManagerAssignmentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsWorkspaceManagerAssignments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsWork") + public interface WorkspaceManagerAssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerAssignmentName") String workspaceManagerAssignmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerAssignmentName") String workspaceManagerAssignmentName, + @BodyParam("application/json") WorkspaceManagerAssignmentInner workspaceManagerAssignment, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerAssignments/{workspaceManagerAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerAssignmentName") String workspaceManagerAssignmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, orderby, top, skipToken, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken)); + } + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context)); + } + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerAssignmentName, accept, context); + } + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context).block(); + } + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerAssignmentInner get(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + return getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param workspaceManagerAssignment The workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerAssignmentName, + WorkspaceManagerAssignmentInner workspaceManagerAssignment) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + if (workspaceManagerAssignment == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerAssignment is required and cannot be null.")); + } else { + workspaceManagerAssignment.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + workspaceManagerAssignment, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param workspaceManagerAssignment The workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerAssignmentName, + WorkspaceManagerAssignmentInner workspaceManagerAssignment, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + if (workspaceManagerAssignment == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerAssignment is required and cannot be null.")); + } else { + workspaceManagerAssignment.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + workspaceManagerAssignment, accept, context); + } + + /** + * Creates or updates a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param workspaceManagerAssignment The workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, WorkspaceManagerAssignmentInner workspaceManagerAssignment) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, + workspaceManagerAssignment).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param workspaceManagerAssignment The workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String workspaceManagerAssignmentName, + WorkspaceManagerAssignmentInner workspaceManagerAssignment, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, + workspaceManagerAssignment, context).block(); + } + + /** + * Creates or updates a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param workspaceManagerAssignment The workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerAssignmentInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, WorkspaceManagerAssignmentInner workspaceManagerAssignment) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, + workspaceManagerAssignment, Context.NONE).getValue(); + } + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerAssignmentName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerAssignmentName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerAssignmentName, accept, context); + } + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context) + .block(); + } + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName) { + deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the workspace manager assignments along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the workspace manager assignments along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentsImpl.java new file mode 100644 index 000000000000..a53e2abf551a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerAssignmentsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerAssignmentsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerAssignmentInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerAssignment; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerAssignments; + +public final class WorkspaceManagerAssignmentsImpl implements WorkspaceManagerAssignments { + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerAssignmentsImpl.class); + + private final WorkspaceManagerAssignmentsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public WorkspaceManagerAssignmentsImpl(WorkspaceManagerAssignmentsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspaceManagerAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspaceManagerAssignmentImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceManagerAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkspaceManagerAssignment get(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName) { + WorkspaceManagerAssignmentInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, workspaceManagerAssignmentName); + if (inner != null) { + return new WorkspaceManagerAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName) { + this.serviceClient().delete(resourceGroupName, workspaceName, workspaceManagerAssignmentName); + } + + public WorkspaceManagerAssignment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerAssignments"); + if (workspaceManagerAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerAssignments'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerAssignments"); + if (workspaceManagerAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerAssignments'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerAssignments"); + if (workspaceManagerAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerAssignments'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerAssignmentName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerAssignments"); + if (workspaceManagerAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerAssignments'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerAssignmentName, context); + } + + private WorkspaceManagerAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public WorkspaceManagerAssignmentImpl define(String name) { + return new WorkspaceManagerAssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationImpl.java new file mode 100644 index 000000000000..3cbca5357d33 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerConfigurationInner; +import com.azure.resourcemanager.securityinsights.models.Mode; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerConfiguration; + +public final class WorkspaceManagerConfigurationImpl implements WorkspaceManagerConfiguration, + WorkspaceManagerConfiguration.Definition, WorkspaceManagerConfiguration.Update { + private WorkspaceManagerConfigurationInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Mode mode() { + return this.innerModel().mode(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspaceManagerConfigurationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String workspaceManagerConfigurationName; + + public WorkspaceManagerConfigurationImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public WorkspaceManagerConfiguration create() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerConfigurations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerConfiguration create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerConfigurations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, + this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceManagerConfigurationImpl(String name, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new WorkspaceManagerConfigurationInner(); + this.serviceManager = serviceManager; + this.workspaceManagerConfigurationName = name; + } + + public WorkspaceManagerConfigurationImpl update() { + return this; + } + + public WorkspaceManagerConfiguration apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerConfigurations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerConfiguration apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerConfigurations() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, + this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceManagerConfigurationImpl(WorkspaceManagerConfigurationInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.workspaceManagerConfigurationName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaceManagerConfigurations"); + } + + public WorkspaceManagerConfiguration refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerConfigurations() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerConfiguration refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerConfigurations() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, context) + .getValue(); + return this; + } + + public WorkspaceManagerConfigurationImpl withMode(Mode mode) { + this.innerModel().withMode(mode); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationsClientImpl.java new file mode 100644 index 000000000000..1bd5b20d823e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationsClientImpl.java @@ -0,0 +1,795 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerConfigurationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerConfigurationInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerConfigurationList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerConfigurationsClient. + */ +public final class WorkspaceManagerConfigurationsClientImpl implements WorkspaceManagerConfigurationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspaceManagerConfigurationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of WorkspaceManagerConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceManagerConfigurationsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(WorkspaceManagerConfigurationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsWorkspaceManagerConfigurations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsWork") + public interface WorkspaceManagerConfigurationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerConfigurationName") String workspaceManagerConfigurationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerConfigurationName") String workspaceManagerConfigurationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerConfigurations/{workspaceManagerConfigurationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerConfigurationName") String workspaceManagerConfigurationName, + @BodyParam("application/json") WorkspaceManagerConfigurationInner workspaceManagerConfiguration, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, orderby, top, skipToken, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken)); + } + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context)); + } + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerConfigurationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerConfigurationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfigurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerConfigurationName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerConfigurationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerConfigurationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfigurationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerConfigurationName, accept, context); + } + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerConfigurationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerConfigurationName, context) + .block(); + } + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerConfigurationInner get(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName) { + return getWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, Context.NONE) + .getValue(); + } + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerConfigurationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfigurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerConfigurationName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerConfigurationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfigurationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerConfigurationName, accept, context); + } + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerConfigurationName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerConfigurationName, context) + .block(); + } + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerConfigurationName) { + deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, Context.NONE); + } + + /** + * Creates or updates a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param workspaceManagerConfiguration The workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerConfigurationName, + WorkspaceManagerConfigurationInner workspaceManagerConfiguration) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerConfigurationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfigurationName is required and cannot be null.")); + } + if (workspaceManagerConfiguration == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfiguration is required and cannot be null.")); + } else { + workspaceManagerConfiguration.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerConfigurationName, + workspaceManagerConfiguration, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param workspaceManagerConfiguration The workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager configuration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerConfigurationName, + WorkspaceManagerConfigurationInner workspaceManagerConfiguration, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerConfigurationName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfigurationName is required and cannot be null.")); + } + if (workspaceManagerConfiguration == null) { + return Mono.error(new IllegalArgumentException( + "Parameter workspaceManagerConfiguration is required and cannot be null.")); + } else { + workspaceManagerConfiguration.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerConfigurationName, + workspaceManagerConfiguration, accept, context); + } + + /** + * Creates or updates a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param workspaceManagerConfiguration The workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, WorkspaceManagerConfigurationInner workspaceManagerConfiguration) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerConfigurationName, + workspaceManagerConfiguration).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param workspaceManagerConfiguration The workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String workspaceManagerConfigurationName, + WorkspaceManagerConfigurationInner workspaceManagerConfiguration, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerConfigurationName, + workspaceManagerConfiguration, context).block(); + } + + /** + * Creates or updates a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param workspaceManagerConfiguration The workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerConfigurationInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, WorkspaceManagerConfigurationInner workspaceManagerConfiguration) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, + workspaceManagerConfiguration, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the workspace manager configurations for the workspace along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all the workspace manager configurations for the workspace along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationsImpl.java new file mode 100644 index 000000000000..bd90f56a9b9a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerConfigurationsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerConfigurationsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerConfigurationInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerConfiguration; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerConfigurations; + +public final class WorkspaceManagerConfigurationsImpl implements WorkspaceManagerConfigurations { + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerConfigurationsImpl.class); + + private final WorkspaceManagerConfigurationsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public WorkspaceManagerConfigurationsImpl(WorkspaceManagerConfigurationsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspaceManagerConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspaceManagerConfigurationImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceManagerConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkspaceManagerConfiguration get(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName) { + WorkspaceManagerConfigurationInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, workspaceManagerConfigurationName); + if (inner != null) { + return new WorkspaceManagerConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerConfigurationName) { + this.serviceClient().delete(resourceGroupName, workspaceName, workspaceManagerConfigurationName); + } + + public WorkspaceManagerConfiguration getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerConfigurationName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerConfigurations"); + if (workspaceManagerConfigurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceManagerConfigurations'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerConfigurationName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerConfigurations"); + if (workspaceManagerConfigurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceManagerConfigurations'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerConfigurationName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerConfigurations"); + if (workspaceManagerConfigurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceManagerConfigurations'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerConfigurationName + = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerConfigurations"); + if (workspaceManagerConfigurationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceManagerConfigurations'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerConfigurationName, context); + } + + private WorkspaceManagerConfigurationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public WorkspaceManagerConfigurationImpl define(String name) { + return new WorkspaceManagerConfigurationImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupImpl.java new file mode 100644 index 000000000000..eda7ff50b002 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerGroupInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerGroup; +import java.util.Collections; +import java.util.List; + +public final class WorkspaceManagerGroupImpl + implements WorkspaceManagerGroup, WorkspaceManagerGroup.Definition, WorkspaceManagerGroup.Update { + private WorkspaceManagerGroupInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public List memberResourceNames() { + List inner = this.innerModel().memberResourceNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspaceManagerGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String workspaceManagerGroupName; + + public WorkspaceManagerGroupImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public WorkspaceManagerGroup create() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerGroups() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerGroup create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerGroups() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, this.innerModel(), + context) + .getValue(); + return this; + } + + WorkspaceManagerGroupImpl(String name, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new WorkspaceManagerGroupInner(); + this.serviceManager = serviceManager; + this.workspaceManagerGroupName = name; + } + + public WorkspaceManagerGroupImpl update() { + return this; + } + + public WorkspaceManagerGroup apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerGroups() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerGroup apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerGroups() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, this.innerModel(), + context) + .getValue(); + return this; + } + + WorkspaceManagerGroupImpl(WorkspaceManagerGroupInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.workspaceManagerGroupName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaceManagerGroups"); + } + + public WorkspaceManagerGroup refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerGroups() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerGroup refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerGroups() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, context) + .getValue(); + return this; + } + + public WorkspaceManagerGroupImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public WorkspaceManagerGroupImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public WorkspaceManagerGroupImpl withMemberResourceNames(List memberResourceNames) { + this.innerModel().withMemberResourceNames(memberResourceNames); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupsClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupsClientImpl.java new file mode 100644 index 000000000000..24d9599a0a3a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupsClientImpl.java @@ -0,0 +1,789 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerGroupsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerGroupInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerGroupList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerGroupsClient. + */ +public final class WorkspaceManagerGroupsClientImpl implements WorkspaceManagerGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspaceManagerGroupsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of WorkspaceManagerGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceManagerGroupsClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(WorkspaceManagerGroupsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsWorkspaceManagerGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsWork") + public interface WorkspaceManagerGroupsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerGroupName") String workspaceManagerGroupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerGroupName") String workspaceManagerGroupName, + @BodyParam("application/json") WorkspaceManagerGroupInner workspaceManagerGroup, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerGroups/{workspaceManagerGroupName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerGroupName") String workspaceManagerGroupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, orderby, top, skipToken, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken)); + } + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context)); + } + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerGroupName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerGroupName, accept, context); + } + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerGroupName, context).block(); + } + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerGroupInner get(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName) { + return getWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, Context.NONE).getValue(); + } + + /** + * Creates or updates a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param workspaceManagerGroup The workspace manager group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerGroupName, WorkspaceManagerGroupInner workspaceManagerGroup) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerGroupName is required and cannot be null.")); + } + if (workspaceManagerGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceManagerGroup is required and cannot be null.")); + } else { + workspaceManagerGroup.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerGroupName, + workspaceManagerGroup, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param workspaceManagerGroup The workspace manager group object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerGroupName, WorkspaceManagerGroupInner workspaceManagerGroup, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerGroupName is required and cannot be null.")); + } + if (workspaceManagerGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter workspaceManagerGroup is required and cannot be null.")); + } else { + workspaceManagerGroup.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerGroupName, + workspaceManagerGroup, accept, context); + } + + /** + * Creates or updates a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param workspaceManagerGroup The workspace manager group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, WorkspaceManagerGroupInner workspaceManagerGroup) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerGroupName, + workspaceManagerGroup).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param workspaceManagerGroup The workspace manager group object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String workspaceManagerGroupName, WorkspaceManagerGroupInner workspaceManagerGroup, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerGroupName, + workspaceManagerGroup, context).block(); + } + + /** + * Creates or updates a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param workspaceManagerGroup The workspace manager group object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerGroupInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, WorkspaceManagerGroupInner workspaceManagerGroup) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, + workspaceManagerGroup, Context.NONE).getValue(); + } + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerGroupName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerGroupName, accept, context); + } + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String workspaceManagerGroupName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerGroupName, context).block(); + } + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerGroupName) { + deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the workspace manager groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the workspace manager groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupsImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupsImpl.java new file mode 100644 index 000000000000..8c9536d060c7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerGroupsImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerGroupsClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerGroupInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerGroup; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerGroups; + +public final class WorkspaceManagerGroupsImpl implements WorkspaceManagerGroups { + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerGroupsImpl.class); + + private final WorkspaceManagerGroupsClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public WorkspaceManagerGroupsImpl(WorkspaceManagerGroupsClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceManagerGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceManagerGroupImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceManagerGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkspaceManagerGroup get(String resourceGroupName, String workspaceName, String workspaceManagerGroupName) { + WorkspaceManagerGroupInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, workspaceManagerGroupName); + if (inner != null) { + return new WorkspaceManagerGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerGroupName) { + this.serviceClient().delete(resourceGroupName, workspaceName, workspaceManagerGroupName); + } + + public WorkspaceManagerGroup getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerGroupName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerGroups"); + if (workspaceManagerGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerGroupName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerGroups"); + if (workspaceManagerGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerGroupName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerGroups"); + if (workspaceManagerGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerGroups'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerGroupName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerGroups"); + if (workspaceManagerGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerGroups'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerGroupName, context); + } + + private WorkspaceManagerGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public WorkspaceManagerGroupImpl define(String name) { + return new WorkspaceManagerGroupImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMemberImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMemberImpl.java new file mode 100644 index 000000000000..1746d0f4e61d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMemberImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerMemberInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerMember; + +public final class WorkspaceManagerMemberImpl + implements WorkspaceManagerMember, WorkspaceManagerMember.Definition, WorkspaceManagerMember.Update { + private WorkspaceManagerMemberInner innerObject; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String targetWorkspaceResourceId() { + return this.innerModel().targetWorkspaceResourceId(); + } + + public String targetWorkspaceTenantId() { + return this.innerModel().targetWorkspaceTenantId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspaceManagerMemberInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String workspaceManagerMemberName; + + public WorkspaceManagerMemberImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public WorkspaceManagerMember create() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerMembers() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerMember create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerMembers() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, this.innerModel(), + context) + .getValue(); + return this; + } + + WorkspaceManagerMemberImpl(String name, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = new WorkspaceManagerMemberInner(); + this.serviceManager = serviceManager; + this.workspaceManagerMemberName = name; + } + + public WorkspaceManagerMemberImpl update() { + return this; + } + + public WorkspaceManagerMember apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerMembers() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerMember apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerMembers() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, this.innerModel(), + context) + .getValue(); + return this; + } + + WorkspaceManagerMemberImpl(WorkspaceManagerMemberInner innerObject, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.workspaceManagerMemberName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaceManagerMembers"); + } + + public WorkspaceManagerMember refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerMembers() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceManagerMember refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaceManagerMembers() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, context) + .getValue(); + return this; + } + + public WorkspaceManagerMemberImpl withTargetWorkspaceResourceId(String targetWorkspaceResourceId) { + this.innerModel().withTargetWorkspaceResourceId(targetWorkspaceResourceId); + return this; + } + + public WorkspaceManagerMemberImpl withTargetWorkspaceTenantId(String targetWorkspaceTenantId) { + this.innerModel().withTargetWorkspaceTenantId(targetWorkspaceTenantId); + return this; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMembersClientImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMembersClientImpl.java new file mode 100644 index 000000000000..ea9bcf3d6f02 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMembersClientImpl.java @@ -0,0 +1,789 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerMembersClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerMemberInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerMembersList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspaceManagerMembersClient. + */ +public final class WorkspaceManagerMembersClientImpl implements WorkspaceManagerMembersClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspaceManagerMembersService service; + + /** + * The service client containing this operation class. + */ + private final SecurityInsightsImpl client; + + /** + * Initializes an instance of WorkspaceManagerMembersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceManagerMembersClientImpl(SecurityInsightsImpl client) { + this.service = RestProxy.create(WorkspaceManagerMembersService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityInsightsWorkspaceManagerMembers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityInsightsWork") + public interface WorkspaceManagerMembersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @QueryParam("$orderby") String orderby, @QueryParam("$top") Integer top, + @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerMemberName") String workspaceManagerMemberName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerMemberName") String workspaceManagerMemberName, + @BodyParam("application/json") WorkspaceManagerMemberInner workspaceManagerMember, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/workspaceManagerMembers/{workspaceManagerMemberName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("workspaceManagerMemberName") String workspaceManagerMemberName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, orderby, top, skipToken, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String workspaceName, String orderby, Integer top, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, orderby, top, skipToken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName) { + final String orderby = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken)); + } + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceName, + String orderby, Integer top, String skipToken, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceName, orderby, top, skipToken, context)); + } + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerMemberName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerMemberName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMemberName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerMemberName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerMemberName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerMemberName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMemberName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerMemberName, accept, context); + } + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerMemberName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, Context context) { + return getWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerMemberName, context).block(); + } + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerMemberInner get(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName) { + return getWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, Context.NONE).getValue(); + } + + /** + * Creates or updates a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param workspaceManagerMember The workspace manager member object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerMemberName, WorkspaceManagerMemberInner workspaceManagerMember) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerMemberName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMemberName is required and cannot be null.")); + } + if (workspaceManagerMember == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMember is required and cannot be null.")); + } else { + workspaceManagerMember.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerMemberName, + workspaceManagerMember, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param workspaceManagerMember The workspace manager member object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String workspaceManagerMemberName, WorkspaceManagerMemberInner workspaceManagerMember, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerMemberName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMemberName is required and cannot be null.")); + } + if (workspaceManagerMember == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMember is required and cannot be null.")); + } else { + workspaceManagerMember.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerMemberName, + workspaceManagerMember, accept, context); + } + + /** + * Creates or updates a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param workspaceManagerMember The workspace manager member object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager member on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, WorkspaceManagerMemberInner workspaceManagerMember) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerMemberName, + workspaceManagerMember).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param workspaceManagerMember The workspace manager member object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager member along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String workspaceName, String workspaceManagerMemberName, WorkspaceManagerMemberInner workspaceManagerMember, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerMemberName, + workspaceManagerMember, context).block(); + } + + /** + * Creates or updates a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param workspaceManagerMember The workspace manager member object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the workspace manager member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceManagerMemberInner createOrUpdate(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, WorkspaceManagerMemberInner workspaceManagerMember) { + return createOrUpdateWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, + workspaceManagerMember, Context.NONE).getValue(); + } + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerMemberName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMemberName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, workspaceManagerMemberName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceManagerMemberName == null) { + return Mono.error( + new IllegalArgumentException("Parameter workspaceManagerMemberName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, workspaceManagerMemberName, accept, context); + } + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName, String workspaceManagerMemberName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerMemberName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, workspaceManagerMemberName, context).block(); + } + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerMemberName) { + deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace manager members along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of workspace manager members along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMembersImpl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMembersImpl.java new file mode 100644 index 000000000000..8edb9063f2ac --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/WorkspaceManagerMembersImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.securityinsights.fluent.WorkspaceManagerMembersClient; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerMemberInner; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerMember; +import com.azure.resourcemanager.securityinsights.models.WorkspaceManagerMembers; + +public final class WorkspaceManagerMembersImpl implements WorkspaceManagerMembers { + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerMembersImpl.class); + + private final WorkspaceManagerMembersClient innerClient; + + private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager; + + public WorkspaceManagerMembersImpl(WorkspaceManagerMembersClient innerClient, + com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceManagerMemberImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, workspaceName, orderby, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceManagerMemberImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceManagerMemberImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkspaceManagerMember get(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName) { + WorkspaceManagerMemberInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, workspaceManagerMemberName); + if (inner != null) { + return new WorkspaceManagerMemberImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, context); + } + + public void delete(String resourceGroupName, String workspaceName, String workspaceManagerMemberName) { + this.serviceClient().delete(resourceGroupName, workspaceName, workspaceManagerMemberName); + } + + public WorkspaceManagerMember getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerMemberName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerMembers"); + if (workspaceManagerMemberName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerMembers'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerMemberName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerMembers"); + if (workspaceManagerMemberName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerMembers'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerMemberName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerMembers"); + if (workspaceManagerMemberName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerMembers'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String workspaceManagerMemberName = ResourceManagerUtils.getValueFromIdByName(id, "workspaceManagerMembers"); + if (workspaceManagerMemberName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'workspaceManagerMembers'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, workspaceManagerMemberName, context); + } + + private WorkspaceManagerMembersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() { + return this.serviceManager; + } + + public WorkspaceManagerMemberImpl define(String name) { + return new WorkspaceManagerMemberImpl(name, this.manager()); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AadCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AadCheckRequirements.java new file mode 100644 index 000000000000..1290f100d593 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AadCheckRequirements.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AadCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents AADIP (Azure Active Directory Identity Protection) requirements check request. + */ +@Fluent +public final class AadCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.AZURE_ACTIVE_DIRECTORY; + + /* + * AADIP (Azure Active Directory Identity Protection) requirements check properties. + */ + private AadCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of AadCheckRequirements class. + */ + public AadCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: AADIP (Azure Active Directory Identity Protection) requirements check + * properties. + * + * @return the innerProperties value. + */ + AadCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the AadCheckRequirements object itself. + */ + public AadCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new AadCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AadCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AadCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AadCheckRequirements. + */ + public static AadCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AadCheckRequirements deserializedAadCheckRequirements = new AadCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedAadCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAadCheckRequirements.innerProperties = AadCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAadCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AadDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AadDataConnector.java index d2a5df252233..6d2974f8eedc 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AadDataConnector.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AadDataConnector.java @@ -14,7 +14,7 @@ import java.io.IOException; /** - * Represents AAD (Azure Active Directory) data connector. + * Represents AADIP (Azure Active Directory Identity Protection) data connector. */ @Fluent public final class AadDataConnector extends DataConnectorInner { @@ -24,7 +24,7 @@ public final class AadDataConnector extends DataConnectorInner { private DataConnectorKind kind = DataConnectorKind.AZURE_ACTIVE_DIRECTORY; /* - * AAD (Azure Active Directory) data connector properties. + * AADIP (Azure Active Directory Identity Protection) data connector properties. */ private AadDataConnectorProperties innerProperties; @@ -65,7 +65,7 @@ public DataConnectorKind kind() { } /** - * Get the innerProperties property: AAD (Azure Active Directory) data connector properties. + * Get the innerProperties property: AADIP (Azure Active Directory Identity Protection) data connector properties. * * @return the innerProperties value. */ @@ -123,48 +123,48 @@ public AadDataConnector withEtag(String etag) { } /** - * Get the tenantId property: The tenant id to connect to, and get the data from. + * Get the dataTypes property: The available data types for the connector. * - * @return the tenantId value. + * @return the dataTypes value. */ - public String tenantId() { - return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + public AlertsDataTypeOfDataConnector dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); } /** - * Set the tenantId property: The tenant id to connect to, and get the data from. + * Set the dataTypes property: The available data types for the connector. * - * @param tenantId the tenantId value to set. + * @param dataTypes the dataTypes value to set. * @return the AadDataConnector object itself. */ - public AadDataConnector withTenantId(String tenantId) { + public AadDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { if (this.innerProperties() == null) { this.innerProperties = new AadDataConnectorProperties(); } - this.innerProperties().withTenantId(tenantId); + this.innerProperties().withDataTypes(dataTypes); return this; } /** - * Get the dataTypes property: The available data types for the connector. + * Get the tenantId property: The tenant id to connect to, and get the data from. * - * @return the dataTypes value. + * @return the tenantId value. */ - public AlertsDataTypeOfDataConnector dataTypes() { - return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); } /** - * Set the dataTypes property: The available data types for the connector. + * Set the tenantId property: The tenant id to connect to, and get the data from. * - * @param dataTypes the dataTypes value to set. + * @param tenantId the tenantId value to set. * @return the AadDataConnector object itself. */ - public AadDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + public AadDataConnector withTenantId(String tenantId) { if (this.innerProperties() == null) { this.innerProperties = new AadDataConnectorProperties(); } - this.innerProperties().withDataTypes(dataTypes); + this.innerProperties().withTenantId(tenantId); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AatpCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AatpCheckRequirements.java new file mode 100644 index 000000000000..53bc385ecd37 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AatpCheckRequirements.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AatpCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents AATP (Azure Advanced Threat Protection) requirements check request. + */ +@Fluent +public final class AatpCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.AZURE_ADVANCED_THREAT_PROTECTION; + + /* + * AATP (Azure Advanced Threat Protection) requirements check properties. + */ + private AatpCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of AatpCheckRequirements class. + */ + public AatpCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: AATP (Azure Advanced Threat Protection) requirements check properties. + * + * @return the innerProperties value. + */ + AatpCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the AatpCheckRequirements object itself. + */ + public AatpCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new AatpCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AatpCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AatpCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AatpCheckRequirements. + */ + public static AatpCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AatpCheckRequirements deserializedAatpCheckRequirements = new AatpCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedAatpCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAatpCheckRequirements.innerProperties + = AatpCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAatpCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AatpDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AatpDataConnector.java index 6122859e044f..7d09c3ad8a83 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AatpDataConnector.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AatpDataConnector.java @@ -123,48 +123,48 @@ public AatpDataConnector withEtag(String etag) { } /** - * Get the tenantId property: The tenant id to connect to, and get the data from. + * Get the dataTypes property: The available data types for the connector. * - * @return the tenantId value. + * @return the dataTypes value. */ - public String tenantId() { - return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + public AlertsDataTypeOfDataConnector dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); } /** - * Set the tenantId property: The tenant id to connect to, and get the data from. + * Set the dataTypes property: The available data types for the connector. * - * @param tenantId the tenantId value to set. + * @param dataTypes the dataTypes value to set. * @return the AatpDataConnector object itself. */ - public AatpDataConnector withTenantId(String tenantId) { + public AatpDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { if (this.innerProperties() == null) { this.innerProperties = new AatpDataConnectorProperties(); } - this.innerProperties().withTenantId(tenantId); + this.innerProperties().withDataTypes(dataTypes); return this; } /** - * Get the dataTypes property: The available data types for the connector. + * Get the tenantId property: The tenant id to connect to, and get the data from. * - * @return the dataTypes value. + * @return the tenantId value. */ - public AlertsDataTypeOfDataConnector dataTypes() { - return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); } /** - * Set the dataTypes property: The available data types for the connector. + * Set the tenantId property: The tenant id to connect to, and get the data from. * - * @param dataTypes the dataTypes value to set. + * @param tenantId the tenantId value to set. * @return the AatpDataConnector object itself. */ - public AatpDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + public AatpDataConnector withTenantId(String tenantId) { if (this.innerProperties() == null) { this.innerProperties = new AatpDataConnectorProperties(); } - this.innerProperties().withDataTypes(dataTypes); + this.innerProperties().withTenantId(tenantId); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AccountEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AccountEntity.java index 2d9037942489..1a99f99271d9 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AccountEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AccountEntity.java @@ -10,6 +10,7 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.fluent.models.AccountEntityProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import java.io.IOException; import java.util.Map; import java.util.UUID; @@ -18,7 +19,7 @@ * Represents an account entity. */ @Immutable -public final class AccountEntity extends Entity { +public final class AccountEntity extends EntityInner { /* * The kind of the entity. */ @@ -171,7 +172,7 @@ public Boolean isDomainJoined() { } /** - * Get the ntDomain property: The NetBIOS domain name as it appears in the alert format - domain/username. Examples: + * Get the ntDomain property: The NetBIOS domain name as it appears in the alert format domain/username. Examples: * NT AUTHORITY. * * @return the ntDomain value. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Action.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Action.java new file mode 100644 index 000000000000..965def89f51b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Action.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; + +/** + * An immutable client-side representation of Action. + */ +public interface Action { + /** + * Gets the kind property: The actions kind. + * + * @return the kind value. + */ + ListActionKind kind(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.ActionInner object. + * + * @return the inner object. + */ + ActionInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionResponse.java index f111337d1bbe..13d67dcc7046 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionResponse.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionResponse.java @@ -34,7 +34,7 @@ public interface ActionResponse { String type(); /** - * Gets the etag property: Etag of the action. + * Gets the etag property: Etag of the azure resource. * * @return the etag value. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionType.java index b63e7a614700..3d8263325c64 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionType.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActionType.java @@ -21,6 +21,11 @@ public final class ActionType extends ExpandableStringEnum { */ public static final ActionType RUN_PLAYBOOK = fromString("RunPlaybook"); + /** + * Static value AddIncidentTask for ActionType. + */ + public static final ActionType ADD_INCIDENT_TASK = fromString("AddIncidentTask"); + /** * Creates a new instance of ActionType value. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityCustomEntityQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityCustomEntityQuery.java new file mode 100644 index 000000000000..5160365f815e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityCustomEntityQuery.java @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ActivityEntityQueriesProperties; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Represents Activity entity query. + */ +@Fluent +public final class ActivityCustomEntityQuery extends CustomEntityQuery { + /* + * the entity query kind + */ + private CustomEntityQueryKind kind = CustomEntityQueryKind.ACTIVITY; + + /* + * Activity entity query properties + */ + private ActivityEntityQueriesProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ActivityCustomEntityQuery class. + */ + public ActivityCustomEntityQuery() { + } + + /** + * Get the kind property: the entity query kind. + * + * @return the kind value. + */ + @Override + public CustomEntityQueryKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Activity entity query properties. + * + * @return the innerProperties value. + */ + private ActivityEntityQueriesProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityCustomEntityQuery withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the title property: The entity query title. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: The entity query title. + * + * @param title the title value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the content property: The entity query content to display in timeline. + * + * @return the content value. + */ + public String content() { + return this.innerProperties() == null ? null : this.innerProperties().content(); + } + + /** + * Set the content property: The entity query content to display in timeline. + * + * @param content the content value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withContent(String content) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withContent(content); + return this; + } + + /** + * Get the description property: The entity query description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The entity query description. + * + * @param description the description value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the queryDefinitions property: The Activity query definitions. + * + * @return the queryDefinitions value. + */ + public ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions() { + return this.innerProperties() == null ? null : this.innerProperties().queryDefinitions(); + } + + /** + * Set the queryDefinitions property: The Activity query definitions. + * + * @param queryDefinitions the queryDefinitions value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery + withQueryDefinitions(ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withQueryDefinitions(queryDefinitions); + return this; + } + + /** + * Get the inputEntityType property: The type of the query's source entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.innerProperties() == null ? null : this.innerProperties().inputEntityType(); + } + + /** + * Set the inputEntityType property: The type of the query's source entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withInputEntityType(EntityType inputEntityType) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withInputEntityType(inputEntityType); + return this; + } + + /** + * Get the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @return the requiredInputFieldsSets value. + */ + public List> requiredInputFieldsSets() { + return this.innerProperties() == null ? null : this.innerProperties().requiredInputFieldsSets(); + } + + /** + * Set the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @param requiredInputFieldsSets the requiredInputFieldsSets value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withRequiredInputFieldsSets(List> requiredInputFieldsSets) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withRequiredInputFieldsSets(requiredInputFieldsSets); + return this; + } + + /** + * Get the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @return the entitiesFilter value. + */ + public Map> entitiesFilter() { + return this.innerProperties() == null ? null : this.innerProperties().entitiesFilter(); + } + + /** + * Set the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @param entitiesFilter the entitiesFilter value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withEntitiesFilter(Map> entitiesFilter) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withEntitiesFilter(entitiesFilter); + return this; + } + + /** + * Get the templateName property: The template id this activity was created from. + * + * @return the templateName value. + */ + public String templateName() { + return this.innerProperties() == null ? null : this.innerProperties().templateName(); + } + + /** + * Set the templateName property: The template id this activity was created from. + * + * @param templateName the templateName value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withTemplateName(String templateName) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withTemplateName(templateName); + return this; + } + + /** + * Get the enabled property: Determines whether this activity is enabled or disabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Determines whether this activity is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the ActivityCustomEntityQuery object itself. + */ + public ActivityCustomEntityQuery withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the createdTimeUtc property: The time the activity was created. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); + } + + /** + * Get the lastModifiedTimeUtc property: The last time the activity was updated. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityCustomEntityQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityCustomEntityQuery if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActivityCustomEntityQuery. + */ + public static ActivityCustomEntityQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivityCustomEntityQuery deserializedActivityCustomEntityQuery = new ActivityCustomEntityQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedActivityCustomEntityQuery.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedActivityCustomEntityQuery.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedActivityCustomEntityQuery.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedActivityCustomEntityQuery.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedActivityCustomEntityQuery.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedActivityCustomEntityQuery.kind = CustomEntityQueryKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedActivityCustomEntityQuery.innerProperties + = ActivityEntityQueriesProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActivityCustomEntityQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueriesPropertiesQueryDefinitions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueriesPropertiesQueryDefinitions.java new file mode 100644 index 000000000000..831ca68cfd49 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueriesPropertiesQueryDefinitions.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Activity query definitions. + */ +@Fluent +public final class ActivityEntityQueriesPropertiesQueryDefinitions + implements JsonSerializable { + /* + * The Activity query to run on a given entity + */ + private String query; + + /** + * Creates an instance of ActivityEntityQueriesPropertiesQueryDefinitions class. + */ + public ActivityEntityQueriesPropertiesQueryDefinitions() { + } + + /** + * Get the query property: The Activity query to run on a given entity. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The Activity query to run on a given entity. + * + * @param query the query value to set. + * @return the ActivityEntityQueriesPropertiesQueryDefinitions object itself. + */ + public ActivityEntityQueriesPropertiesQueryDefinitions withQuery(String query) { + this.query = query; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("query", this.query); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityEntityQueriesPropertiesQueryDefinitions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityEntityQueriesPropertiesQueryDefinitions if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActivityEntityQueriesPropertiesQueryDefinitions. + */ + public static ActivityEntityQueriesPropertiesQueryDefinitions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivityEntityQueriesPropertiesQueryDefinitions deserializedActivityEntityQueriesPropertiesQueryDefinitions + = new ActivityEntityQueriesPropertiesQueryDefinitions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("query".equals(fieldName)) { + deserializedActivityEntityQueriesPropertiesQueryDefinitions.query = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActivityEntityQueriesPropertiesQueryDefinitions; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQuery.java new file mode 100644 index 000000000000..bfb59fea75dd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQuery.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ActivityEntityQueriesProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Represents Activity entity query. + */ +@Fluent +public final class ActivityEntityQuery extends EntityQueryInner { + /* + * the entity query kind + */ + private EntityQueryKind kind = EntityQueryKind.ACTIVITY; + + /* + * Activity entity query properties + */ + private ActivityEntityQueriesProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ActivityEntityQuery class. + */ + public ActivityEntityQuery() { + } + + /** + * Get the kind property: the entity query kind. + * + * @return the kind value. + */ + @Override + public EntityQueryKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Activity entity query properties. + * + * @return the innerProperties value. + */ + private ActivityEntityQueriesProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ActivityEntityQuery withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the title property: The entity query title. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: The entity query title. + * + * @param title the title value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the content property: The entity query content to display in timeline. + * + * @return the content value. + */ + public String content() { + return this.innerProperties() == null ? null : this.innerProperties().content(); + } + + /** + * Set the content property: The entity query content to display in timeline. + * + * @param content the content value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withContent(String content) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withContent(content); + return this; + } + + /** + * Get the description property: The entity query description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The entity query description. + * + * @param description the description value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the queryDefinitions property: The Activity query definitions. + * + * @return the queryDefinitions value. + */ + public ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions() { + return this.innerProperties() == null ? null : this.innerProperties().queryDefinitions(); + } + + /** + * Set the queryDefinitions property: The Activity query definitions. + * + * @param queryDefinitions the queryDefinitions value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withQueryDefinitions(ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withQueryDefinitions(queryDefinitions); + return this; + } + + /** + * Get the inputEntityType property: The type of the query's source entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.innerProperties() == null ? null : this.innerProperties().inputEntityType(); + } + + /** + * Set the inputEntityType property: The type of the query's source entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withInputEntityType(EntityType inputEntityType) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withInputEntityType(inputEntityType); + return this; + } + + /** + * Get the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @return the requiredInputFieldsSets value. + */ + public List> requiredInputFieldsSets() { + return this.innerProperties() == null ? null : this.innerProperties().requiredInputFieldsSets(); + } + + /** + * Set the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @param requiredInputFieldsSets the requiredInputFieldsSets value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withRequiredInputFieldsSets(List> requiredInputFieldsSets) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withRequiredInputFieldsSets(requiredInputFieldsSets); + return this; + } + + /** + * Get the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @return the entitiesFilter value. + */ + public Map> entitiesFilter() { + return this.innerProperties() == null ? null : this.innerProperties().entitiesFilter(); + } + + /** + * Set the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @param entitiesFilter the entitiesFilter value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withEntitiesFilter(Map> entitiesFilter) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withEntitiesFilter(entitiesFilter); + return this; + } + + /** + * Get the templateName property: The template id this activity was created from. + * + * @return the templateName value. + */ + public String templateName() { + return this.innerProperties() == null ? null : this.innerProperties().templateName(); + } + + /** + * Set the templateName property: The template id this activity was created from. + * + * @param templateName the templateName value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withTemplateName(String templateName) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withTemplateName(templateName); + return this; + } + + /** + * Get the enabled property: Determines whether this activity is enabled or disabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Determines whether this activity is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the ActivityEntityQuery object itself. + */ + public ActivityEntityQuery withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueriesProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the createdTimeUtc property: The time the activity was created. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); + } + + /** + * Get the lastModifiedTimeUtc property: The last time the activity was updated. + * + * @return the lastModifiedTimeUtc value. + */ + public OffsetDateTime lastModifiedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTimeUtc(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityEntityQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityEntityQuery if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActivityEntityQuery. + */ + public static ActivityEntityQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivityEntityQuery deserializedActivityEntityQuery = new ActivityEntityQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedActivityEntityQuery.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedActivityEntityQuery.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedActivityEntityQuery.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedActivityEntityQuery.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedActivityEntityQuery.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedActivityEntityQuery.kind = EntityQueryKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedActivityEntityQuery.innerProperties = ActivityEntityQueriesProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActivityEntityQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueryTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueryTemplate.java new file mode 100644 index 000000000000..67fe6509e32a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueryTemplate.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ActivityEntityQueryTemplateProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Represents Activity entity query. + */ +@Fluent +public final class ActivityEntityQueryTemplate extends EntityQueryTemplateInner { + /* + * the entity query template kind + */ + private EntityQueryTemplateKind kind = EntityQueryTemplateKind.ACTIVITY; + + /* + * Activity entity query properties + */ + private ActivityEntityQueryTemplateProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ActivityEntityQueryTemplate class. + */ + public ActivityEntityQueryTemplate() { + } + + /** + * Get the kind property: the entity query template kind. + * + * @return the kind value. + */ + @Override + public EntityQueryTemplateKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Activity entity query properties. + * + * @return the innerProperties value. + */ + private ActivityEntityQueryTemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the title property: The entity query title. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: The entity query title. + * + * @param title the title value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the content property: The entity query content to display in timeline. + * + * @return the content value. + */ + public String content() { + return this.innerProperties() == null ? null : this.innerProperties().content(); + } + + /** + * Set the content property: The entity query content to display in timeline. + * + * @param content the content value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate withContent(String content) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withContent(content); + return this; + } + + /** + * Get the description property: The entity query description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The entity query description. + * + * @param description the description value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the queryDefinitions property: The Activity query definitions. + * + * @return the queryDefinitions value. + */ + public ActivityEntityQueryTemplatePropertiesQueryDefinitions queryDefinitions() { + return this.innerProperties() == null ? null : this.innerProperties().queryDefinitions(); + } + + /** + * Set the queryDefinitions property: The Activity query definitions. + * + * @param queryDefinitions the queryDefinitions value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate + withQueryDefinitions(ActivityEntityQueryTemplatePropertiesQueryDefinitions queryDefinitions) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withQueryDefinitions(queryDefinitions); + return this; + } + + /** + * Get the dataTypes property: List of required data types for the given entity query template. + * + * @return the dataTypes value. + */ + public List dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: List of required data types for the given entity query template. + * + * @param dataTypes the dataTypes value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate withDataTypes(List dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the inputEntityType property: The type of the query's source entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.innerProperties() == null ? null : this.innerProperties().inputEntityType(); + } + + /** + * Set the inputEntityType property: The type of the query's source entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate withInputEntityType(EntityType inputEntityType) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withInputEntityType(inputEntityType); + return this; + } + + /** + * Get the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @return the requiredInputFieldsSets value. + */ + public List> requiredInputFieldsSets() { + return this.innerProperties() == null ? null : this.innerProperties().requiredInputFieldsSets(); + } + + /** + * Set the requiredInputFieldsSets property: List of the fields of the source entity that are required to run the + * query. + * + * @param requiredInputFieldsSets the requiredInputFieldsSets value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate withRequiredInputFieldsSets(List> requiredInputFieldsSets) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withRequiredInputFieldsSets(requiredInputFieldsSets); + return this; + } + + /** + * Get the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @return the entitiesFilter value. + */ + public Map> entitiesFilter() { + return this.innerProperties() == null ? null : this.innerProperties().entitiesFilter(); + } + + /** + * Set the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @param entitiesFilter the entitiesFilter value to set. + * @return the ActivityEntityQueryTemplate object itself. + */ + public ActivityEntityQueryTemplate withEntitiesFilter(Map> entitiesFilter) { + if (this.innerProperties() == null) { + this.innerProperties = new ActivityEntityQueryTemplateProperties(); + } + this.innerProperties().withEntitiesFilter(entitiesFilter); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityEntityQueryTemplate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityEntityQueryTemplate if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActivityEntityQueryTemplate. + */ + public static ActivityEntityQueryTemplate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivityEntityQueryTemplate deserializedActivityEntityQueryTemplate = new ActivityEntityQueryTemplate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedActivityEntityQueryTemplate.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedActivityEntityQueryTemplate.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedActivityEntityQueryTemplate.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedActivityEntityQueryTemplate.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedActivityEntityQueryTemplate.kind + = EntityQueryTemplateKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedActivityEntityQueryTemplate.innerProperties + = ActivityEntityQueryTemplateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActivityEntityQueryTemplate; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueryTemplatePropertiesQueryDefinitions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueryTemplatePropertiesQueryDefinitions.java new file mode 100644 index 000000000000..d8de86a6ace6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityEntityQueryTemplatePropertiesQueryDefinitions.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Activity query definitions. + */ +@Fluent +public final class ActivityEntityQueryTemplatePropertiesQueryDefinitions + implements JsonSerializable { + /* + * The Activity query to run on a given entity + */ + private String query; + + /* + * The dimensions we want to summarize the timeline results on, this is comma separated list + */ + private String summarizeBy; + + /** + * Creates an instance of ActivityEntityQueryTemplatePropertiesQueryDefinitions class. + */ + public ActivityEntityQueryTemplatePropertiesQueryDefinitions() { + } + + /** + * Get the query property: The Activity query to run on a given entity. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The Activity query to run on a given entity. + * + * @param query the query value to set. + * @return the ActivityEntityQueryTemplatePropertiesQueryDefinitions object itself. + */ + public ActivityEntityQueryTemplatePropertiesQueryDefinitions withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the summarizeBy property: The dimensions we want to summarize the timeline results on, this is comma + * separated list. + * + * @return the summarizeBy value. + */ + public String summarizeBy() { + return this.summarizeBy; + } + + /** + * Set the summarizeBy property: The dimensions we want to summarize the timeline results on, this is comma + * separated list. + * + * @param summarizeBy the summarizeBy value to set. + * @return the ActivityEntityQueryTemplatePropertiesQueryDefinitions object itself. + */ + public ActivityEntityQueryTemplatePropertiesQueryDefinitions withSummarizeBy(String summarizeBy) { + this.summarizeBy = summarizeBy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeStringField("summarizeBy", this.summarizeBy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityEntityQueryTemplatePropertiesQueryDefinitions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityEntityQueryTemplatePropertiesQueryDefinitions if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActivityEntityQueryTemplatePropertiesQueryDefinitions. + */ + public static ActivityEntityQueryTemplatePropertiesQueryDefinitions fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + ActivityEntityQueryTemplatePropertiesQueryDefinitions deserializedActivityEntityQueryTemplatePropertiesQueryDefinitions + = new ActivityEntityQueryTemplatePropertiesQueryDefinitions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("query".equals(fieldName)) { + deserializedActivityEntityQueryTemplatePropertiesQueryDefinitions.query = reader.getString(); + } else if ("summarizeBy".equals(fieldName)) { + deserializedActivityEntityQueryTemplatePropertiesQueryDefinitions.summarizeBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActivityEntityQueryTemplatePropertiesQueryDefinitions; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityTimelineItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityTimelineItem.java new file mode 100644 index 000000000000..abe422196bba --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ActivityTimelineItem.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents Activity timeline item. + */ +@Fluent +public final class ActivityTimelineItem extends EntityTimelineItem { + /* + * The entity query kind type. + */ + private EntityTimelineKind kind = EntityTimelineKind.ACTIVITY; + + /* + * The activity query id. + */ + private String queryId; + + /* + * The grouping bucket start time. + */ + private OffsetDateTime bucketStartTimeUtc; + + /* + * The grouping bucket end time. + */ + private OffsetDateTime bucketEndTimeUtc; + + /* + * The time of the first activity in the grouping bucket. + */ + private OffsetDateTime firstActivityTimeUtc; + + /* + * The time of the last activity in the grouping bucket. + */ + private OffsetDateTime lastActivityTimeUtc; + + /* + * The activity timeline content. + */ + private String content; + + /* + * The activity timeline title. + */ + private String title; + + /** + * Creates an instance of ActivityTimelineItem class. + */ + public ActivityTimelineItem() { + } + + /** + * Get the kind property: The entity query kind type. + * + * @return the kind value. + */ + @Override + public EntityTimelineKind kind() { + return this.kind; + } + + /** + * Get the queryId property: The activity query id. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: The activity query id. + * + * @param queryId the queryId value to set. + * @return the ActivityTimelineItem object itself. + */ + public ActivityTimelineItem withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the bucketStartTimeUtc property: The grouping bucket start time. + * + * @return the bucketStartTimeUtc value. + */ + public OffsetDateTime bucketStartTimeUtc() { + return this.bucketStartTimeUtc; + } + + /** + * Set the bucketStartTimeUtc property: The grouping bucket start time. + * + * @param bucketStartTimeUtc the bucketStartTimeUtc value to set. + * @return the ActivityTimelineItem object itself. + */ + public ActivityTimelineItem withBucketStartTimeUtc(OffsetDateTime bucketStartTimeUtc) { + this.bucketStartTimeUtc = bucketStartTimeUtc; + return this; + } + + /** + * Get the bucketEndTimeUtc property: The grouping bucket end time. + * + * @return the bucketEndTimeUtc value. + */ + public OffsetDateTime bucketEndTimeUtc() { + return this.bucketEndTimeUtc; + } + + /** + * Set the bucketEndTimeUtc property: The grouping bucket end time. + * + * @param bucketEndTimeUtc the bucketEndTimeUtc value to set. + * @return the ActivityTimelineItem object itself. + */ + public ActivityTimelineItem withBucketEndTimeUtc(OffsetDateTime bucketEndTimeUtc) { + this.bucketEndTimeUtc = bucketEndTimeUtc; + return this; + } + + /** + * Get the firstActivityTimeUtc property: The time of the first activity in the grouping bucket. + * + * @return the firstActivityTimeUtc value. + */ + public OffsetDateTime firstActivityTimeUtc() { + return this.firstActivityTimeUtc; + } + + /** + * Set the firstActivityTimeUtc property: The time of the first activity in the grouping bucket. + * + * @param firstActivityTimeUtc the firstActivityTimeUtc value to set. + * @return the ActivityTimelineItem object itself. + */ + public ActivityTimelineItem withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) { + this.firstActivityTimeUtc = firstActivityTimeUtc; + return this; + } + + /** + * Get the lastActivityTimeUtc property: The time of the last activity in the grouping bucket. + * + * @return the lastActivityTimeUtc value. + */ + public OffsetDateTime lastActivityTimeUtc() { + return this.lastActivityTimeUtc; + } + + /** + * Set the lastActivityTimeUtc property: The time of the last activity in the grouping bucket. + * + * @param lastActivityTimeUtc the lastActivityTimeUtc value to set. + * @return the ActivityTimelineItem object itself. + */ + public ActivityTimelineItem withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc) { + this.lastActivityTimeUtc = lastActivityTimeUtc; + return this; + } + + /** + * Get the content property: The activity timeline content. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: The activity timeline content. + * + * @param content the content value to set. + * @return the ActivityTimelineItem object itself. + */ + public ActivityTimelineItem withContent(String content) { + this.content = content; + return this; + } + + /** + * Get the title property: The activity timeline title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The activity timeline title. + * + * @param title the title value to set. + * @return the ActivityTimelineItem object itself. + */ + public ActivityTimelineItem withTitle(String title) { + this.title = title; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (queryId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property queryId in model ActivityTimelineItem")); + } + if (bucketStartTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property bucketStartTimeUtc in model ActivityTimelineItem")); + } + if (bucketEndTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property bucketEndTimeUtc in model ActivityTimelineItem")); + } + if (firstActivityTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property firstActivityTimeUtc in model ActivityTimelineItem")); + } + if (lastActivityTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property lastActivityTimeUtc in model ActivityTimelineItem")); + } + if (content() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property content in model ActivityTimelineItem")); + } + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property title in model ActivityTimelineItem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActivityTimelineItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("queryId", this.queryId); + jsonWriter.writeStringField("bucketStartTimeUTC", + this.bucketStartTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.bucketStartTimeUtc)); + jsonWriter.writeStringField("bucketEndTimeUTC", + this.bucketEndTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.bucketEndTimeUtc)); + jsonWriter.writeStringField("firstActivityTimeUTC", + this.firstActivityTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.firstActivityTimeUtc)); + jsonWriter.writeStringField("lastActivityTimeUTC", + this.lastActivityTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastActivityTimeUtc)); + jsonWriter.writeStringField("content", this.content); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActivityTimelineItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActivityTimelineItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActivityTimelineItem. + */ + public static ActivityTimelineItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActivityTimelineItem deserializedActivityTimelineItem = new ActivityTimelineItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("queryId".equals(fieldName)) { + deserializedActivityTimelineItem.queryId = reader.getString(); + } else if ("bucketStartTimeUTC".equals(fieldName)) { + deserializedActivityTimelineItem.bucketStartTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("bucketEndTimeUTC".equals(fieldName)) { + deserializedActivityTimelineItem.bucketEndTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("firstActivityTimeUTC".equals(fieldName)) { + deserializedActivityTimelineItem.firstActivityTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastActivityTimeUTC".equals(fieldName)) { + deserializedActivityTimelineItem.lastActivityTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("content".equals(fieldName)) { + deserializedActivityTimelineItem.content = reader.getString(); + } else if ("title".equals(fieldName)) { + deserializedActivityTimelineItem.title = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedActivityTimelineItem.kind = EntityTimelineKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedActivityTimelineItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AddIncidentTaskActionProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AddIncidentTaskActionProperties.java new file mode 100644 index 000000000000..35c846affdfc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AddIncidentTaskActionProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The AddIncidentTaskActionProperties model. + */ +@Fluent +public final class AddIncidentTaskActionProperties implements JsonSerializable { + /* + * The title of the task. + */ + private String title; + + /* + * The description of the task. + */ + private String description; + + /** + * Creates an instance of AddIncidentTaskActionProperties class. + */ + public AddIncidentTaskActionProperties() { + } + + /** + * Get the title property: The title of the task. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The title of the task. + * + * @param title the title value to set. + * @return the AddIncidentTaskActionProperties object itself. + */ + public AddIncidentTaskActionProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: The description of the task. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the task. + * + * @param description the description value to set. + * @return the AddIncidentTaskActionProperties object itself. + */ + public AddIncidentTaskActionProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property title in model AddIncidentTaskActionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AddIncidentTaskActionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AddIncidentTaskActionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AddIncidentTaskActionProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AddIncidentTaskActionProperties. + */ + public static AddIncidentTaskActionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AddIncidentTaskActionProperties deserializedAddIncidentTaskActionProperties + = new AddIncidentTaskActionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedAddIncidentTaskActionProperties.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAddIncidentTaskActionProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAddIncidentTaskActionProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentConfiguration.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentConfiguration.java new file mode 100644 index 000000000000..578e3d52ee9d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentConfiguration.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the configuration of a Business Application Agent. + */ +@Immutable +public class AgentConfiguration implements JsonSerializable { + /* + * Type of the agent + */ + private AgentType type = AgentType.fromString("AgentConfiguration"); + + /** + * Creates an instance of AgentConfiguration class. + */ + public AgentConfiguration() { + } + + /** + * Get the type property: Type of the agent. + * + * @return the type value. + */ + public AgentType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentConfiguration if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentConfiguration. + */ + public static AgentConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SAP".equals(discriminatorValue)) { + return SapAgentConfiguration.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AgentConfiguration fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentConfiguration deserializedAgentConfiguration = new AgentConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedAgentConfiguration.type = AgentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentConfiguration; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentSystem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentSystem.java new file mode 100644 index 000000000000..9f32b63456e0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentSystem.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the configuration of a system inside the agent. + */ +@Fluent +public final class AgentSystem implements JsonSerializable { + /* + * The systemResourceName property. + */ + private String systemResourceName; + + /* + * The systemDisplayName property. + */ + private String systemDisplayName; + + /** + * Creates an instance of AgentSystem class. + */ + public AgentSystem() { + } + + /** + * Get the systemResourceName property: The systemResourceName property. + * + * @return the systemResourceName value. + */ + public String systemResourceName() { + return this.systemResourceName; + } + + /** + * Set the systemResourceName property: The systemResourceName property. + * + * @param systemResourceName the systemResourceName value to set. + * @return the AgentSystem object itself. + */ + public AgentSystem withSystemResourceName(String systemResourceName) { + this.systemResourceName = systemResourceName; + return this; + } + + /** + * Get the systemDisplayName property: The systemDisplayName property. + * + * @return the systemDisplayName value. + */ + public String systemDisplayName() { + return this.systemDisplayName; + } + + /** + * Set the systemDisplayName property: The systemDisplayName property. + * + * @param systemDisplayName the systemDisplayName value to set. + * @return the AgentSystem object itself. + */ + public AgentSystem withSystemDisplayName(String systemDisplayName) { + this.systemDisplayName = systemDisplayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("systemResourceName", this.systemResourceName); + jsonWriter.writeStringField("systemDisplayName", this.systemDisplayName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentSystem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentSystem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentSystem. + */ + public static AgentSystem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentSystem deserializedAgentSystem = new AgentSystem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("systemResourceName".equals(fieldName)) { + deserializedAgentSystem.systemResourceName = reader.getString(); + } else if ("systemDisplayName".equals(fieldName)) { + deserializedAgentSystem.systemDisplayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentSystem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentType.java new file mode 100644 index 000000000000..35f78a9ca691 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AgentType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the agent. + */ +public final class AgentType extends ExpandableStringEnum { + /** + * Static value SAP for AgentType. + */ + public static final AgentType SAP = fromString("SAP"); + + /** + * Creates a new instance of AgentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AgentType() { + } + + /** + * Creates or finds a AgentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgentType. + */ + public static AgentType fromString(String name) { + return fromString(name, AgentType.class); + } + + /** + * Gets known AgentType values. + * + * @return known AgentType values. + */ + public static Collection values() { + return values(AgentType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertDetailsOverride.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertDetailsOverride.java index 66c9ba224248..1c0f2c5401ca 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertDetailsOverride.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertDetailsOverride.java @@ -10,6 +10,7 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; +import java.util.List; /** * Settings for how to dynamically override alert static details. @@ -36,6 +37,11 @@ public final class AlertDetailsOverride implements JsonSerializable alertDynamicProperties; + /** * Creates an instance of AlertDetailsOverride class. */ @@ -122,12 +128,35 @@ public AlertDetailsOverride withAlertSeverityColumnName(String alertSeverityColu return this; } + /** + * Get the alertDynamicProperties property: List of additional dynamic properties to override. + * + * @return the alertDynamicProperties value. + */ + public List alertDynamicProperties() { + return this.alertDynamicProperties; + } + + /** + * Set the alertDynamicProperties property: List of additional dynamic properties to override. + * + * @param alertDynamicProperties the alertDynamicProperties value to set. + * @return the AlertDetailsOverride object itself. + */ + public AlertDetailsOverride withAlertDynamicProperties(List alertDynamicProperties) { + this.alertDynamicProperties = alertDynamicProperties; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (alertDynamicProperties() != null) { + alertDynamicProperties().forEach(e -> e.validate()); + } } /** @@ -140,6 +169,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("alertDescriptionFormat", this.alertDescriptionFormat); jsonWriter.writeStringField("alertTacticsColumnName", this.alertTacticsColumnName); jsonWriter.writeStringField("alertSeverityColumnName", this.alertSeverityColumnName); + jsonWriter.writeArrayField("alertDynamicProperties", this.alertDynamicProperties, + (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -166,6 +197,10 @@ public static AlertDetailsOverride fromJson(JsonReader jsonReader) throws IOExce deserializedAlertDetailsOverride.alertTacticsColumnName = reader.getString(); } else if ("alertSeverityColumnName".equals(fieldName)) { deserializedAlertDetailsOverride.alertSeverityColumnName = reader.getString(); + } else if ("alertDynamicProperties".equals(fieldName)) { + List alertDynamicProperties + = reader.readArray(reader1 -> AlertPropertyMapping.fromJson(reader1)); + deserializedAlertDetailsOverride.alertDynamicProperties = alertDynamicProperties; } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertProperty.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertProperty.java new file mode 100644 index 000000000000..36c17c2e5a9b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertProperty.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The V3 alert property. + */ +public final class AlertProperty extends ExpandableStringEnum { + /** + * Static value AlertLink for AlertProperty. + */ + public static final AlertProperty ALERT_LINK = fromString("AlertLink"); + + /** + * Static value ConfidenceLevel for AlertProperty. + */ + public static final AlertProperty CONFIDENCE_LEVEL = fromString("ConfidenceLevel"); + + /** + * Static value ConfidenceScore for AlertProperty. + */ + public static final AlertProperty CONFIDENCE_SCORE = fromString("ConfidenceScore"); + + /** + * Static value ExtendedLinks for AlertProperty. + */ + public static final AlertProperty EXTENDED_LINKS = fromString("ExtendedLinks"); + + /** + * Static value ProductName for AlertProperty. + */ + public static final AlertProperty PRODUCT_NAME = fromString("ProductName"); + + /** + * Static value ProviderName for AlertProperty. + */ + public static final AlertProperty PROVIDER_NAME = fromString("ProviderName"); + + /** + * Static value ProductComponentName for AlertProperty. + */ + public static final AlertProperty PRODUCT_COMPONENT_NAME = fromString("ProductComponentName"); + + /** + * Static value RemediationSteps for AlertProperty. + */ + public static final AlertProperty REMEDIATION_STEPS = fromString("RemediationSteps"); + + /** + * Static value Techniques for AlertProperty. + */ + public static final AlertProperty TECHNIQUES = fromString("Techniques"); + + /** + * Static value SubTechniques for AlertProperty. + */ + public static final AlertProperty SUB_TECHNIQUES = fromString("SubTechniques"); + + /** + * Creates a new instance of AlertProperty value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AlertProperty() { + } + + /** + * Creates or finds a AlertProperty from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertProperty. + */ + public static AlertProperty fromString(String name) { + return fromString(name, AlertProperty.class); + } + + /** + * Gets known AlertProperty values. + * + * @return known AlertProperty values. + */ + public static Collection values() { + return values(AlertProperty.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertPropertyMapping.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertPropertyMapping.java new file mode 100644 index 000000000000..82ac003c0c89 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertPropertyMapping.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A single alert property mapping to override. + */ +@Fluent +public final class AlertPropertyMapping implements JsonSerializable { + /* + * The V3 alert property + */ + private AlertProperty alertProperty; + + /* + * the column name to use to override this property + */ + private String value; + + /** + * Creates an instance of AlertPropertyMapping class. + */ + public AlertPropertyMapping() { + } + + /** + * Get the alertProperty property: The V3 alert property. + * + * @return the alertProperty value. + */ + public AlertProperty alertProperty() { + return this.alertProperty; + } + + /** + * Set the alertProperty property: The V3 alert property. + * + * @param alertProperty the alertProperty value to set. + * @return the AlertPropertyMapping object itself. + */ + public AlertPropertyMapping withAlertProperty(AlertProperty alertProperty) { + this.alertProperty = alertProperty; + return this; + } + + /** + * Get the value property: the column name to use to override this property. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: the column name to use to override this property. + * + * @param value the value value to set. + * @return the AlertPropertyMapping object itself. + */ + public AlertPropertyMapping withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("alertProperty", this.alertProperty == null ? null : this.alertProperty.toString()); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertPropertyMapping from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertPropertyMapping if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertPropertyMapping. + */ + public static AlertPropertyMapping fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertPropertyMapping deserializedAlertPropertyMapping = new AlertPropertyMapping(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertProperty".equals(fieldName)) { + deserializedAlertPropertyMapping.alertProperty = AlertProperty.fromString(reader.getString()); + } else if ("value".equals(fieldName)) { + deserializedAlertPropertyMapping.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertPropertyMapping; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRule.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRule.java index 85d614bb2a70..9462aef62741 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRule.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRule.java @@ -47,7 +47,7 @@ public interface AlertRule { SystemData systemData(); /** - * Gets the kind property: The alert rule kind. + * Gets the kind property: The kind of the alert rule. * * @return the kind value. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleKind.java index c0f073dc9d89..720213fb35ef 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleKind.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleKind.java @@ -27,6 +27,21 @@ public final class AlertRuleKind extends ExpandableStringEnum { */ public static final AlertRuleKind FUSION = fromString("Fusion"); + /** + * Static value MLBehaviorAnalytics for AlertRuleKind. + */ + public static final AlertRuleKind MLBEHAVIOR_ANALYTICS = fromString("MLBehaviorAnalytics"); + + /** + * Static value ThreatIntelligence for AlertRuleKind. + */ + public static final AlertRuleKind THREAT_INTELLIGENCE = fromString("ThreatIntelligence"); + + /** + * Static value NRT for AlertRuleKind. + */ + public static final AlertRuleKind NRT = fromString("NRT"); + /** * Creates a new instance of AlertRuleKind value. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleOperations.java new file mode 100644 index 000000000000..f76b9fcfc740 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleOperations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.Context; + +/** + * Resource collection API of AlertRuleOperations. + */ +public interface AlertRuleOperations { + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter); + + /** + * triggers analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID. + * @param analyticsRuleRunTriggerParameter The Analytics Rule Run Trigger parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerRuleRun(String resourceGroupName, String workspaceName, String ruleId, + AnalyticsRuleRunTrigger analyticsRuleRunTriggerParameter, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplate.java index 5c19bf607f6a..3744e8327dea 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplate.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplate.java @@ -33,7 +33,7 @@ public interface AlertRuleTemplate { String type(); /** - * Gets the kind property: The alert rule kind. + * Gets the kind property: The kind of the alert rule. * * @return the kind value. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplatePropertiesBase.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplatePropertiesBase.java new file mode 100644 index 000000000000..ed4a06d0858b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplatePropertiesBase.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Base alert rule template property bag. + */ +@Fluent +public class AlertRuleTemplatePropertiesBase implements JsonSerializable { + /* + * the number of alert rules that were created by this template + */ + private Integer alertRulesCreatedByTemplateCount; + + /* + * The last time that this alert rule template has been updated. + */ + private OffsetDateTime lastUpdatedDateUtc; + + /* + * The time that this alert rule template has been added. + */ + private OffsetDateTime createdDateUtc; + + /* + * The description of the alert rule template. + */ + private String description; + + /* + * The display name for alert rule template. + */ + private String displayName; + + /* + * The required data sources for this template + */ + private List requiredDataConnectors; + + /* + * The alert rule template status. + */ + private TemplateStatus status; + + /** + * Creates an instance of AlertRuleTemplatePropertiesBase class. + */ + public AlertRuleTemplatePropertiesBase() { + } + + /** + * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @return the alertRulesCreatedByTemplateCount value. + */ + public Integer alertRulesCreatedByTemplateCount() { + return this.alertRulesCreatedByTemplateCount; + } + + /** + * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set. + * @return the AlertRuleTemplatePropertiesBase object itself. + */ + public AlertRuleTemplatePropertiesBase + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + this.alertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + return this; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + public OffsetDateTime lastUpdatedDateUtc() { + return this.lastUpdatedDateUtc; + } + + /** + * Set the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @param lastUpdatedDateUtc the lastUpdatedDateUtc value to set. + * @return the AlertRuleTemplatePropertiesBase object itself. + */ + AlertRuleTemplatePropertiesBase withLastUpdatedDateUtc(OffsetDateTime lastUpdatedDateUtc) { + this.lastUpdatedDateUtc = lastUpdatedDateUtc; + return this; + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + public OffsetDateTime createdDateUtc() { + return this.createdDateUtc; + } + + /** + * Set the createdDateUtc property: The time that this alert rule template has been added. + * + * @param createdDateUtc the createdDateUtc value to set. + * @return the AlertRuleTemplatePropertiesBase object itself. + */ + AlertRuleTemplatePropertiesBase withCreatedDateUtc(OffsetDateTime createdDateUtc) { + this.createdDateUtc = createdDateUtc; + return this; + } + + /** + * Get the description property: The description of the alert rule template. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the alert rule template. + * + * @param description the description value to set. + * @return the AlertRuleTemplatePropertiesBase object itself. + */ + public AlertRuleTemplatePropertiesBase withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the displayName property: The display name for alert rule template. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name for alert rule template. + * + * @param displayName the displayName value to set. + * @return the AlertRuleTemplatePropertiesBase object itself. + */ + public AlertRuleTemplatePropertiesBase withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the requiredDataConnectors property: The required data sources for this template. + * + * @return the requiredDataConnectors value. + */ + public List requiredDataConnectors() { + return this.requiredDataConnectors; + } + + /** + * Set the requiredDataConnectors property: The required data sources for this template. + * + * @param requiredDataConnectors the requiredDataConnectors value to set. + * @return the AlertRuleTemplatePropertiesBase object itself. + */ + public AlertRuleTemplatePropertiesBase + withRequiredDataConnectors(List requiredDataConnectors) { + this.requiredDataConnectors = requiredDataConnectors; + return this; + } + + /** + * Get the status property: The alert rule template status. + * + * @return the status value. + */ + public TemplateStatus status() { + return this.status; + } + + /** + * Set the status property: The alert rule template status. + * + * @param status the status value to set. + * @return the AlertRuleTemplatePropertiesBase object itself. + */ + public AlertRuleTemplatePropertiesBase withStatus(TemplateStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requiredDataConnectors() != null) { + requiredDataConnectors().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", this.alertRulesCreatedByTemplateCount); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeArrayField("requiredDataConnectors", this.requiredDataConnectors, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertRuleTemplatePropertiesBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertRuleTemplatePropertiesBase if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertRuleTemplatePropertiesBase. + */ + public static AlertRuleTemplatePropertiesBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertRuleTemplatePropertiesBase deserializedAlertRuleTemplatePropertiesBase + = new AlertRuleTemplatePropertiesBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertRulesCreatedByTemplateCount".equals(fieldName)) { + deserializedAlertRuleTemplatePropertiesBase.alertRulesCreatedByTemplateCount + = reader.getNullable(JsonReader::getInt); + } else if ("lastUpdatedDateUTC".equals(fieldName)) { + deserializedAlertRuleTemplatePropertiesBase.lastUpdatedDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateUTC".equals(fieldName)) { + deserializedAlertRuleTemplatePropertiesBase.createdDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("description".equals(fieldName)) { + deserializedAlertRuleTemplatePropertiesBase.description = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedAlertRuleTemplatePropertiesBase.displayName = reader.getString(); + } else if ("requiredDataConnectors".equals(fieldName)) { + List requiredDataConnectors + = reader.readArray(reader1 -> AlertRuleTemplateDataSource.fromJson(reader1)); + deserializedAlertRuleTemplatePropertiesBase.requiredDataConnectors = requiredDataConnectors; + } else if ("status".equals(fieldName)) { + deserializedAlertRuleTemplatePropertiesBase.status = TemplateStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertRuleTemplatePropertiesBase; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplateWithMitreProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplateWithMitreProperties.java new file mode 100644 index 000000000000..adbdc51250a7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertRuleTemplateWithMitreProperties.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Alert rule template with MITRE property bag. + */ +@Fluent +public class AlertRuleTemplateWithMitreProperties extends AlertRuleTemplatePropertiesBase { + /* + * The tactics of the alert rule + */ + private List tactics; + + /* + * The techniques of the alert rule + */ + private List techniques; + + /* + * The time that this alert rule template has been added. + */ + private OffsetDateTime createdDateUtc; + + /* + * The last time that this alert rule template has been updated. + */ + private OffsetDateTime lastUpdatedDateUtc; + + /** + * Creates an instance of AlertRuleTemplateWithMitreProperties class. + */ + public AlertRuleTemplateWithMitreProperties() { + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.tactics; + } + + /** + * Set the tactics property: The tactics of the alert rule. + * + * @param tactics the tactics value to set. + * @return the AlertRuleTemplateWithMitreProperties object itself. + */ + public AlertRuleTemplateWithMitreProperties withTactics(List tactics) { + this.tactics = tactics; + return this; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Set the techniques property: The techniques of the alert rule. + * + * @param techniques the techniques value to set. + * @return the AlertRuleTemplateWithMitreProperties object itself. + */ + public AlertRuleTemplateWithMitreProperties withTechniques(List techniques) { + this.techniques = techniques; + return this; + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + @Override + public OffsetDateTime createdDateUtc() { + return this.createdDateUtc; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + @Override + public OffsetDateTime lastUpdatedDateUtc() { + return this.lastUpdatedDateUtc; + } + + /** + * {@inheritDoc} + */ + @Override + public AlertRuleTemplateWithMitreProperties + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + super.withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AlertRuleTemplateWithMitreProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AlertRuleTemplateWithMitreProperties withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AlertRuleTemplateWithMitreProperties + withRequiredDataConnectors(List requiredDataConnectors) { + super.withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AlertRuleTemplateWithMitreProperties withStatus(TemplateStatus status) { + super.withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (requiredDataConnectors() != null) { + requiredDataConnectors().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", alertRulesCreatedByTemplateCount()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("displayName", displayName()); + jsonWriter.writeArrayField("requiredDataConnectors", requiredDataConnectors(), + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("status", status() == null ? null : status().toString()); + jsonWriter.writeArrayField("tactics", this.tactics, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertRuleTemplateWithMitreProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertRuleTemplateWithMitreProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertRuleTemplateWithMitreProperties. + */ + public static AlertRuleTemplateWithMitreProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertRuleTemplateWithMitreProperties deserializedAlertRuleTemplateWithMitreProperties + = new AlertRuleTemplateWithMitreProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertRulesCreatedByTemplateCount".equals(fieldName)) { + deserializedAlertRuleTemplateWithMitreProperties + .withAlertRulesCreatedByTemplateCount(reader.getNullable(JsonReader::getInt)); + } else if ("lastUpdatedDateUTC".equals(fieldName)) { + deserializedAlertRuleTemplateWithMitreProperties.lastUpdatedDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdDateUTC".equals(fieldName)) { + deserializedAlertRuleTemplateWithMitreProperties.createdDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("description".equals(fieldName)) { + deserializedAlertRuleTemplateWithMitreProperties.withDescription(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedAlertRuleTemplateWithMitreProperties.withDisplayName(reader.getString()); + } else if ("requiredDataConnectors".equals(fieldName)) { + List requiredDataConnectors + = reader.readArray(reader1 -> AlertRuleTemplateDataSource.fromJson(reader1)); + deserializedAlertRuleTemplateWithMitreProperties.withRequiredDataConnectors(requiredDataConnectors); + } else if ("status".equals(fieldName)) { + deserializedAlertRuleTemplateWithMitreProperties + .withStatus(TemplateStatus.fromString(reader.getString())); + } else if ("tactics".equals(fieldName)) { + List tactics + = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); + deserializedAlertRuleTemplateWithMitreProperties.tactics = tactics; + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedAlertRuleTemplateWithMitreProperties.techniques = techniques; + } else { + reader.skipChildren(); + } + } + + return deserializedAlertRuleTemplateWithMitreProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertsDataTypeOfDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertsDataTypeOfDataConnector.java index dc8fd6623891..63f53121332b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertsDataTypeOfDataConnector.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AlertsDataTypeOfDataConnector.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -53,11 +54,17 @@ public AlertsDataTypeOfDataConnector withAlerts(DataConnectorDataTypeCommon aler * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (alerts() != null) { + if (alerts() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property alerts in model AlertsDataTypeOfDataConnector")); + } else { alerts().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(AlertsDataTypeOfDataConnector.class); + /** * {@inheritDoc} */ @@ -74,6 +81,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of AlertsDataTypeOfDataConnector if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the AlertsDataTypeOfDataConnector. */ public static AlertsDataTypeOfDataConnector fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AnalyticsRuleRunTrigger.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AnalyticsRuleRunTrigger.java new file mode 100644 index 000000000000..e37abf83c59b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AnalyticsRuleRunTrigger.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AnalyticsRuleRunTriggerProperties; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Analytics Rule Run Trigger request. + */ +@Fluent +public final class AnalyticsRuleRunTrigger implements JsonSerializable { + /* + * The analytics Rule Run Trigger request + */ + private AnalyticsRuleRunTriggerProperties innerProperties = new AnalyticsRuleRunTriggerProperties(); + + /** + * Creates an instance of AnalyticsRuleRunTrigger class. + */ + public AnalyticsRuleRunTrigger() { + } + + /** + * Get the innerProperties property: The analytics Rule Run Trigger request. + * + * @return the innerProperties value. + */ + private AnalyticsRuleRunTriggerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the executionTimeUtc property: The executionTimeUtc property. + * + * @return the executionTimeUtc value. + */ + public OffsetDateTime executionTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().executionTimeUtc(); + } + + /** + * Set the executionTimeUtc property: The executionTimeUtc property. + * + * @param executionTimeUtc the executionTimeUtc value to set. + * @return the AnalyticsRuleRunTrigger object itself. + */ + public AnalyticsRuleRunTrigger withExecutionTimeUtc(OffsetDateTime executionTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new AnalyticsRuleRunTriggerProperties(); + } + this.innerProperties().withExecutionTimeUtc(executionTimeUtc); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model AnalyticsRuleRunTrigger")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AnalyticsRuleRunTrigger.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnalyticsRuleRunTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnalyticsRuleRunTrigger if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AnalyticsRuleRunTrigger. + */ + public static AnalyticsRuleRunTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnalyticsRuleRunTrigger deserializedAnalyticsRuleRunTrigger = new AnalyticsRuleRunTrigger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedAnalyticsRuleRunTrigger.innerProperties + = AnalyticsRuleRunTriggerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAnalyticsRuleRunTrigger; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Anomalies.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Anomalies.java new file mode 100644 index 000000000000..9bb590acff31 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Anomalies.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AnomaliesSettingsProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import java.io.IOException; + +/** + * Settings with single toggle. + */ +@Fluent +public final class Anomalies extends SettingsInner { + /* + * The kind of the setting + */ + private SettingKind kind = SettingKind.ANOMALIES; + + /* + * Anomalies properties + */ + private AnomaliesSettingsProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of Anomalies class. + */ + public Anomalies() { + } + + /** + * Get the kind property: The kind of the setting. + * + * @return the kind value. + */ + @Override + public SettingKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Anomalies properties. + * + * @return the innerProperties value. + */ + private AnomaliesSettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public Anomalies withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the isEnabled property: Determines whether the setting is enable or disabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Anomalies from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Anomalies if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Anomalies. + */ + public static Anomalies fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Anomalies deserializedAnomalies = new Anomalies(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAnomalies.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAnomalies.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAnomalies.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedAnomalies.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedAnomalies.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedAnomalies.kind = SettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAnomalies.innerProperties = AnomaliesSettingsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAnomalies; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AnomalyTimelineItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AnomalyTimelineItem.java new file mode 100644 index 000000000000..70ce2d25949c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AnomalyTimelineItem.java @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Represents anomaly timeline item. + */ +@Fluent +public final class AnomalyTimelineItem extends EntityTimelineItem { + /* + * The entity query kind type. + */ + private EntityTimelineKind kind = EntityTimelineKind.ANOMALY; + + /* + * The anomaly azure resource id. + */ + private String azureResourceId; + + /* + * The anomaly product name. + */ + private String productName; + + /* + * The anomaly description. + */ + private String description; + + /* + * The anomaly name. + */ + private String displayName; + + /* + * The anomaly end time. + */ + private OffsetDateTime endTimeUtc; + + /* + * The anomaly start time. + */ + private OffsetDateTime startTimeUtc; + + /* + * The anomaly generated time. + */ + private OffsetDateTime timeGenerated; + + /* + * The name of the anomaly vendor. + */ + private String vendor; + + /* + * The intent of the anomaly. + */ + private String intent; + + /* + * The techniques of the anomaly. + */ + private List techniques; + + /* + * The reasons that cause the anomaly. + */ + private List reasons; + + /** + * Creates an instance of AnomalyTimelineItem class. + */ + public AnomalyTimelineItem() { + } + + /** + * Get the kind property: The entity query kind type. + * + * @return the kind value. + */ + @Override + public EntityTimelineKind kind() { + return this.kind; + } + + /** + * Get the azureResourceId property: The anomaly azure resource id. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: The anomaly azure resource id. + * + * @param azureResourceId the azureResourceId value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the productName property: The anomaly product name. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Set the productName property: The anomaly product name. + * + * @param productName the productName value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withProductName(String productName) { + this.productName = productName; + return this; + } + + /** + * Get the description property: The anomaly description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The anomaly description. + * + * @param description the description value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the displayName property: The anomaly name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The anomaly name. + * + * @param displayName the displayName value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the endTimeUtc property: The anomaly end time. + * + * @return the endTimeUtc value. + */ + public OffsetDateTime endTimeUtc() { + return this.endTimeUtc; + } + + /** + * Set the endTimeUtc property: The anomaly end time. + * + * @param endTimeUtc the endTimeUtc value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withEndTimeUtc(OffsetDateTime endTimeUtc) { + this.endTimeUtc = endTimeUtc; + return this; + } + + /** + * Get the startTimeUtc property: The anomaly start time. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Set the startTimeUtc property: The anomaly start time. + * + * @param startTimeUtc the startTimeUtc value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withStartTimeUtc(OffsetDateTime startTimeUtc) { + this.startTimeUtc = startTimeUtc; + return this; + } + + /** + * Get the timeGenerated property: The anomaly generated time. + * + * @return the timeGenerated value. + */ + public OffsetDateTime timeGenerated() { + return this.timeGenerated; + } + + /** + * Set the timeGenerated property: The anomaly generated time. + * + * @param timeGenerated the timeGenerated value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withTimeGenerated(OffsetDateTime timeGenerated) { + this.timeGenerated = timeGenerated; + return this; + } + + /** + * Get the vendor property: The name of the anomaly vendor. + * + * @return the vendor value. + */ + public String vendor() { + return this.vendor; + } + + /** + * Set the vendor property: The name of the anomaly vendor. + * + * @param vendor the vendor value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withVendor(String vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get the intent property: The intent of the anomaly. + * + * @return the intent value. + */ + public String intent() { + return this.intent; + } + + /** + * Set the intent property: The intent of the anomaly. + * + * @param intent the intent value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withIntent(String intent) { + this.intent = intent; + return this; + } + + /** + * Get the techniques property: The techniques of the anomaly. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Set the techniques property: The techniques of the anomaly. + * + * @param techniques the techniques value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withTechniques(List techniques) { + this.techniques = techniques; + return this; + } + + /** + * Get the reasons property: The reasons that cause the anomaly. + * + * @return the reasons value. + */ + public List reasons() { + return this.reasons; + } + + /** + * Set the reasons property: The reasons that cause the anomaly. + * + * @param reasons the reasons value to set. + * @return the AnomalyTimelineItem object itself. + */ + public AnomalyTimelineItem withReasons(List reasons) { + this.reasons = reasons; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (azureResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureResourceId in model AnomalyTimelineItem")); + } + if (displayName() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property displayName in model AnomalyTimelineItem")); + } + if (endTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property endTimeUtc in model AnomalyTimelineItem")); + } + if (startTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startTimeUtc in model AnomalyTimelineItem")); + } + if (timeGenerated() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeGenerated in model AnomalyTimelineItem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AnomalyTimelineItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureResourceId", this.azureResourceId); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("endTimeUtc", + this.endTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTimeUtc)); + jsonWriter.writeStringField("startTimeUtc", + this.startTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTimeUtc)); + jsonWriter.writeStringField("timeGenerated", + this.timeGenerated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timeGenerated)); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("productName", this.productName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("vendor", this.vendor); + jsonWriter.writeStringField("intent", this.intent); + jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("reasons", this.reasons, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnomalyTimelineItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnomalyTimelineItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AnomalyTimelineItem. + */ + public static AnomalyTimelineItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnomalyTimelineItem deserializedAnomalyTimelineItem = new AnomalyTimelineItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureResourceId".equals(fieldName)) { + deserializedAnomalyTimelineItem.azureResourceId = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedAnomalyTimelineItem.displayName = reader.getString(); + } else if ("endTimeUtc".equals(fieldName)) { + deserializedAnomalyTimelineItem.endTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("startTimeUtc".equals(fieldName)) { + deserializedAnomalyTimelineItem.startTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("timeGenerated".equals(fieldName)) { + deserializedAnomalyTimelineItem.timeGenerated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("kind".equals(fieldName)) { + deserializedAnomalyTimelineItem.kind = EntityTimelineKind.fromString(reader.getString()); + } else if ("productName".equals(fieldName)) { + deserializedAnomalyTimelineItem.productName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAnomalyTimelineItem.description = reader.getString(); + } else if ("vendor".equals(fieldName)) { + deserializedAnomalyTimelineItem.vendor = reader.getString(); + } else if ("intent".equals(fieldName)) { + deserializedAnomalyTimelineItem.intent = reader.getString(); + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedAnomalyTimelineItem.techniques = techniques; + } else if ("reasons".equals(fieldName)) { + List reasons = reader.readArray(reader1 -> reader1.getString()); + deserializedAnomalyTimelineItem.reasons = reasons; + } else { + reader.skipChildren(); + } + } + + return deserializedAnomalyTimelineItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ApiKeyAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ApiKeyAuthModel.java new file mode 100644 index 000000000000..ca005b211795 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ApiKeyAuthModel.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for authentication with the API Key. Will result in additional header on the request (default behavior) to the + * remote server: 'ApiKeyName: ApiKeyIdentifier ApiKey'. If 'IsApiKeyInPostPayload' is true it will send it in the body + * of the request and not the header. + */ +@Fluent +public final class ApiKeyAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.APIKEY; + + /* + * API Key for the user secret key credential + */ + private String apiKey; + + /* + * API Key name + */ + private String apiKeyName; + + /* + * API Key Identifier + */ + private String apiKeyIdentifier; + + /* + * Flag to indicate if API key is set in HTTP POST payload + */ + private Boolean isApiKeyInPostPayload; + + /** + * Creates an instance of ApiKeyAuthModel class. + */ + public ApiKeyAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the apiKey property: API Key for the user secret key credential. + * + * @return the apiKey value. + */ + public String apiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: API Key for the user secret key credential. + * + * @param apiKey the apiKey value to set. + * @return the ApiKeyAuthModel object itself. + */ + public ApiKeyAuthModel withApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Get the apiKeyName property: API Key name. + * + * @return the apiKeyName value. + */ + public String apiKeyName() { + return this.apiKeyName; + } + + /** + * Set the apiKeyName property: API Key name. + * + * @param apiKeyName the apiKeyName value to set. + * @return the ApiKeyAuthModel object itself. + */ + public ApiKeyAuthModel withApiKeyName(String apiKeyName) { + this.apiKeyName = apiKeyName; + return this; + } + + /** + * Get the apiKeyIdentifier property: API Key Identifier. + * + * @return the apiKeyIdentifier value. + */ + public String apiKeyIdentifier() { + return this.apiKeyIdentifier; + } + + /** + * Set the apiKeyIdentifier property: API Key Identifier. + * + * @param apiKeyIdentifier the apiKeyIdentifier value to set. + * @return the ApiKeyAuthModel object itself. + */ + public ApiKeyAuthModel withApiKeyIdentifier(String apiKeyIdentifier) { + this.apiKeyIdentifier = apiKeyIdentifier; + return this; + } + + /** + * Get the isApiKeyInPostPayload property: Flag to indicate if API key is set in HTTP POST payload. + * + * @return the isApiKeyInPostPayload value. + */ + public Boolean isApiKeyInPostPayload() { + return this.isApiKeyInPostPayload; + } + + /** + * Set the isApiKeyInPostPayload property: Flag to indicate if API key is set in HTTP POST payload. + * + * @param isApiKeyInPostPayload the isApiKeyInPostPayload value to set. + * @return the ApiKeyAuthModel object itself. + */ + public ApiKeyAuthModel withIsApiKeyInPostPayload(Boolean isApiKeyInPostPayload) { + this.isApiKeyInPostPayload = isApiKeyInPostPayload; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (apiKey() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property apiKey in model ApiKeyAuthModel")); + } + if (apiKeyName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property apiKeyName in model ApiKeyAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApiKeyAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("apiKey", this.apiKey); + jsonWriter.writeStringField("apiKeyName", this.apiKeyName); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("apiKeyIdentifier", this.apiKeyIdentifier); + jsonWriter.writeBooleanField("isApiKeyInPostPayload", this.isApiKeyInPostPayload); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiKeyAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiKeyAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApiKeyAuthModel. + */ + public static ApiKeyAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiKeyAuthModel deserializedApiKeyAuthModel = new ApiKeyAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("apiKey".equals(fieldName)) { + deserializedApiKeyAuthModel.apiKey = reader.getString(); + } else if ("apiKeyName".equals(fieldName)) { + deserializedApiKeyAuthModel.apiKeyName = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedApiKeyAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else if ("apiKeyIdentifier".equals(fieldName)) { + deserializedApiKeyAuthModel.apiKeyIdentifier = reader.getString(); + } else if ("isApiKeyInPostPayload".equals(fieldName)) { + deserializedApiKeyAuthModel.isApiKeyInPostPayload = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedApiKeyAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AscCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AscCheckRequirements.java new file mode 100644 index 000000000000..7d2a768892f1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AscCheckRequirements.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AscCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents ASC (Azure Security Center) requirements check request. + */ +@Fluent +public final class AscCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.AZURE_SECURITY_CENTER; + + /* + * ASC (Azure Security Center) requirements check properties. + */ + private AscCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of AscCheckRequirements class. + */ + public AscCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: ASC (Azure Security Center) requirements check properties. + * + * @return the innerProperties value. + */ + AscCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); + } + + /** + * Set the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the AscCheckRequirements object itself. + */ + public AscCheckRequirements withSubscriptionId(String subscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new AscCheckRequirementsProperties(); + } + this.innerProperties().withSubscriptionId(subscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AscCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AscCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AscCheckRequirements. + */ + public static AscCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AscCheckRequirements deserializedAscCheckRequirements = new AscCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedAscCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAscCheckRequirements.innerProperties = AscCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAscCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AssignmentItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AssignmentItem.java new file mode 100644 index 000000000000..4b545356acf4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AssignmentItem.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An entity describing a content item. + */ +@Fluent +public final class AssignmentItem implements JsonSerializable { + /* + * The resource id of the content item + */ + private String resourceId; + + /** + * Creates an instance of AssignmentItem class. + */ + public AssignmentItem() { + } + + /** + * Get the resourceId property: The resource id of the content item. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource id of the content item. + * + * @param resourceId the resourceId value to set. + * @return the AssignmentItem object itself. + */ + public AssignmentItem withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignmentItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignmentItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AssignmentItem. + */ + public static AssignmentItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignmentItem deserializedAssignmentItem = new AssignmentItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedAssignmentItem.resourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignmentItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AttackPattern.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AttackPattern.java new file mode 100644 index 000000000000..8de0de540468 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AttackPattern.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectCommonProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Represents an attack pattern in Azure Security Insights. + */ +@Immutable +public final class AttackPattern extends TIObjectInner { + /* + * The kind of the TI object + */ + private TIObjectKind kind = TIObjectKind.ATTACK_PATTERN; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The properties of the TI object + */ + private TIObjectCommonProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AttackPattern class. + */ + public AttackPattern() { + } + + /** + * Get the kind property: The kind of the TI object. + * + * @return the kind value. + */ + @Override + public TIObjectKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of the TI object. + * + * @return the innerProperties value. + */ + private TIObjectCommonProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + public Map data() { + return this.innerProperties() == null ? null : this.innerProperties().data(); + } + + /** + * Get the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the source property: The source name for this TI object. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Get the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + public OffsetDateTime firstIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().firstIngestedTimeUtc(); + } + + /** + * Get the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + public OffsetDateTime lastIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastIngestedTimeUtc(); + } + + /** + * Get the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + public UUID ingestionRulesVersion() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionRulesVersion(); + } + + /** + * Get the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + public String lastUpdateMethod() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateMethod(); + } + + /** + * Get the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + public UserInfo lastModifiedBy() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy(); + } + + /** + * Get the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateTimeUtc(); + } + + /** + * Get the relationshipHints property: A dictionary used to help follow relationships from this object to other STIX + * objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of sources + * that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + public List relationshipHints() { + return this.innerProperties() == null ? null : this.innerProperties().relationshipHints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AttackPattern from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AttackPattern if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AttackPattern. + */ + public static AttackPattern fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AttackPattern deserializedAttackPattern = new AttackPattern(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAttackPattern.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAttackPattern.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAttackPattern.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAttackPattern.innerProperties = TIObjectCommonProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAttackPattern.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedAttackPattern.kind = TIObjectKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAttackPattern; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleAction.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleAction.java index 00ef7f0be3b2..77c4ac1d9201 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleAction.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleAction.java @@ -105,7 +105,9 @@ public static AutomationRuleAction fromJson(JsonReader jsonReader) throws IOExce } } // Use the discriminator value to determine which subtype should be deserialized. - if ("ModifyProperties".equals(discriminatorValue)) { + if ("AddIncidentTask".equals(discriminatorValue)) { + return AutomationRuleAddIncidentTaskAction.fromJson(readerToUse.reset()); + } else if ("ModifyProperties".equals(discriminatorValue)) { return AutomationRuleModifyPropertiesAction.fromJson(readerToUse.reset()); } else if ("RunPlaybook".equals(discriminatorValue)) { return AutomationRuleRunPlaybookAction.fromJson(readerToUse.reset()); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleAddIncidentTaskAction.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleAddIncidentTaskAction.java new file mode 100644 index 000000000000..acf024ffade4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleAddIncidentTaskAction.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes an automation rule action to add a task to an incident. + */ +@Fluent +public final class AutomationRuleAddIncidentTaskAction extends AutomationRuleAction { + /* + * The type of the automation rule action. + */ + private ActionType actionType = ActionType.ADD_INCIDENT_TASK; + + /* + * The actionConfiguration property. + */ + private AddIncidentTaskActionProperties actionConfiguration; + + /** + * Creates an instance of AutomationRuleAddIncidentTaskAction class. + */ + public AutomationRuleAddIncidentTaskAction() { + } + + /** + * Get the actionType property: The type of the automation rule action. + * + * @return the actionType value. + */ + @Override + public ActionType actionType() { + return this.actionType; + } + + /** + * Get the actionConfiguration property: The actionConfiguration property. + * + * @return the actionConfiguration value. + */ + public AddIncidentTaskActionProperties actionConfiguration() { + return this.actionConfiguration; + } + + /** + * Set the actionConfiguration property: The actionConfiguration property. + * + * @param actionConfiguration the actionConfiguration value to set. + * @return the AutomationRuleAddIncidentTaskAction object itself. + */ + public AutomationRuleAddIncidentTaskAction + withActionConfiguration(AddIncidentTaskActionProperties actionConfiguration) { + this.actionConfiguration = actionConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AutomationRuleAddIncidentTaskAction withOrder(int order) { + super.withOrder(order); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (actionConfiguration() != null) { + actionConfiguration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("order", order()); + jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString()); + jsonWriter.writeJsonField("actionConfiguration", this.actionConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationRuleAddIncidentTaskAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationRuleAddIncidentTaskAction if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutomationRuleAddIncidentTaskAction. + */ + public static AutomationRuleAddIncidentTaskAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationRuleAddIncidentTaskAction deserializedAutomationRuleAddIncidentTaskAction + = new AutomationRuleAddIncidentTaskAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("order".equals(fieldName)) { + deserializedAutomationRuleAddIncidentTaskAction.withOrder(reader.getInt()); + } else if ("actionType".equals(fieldName)) { + deserializedAutomationRuleAddIncidentTaskAction.actionType + = ActionType.fromString(reader.getString()); + } else if ("actionConfiguration".equals(fieldName)) { + deserializedAutomationRuleAddIncidentTaskAction.actionConfiguration + = AddIncidentTaskActionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationRuleAddIncidentTaskAction; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleBooleanCondition.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleBooleanCondition.java new file mode 100644 index 000000000000..79f8afde3ed9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleBooleanCondition.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The AutomationRuleBooleanCondition model. + */ +@Fluent +public final class AutomationRuleBooleanCondition implements JsonSerializable { + /* + * The operator property. + */ + private AutomationRuleBooleanConditionSupportedOperator operator; + + /* + * The innerConditions property. + */ + private List innerConditions; + + /** + * Creates an instance of AutomationRuleBooleanCondition class. + */ + public AutomationRuleBooleanCondition() { + } + + /** + * Get the operator property: The operator property. + * + * @return the operator value. + */ + public AutomationRuleBooleanConditionSupportedOperator operator() { + return this.operator; + } + + /** + * Set the operator property: The operator property. + * + * @param operator the operator value to set. + * @return the AutomationRuleBooleanCondition object itself. + */ + public AutomationRuleBooleanCondition withOperator(AutomationRuleBooleanConditionSupportedOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the innerConditions property: The innerConditions property. + * + * @return the innerConditions value. + */ + public List innerConditions() { + return this.innerConditions; + } + + /** + * Set the innerConditions property: The innerConditions property. + * + * @param innerConditions the innerConditions value to set. + * @return the AutomationRuleBooleanCondition object itself. + */ + public AutomationRuleBooleanCondition withInnerConditions(List innerConditions) { + this.innerConditions = innerConditions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerConditions() != null) { + innerConditions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString()); + jsonWriter.writeArrayField("innerConditions", this.innerConditions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationRuleBooleanCondition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationRuleBooleanCondition if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationRuleBooleanCondition. + */ + public static AutomationRuleBooleanCondition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationRuleBooleanCondition deserializedAutomationRuleBooleanCondition + = new AutomationRuleBooleanCondition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operator".equals(fieldName)) { + deserializedAutomationRuleBooleanCondition.operator + = AutomationRuleBooleanConditionSupportedOperator.fromString(reader.getString()); + } else if ("innerConditions".equals(fieldName)) { + List innerConditions + = reader.readArray(reader1 -> AutomationRuleCondition.fromJson(reader1)); + deserializedAutomationRuleBooleanCondition.innerConditions = innerConditions; + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationRuleBooleanCondition; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleBooleanConditionSupportedOperator.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleBooleanConditionSupportedOperator.java new file mode 100644 index 000000000000..53904286281d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleBooleanConditionSupportedOperator.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for AutomationRuleBooleanConditionSupportedOperator. + */ +public final class AutomationRuleBooleanConditionSupportedOperator + extends ExpandableStringEnum { + /** + * Static value And for AutomationRuleBooleanConditionSupportedOperator. + */ + public static final AutomationRuleBooleanConditionSupportedOperator AND = fromString("And"); + + /** + * Static value Or for AutomationRuleBooleanConditionSupportedOperator. + */ + public static final AutomationRuleBooleanConditionSupportedOperator OR = fromString("Or"); + + /** + * Creates a new instance of AutomationRuleBooleanConditionSupportedOperator value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutomationRuleBooleanConditionSupportedOperator() { + } + + /** + * Creates or finds a AutomationRuleBooleanConditionSupportedOperator from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutomationRuleBooleanConditionSupportedOperator. + */ + public static AutomationRuleBooleanConditionSupportedOperator fromString(String name) { + return fromString(name, AutomationRuleBooleanConditionSupportedOperator.class); + } + + /** + * Gets known AutomationRuleBooleanConditionSupportedOperator values. + * + * @return known AutomationRuleBooleanConditionSupportedOperator values. + */ + public static Collection values() { + return values(AutomationRuleBooleanConditionSupportedOperator.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleCondition.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleCondition.java index fecdd611b9cf..199999631f3c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleCondition.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRuleCondition.java @@ -78,8 +78,12 @@ public static AutomationRuleCondition fromJson(JsonReader jsonReader) throws IOE } } // Use the discriminator value to determine which subtype should be deserialized. - if ("PropertyArrayChanged".equals(discriminatorValue)) { + if ("Boolean".equals(discriminatorValue)) { + return BooleanConditionProperties.fromJson(readerToUse.reset()); + } else if ("PropertyArrayChanged".equals(discriminatorValue)) { return PropertyArrayChangedConditionProperties.fromJson(readerToUse.reset()); + } else if ("PropertyArray".equals(discriminatorValue)) { + return PropertyArrayConditionProperties.fromJson(readerToUse.reset()); } else if ("PropertyChanged".equals(discriminatorValue)) { return PropertyChangedConditionProperties.fromJson(readerToUse.reset()); } else if ("Property".equals(discriminatorValue)) { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayConditionSupportedArrayConditionType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayConditionSupportedArrayConditionType.java new file mode 100644 index 000000000000..9a6ba0d7e21d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayConditionSupportedArrayConditionType.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for AutomationRulePropertyArrayConditionSupportedArrayConditionType. + */ +public final class AutomationRulePropertyArrayConditionSupportedArrayConditionType + extends ExpandableStringEnum { + /** + * Static value AnyItem for AutomationRulePropertyArrayConditionSupportedArrayConditionType. + */ + public static final AutomationRulePropertyArrayConditionSupportedArrayConditionType ANY_ITEM + = fromString("AnyItem"); + + /** + * Static value AllItems for AutomationRulePropertyArrayConditionSupportedArrayConditionType. + */ + public static final AutomationRulePropertyArrayConditionSupportedArrayConditionType ALL_ITEMS + = fromString("AllItems"); + + /** + * Creates a new instance of AutomationRulePropertyArrayConditionSupportedArrayConditionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutomationRulePropertyArrayConditionSupportedArrayConditionType() { + } + + /** + * Creates or finds a AutomationRulePropertyArrayConditionSupportedArrayConditionType from its string + * representation. + * + * @param name a name to look for. + * @return the corresponding AutomationRulePropertyArrayConditionSupportedArrayConditionType. + */ + public static AutomationRulePropertyArrayConditionSupportedArrayConditionType fromString(String name) { + return fromString(name, AutomationRulePropertyArrayConditionSupportedArrayConditionType.class); + } + + /** + * Gets known AutomationRulePropertyArrayConditionSupportedArrayConditionType values. + * + * @return known AutomationRulePropertyArrayConditionSupportedArrayConditionType values. + */ + public static Collection values() { + return values(AutomationRulePropertyArrayConditionSupportedArrayConditionType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayConditionSupportedArrayType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayConditionSupportedArrayType.java new file mode 100644 index 000000000000..58596ad7f29d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayConditionSupportedArrayType.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for AutomationRulePropertyArrayConditionSupportedArrayType. + */ +public final class AutomationRulePropertyArrayConditionSupportedArrayType + extends ExpandableStringEnum { + /** + * Static value CustomDetails for AutomationRulePropertyArrayConditionSupportedArrayType. + */ + public static final AutomationRulePropertyArrayConditionSupportedArrayType CUSTOM_DETAILS + = fromString("CustomDetails"); + + /** + * Static value CustomDetailValues for AutomationRulePropertyArrayConditionSupportedArrayType. + */ + public static final AutomationRulePropertyArrayConditionSupportedArrayType CUSTOM_DETAIL_VALUES + = fromString("CustomDetailValues"); + + /** + * Static value IncidentLabels for AutomationRulePropertyArrayConditionSupportedArrayType. + */ + public static final AutomationRulePropertyArrayConditionSupportedArrayType INCIDENT_LABELS + = fromString("IncidentLabels"); + + /** + * Creates a new instance of AutomationRulePropertyArrayConditionSupportedArrayType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutomationRulePropertyArrayConditionSupportedArrayType() { + } + + /** + * Creates or finds a AutomationRulePropertyArrayConditionSupportedArrayType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutomationRulePropertyArrayConditionSupportedArrayType. + */ + public static AutomationRulePropertyArrayConditionSupportedArrayType fromString(String name) { + return fromString(name, AutomationRulePropertyArrayConditionSupportedArrayType.class); + } + + /** + * Gets known AutomationRulePropertyArrayConditionSupportedArrayType values. + * + * @return known AutomationRulePropertyArrayConditionSupportedArrayType values. + */ + public static Collection values() { + return values(AutomationRulePropertyArrayConditionSupportedArrayType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayValuesCondition.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayValuesCondition.java new file mode 100644 index 000000000000..72a0164cdae0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyArrayValuesCondition.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The AutomationRulePropertyArrayValuesCondition model. + */ +@Fluent +public final class AutomationRulePropertyArrayValuesCondition + implements JsonSerializable { + /* + * The arrayType property. + */ + private AutomationRulePropertyArrayConditionSupportedArrayType arrayType; + + /* + * The arrayConditionType property. + */ + private AutomationRulePropertyArrayConditionSupportedArrayConditionType arrayConditionType; + + /* + * The itemConditions property. + */ + private List itemConditions; + + /** + * Creates an instance of AutomationRulePropertyArrayValuesCondition class. + */ + public AutomationRulePropertyArrayValuesCondition() { + } + + /** + * Get the arrayType property: The arrayType property. + * + * @return the arrayType value. + */ + public AutomationRulePropertyArrayConditionSupportedArrayType arrayType() { + return this.arrayType; + } + + /** + * Set the arrayType property: The arrayType property. + * + * @param arrayType the arrayType value to set. + * @return the AutomationRulePropertyArrayValuesCondition object itself. + */ + public AutomationRulePropertyArrayValuesCondition + withArrayType(AutomationRulePropertyArrayConditionSupportedArrayType arrayType) { + this.arrayType = arrayType; + return this; + } + + /** + * Get the arrayConditionType property: The arrayConditionType property. + * + * @return the arrayConditionType value. + */ + public AutomationRulePropertyArrayConditionSupportedArrayConditionType arrayConditionType() { + return this.arrayConditionType; + } + + /** + * Set the arrayConditionType property: The arrayConditionType property. + * + * @param arrayConditionType the arrayConditionType value to set. + * @return the AutomationRulePropertyArrayValuesCondition object itself. + */ + public AutomationRulePropertyArrayValuesCondition + withArrayConditionType(AutomationRulePropertyArrayConditionSupportedArrayConditionType arrayConditionType) { + this.arrayConditionType = arrayConditionType; + return this; + } + + /** + * Get the itemConditions property: The itemConditions property. + * + * @return the itemConditions value. + */ + public List itemConditions() { + return this.itemConditions; + } + + /** + * Set the itemConditions property: The itemConditions property. + * + * @param itemConditions the itemConditions value to set. + * @return the AutomationRulePropertyArrayValuesCondition object itself. + */ + public AutomationRulePropertyArrayValuesCondition withItemConditions(List itemConditions) { + this.itemConditions = itemConditions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (itemConditions() != null) { + itemConditions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("arrayType", this.arrayType == null ? null : this.arrayType.toString()); + jsonWriter.writeStringField("arrayConditionType", + this.arrayConditionType == null ? null : this.arrayConditionType.toString()); + jsonWriter.writeArrayField("itemConditions", this.itemConditions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationRulePropertyArrayValuesCondition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationRulePropertyArrayValuesCondition if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationRulePropertyArrayValuesCondition. + */ + public static AutomationRulePropertyArrayValuesCondition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationRulePropertyArrayValuesCondition deserializedAutomationRulePropertyArrayValuesCondition + = new AutomationRulePropertyArrayValuesCondition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("arrayType".equals(fieldName)) { + deserializedAutomationRulePropertyArrayValuesCondition.arrayType + = AutomationRulePropertyArrayConditionSupportedArrayType.fromString(reader.getString()); + } else if ("arrayConditionType".equals(fieldName)) { + deserializedAutomationRulePropertyArrayValuesCondition.arrayConditionType + = AutomationRulePropertyArrayConditionSupportedArrayConditionType + .fromString(reader.getString()); + } else if ("itemConditions".equals(fieldName)) { + List itemConditions + = reader.readArray(reader1 -> AutomationRuleCondition.fromJson(reader1)); + deserializedAutomationRulePropertyArrayValuesCondition.itemConditions = itemConditions; + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationRulePropertyArrayValuesCondition; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyConditionSupportedProperty.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyConditionSupportedProperty.java index 83afff51af25..dede7532dcd5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyConditionSupportedProperty.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AutomationRulePropertyConditionSupportedProperty.java @@ -63,6 +63,30 @@ public final class AutomationRulePropertyConditionSupportedProperty public static final AutomationRulePropertyConditionSupportedProperty INCIDENT_UPDATED_BY_SOURCE = fromString("IncidentUpdatedBySource"); + /** + * Static value IncidentCustomDetailsKey for AutomationRulePropertyConditionSupportedProperty. + */ + public static final AutomationRulePropertyConditionSupportedProperty INCIDENT_CUSTOM_DETAILS_KEY + = fromString("IncidentCustomDetailsKey"); + + /** + * Static value IncidentCustomDetailsValue for AutomationRulePropertyConditionSupportedProperty. + */ + public static final AutomationRulePropertyConditionSupportedProperty INCIDENT_CUSTOM_DETAILS_VALUE + = fromString("IncidentCustomDetailsValue"); + + /** + * Static value IncidentCustomDetectionRuleIds for AutomationRulePropertyConditionSupportedProperty. + */ + public static final AutomationRulePropertyConditionSupportedProperty INCIDENT_CUSTOM_DETECTION_RULE_IDS + = fromString("IncidentCustomDetectionRuleIds"); + + /** + * Static value IncidentAlertTitle for AutomationRulePropertyConditionSupportedProperty. + */ + public static final AutomationRulePropertyConditionSupportedProperty INCIDENT_ALERT_TITLE + = fromString("IncidentAlertTitle"); + /** * Static value AccountAadTenantId for AutomationRulePropertyConditionSupportedProperty. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Availability.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Availability.java new file mode 100644 index 000000000000..72e4b8c59dde --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Availability.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connector Availability Status. + */ +@Fluent +public final class Availability implements JsonSerializable { + /* + * The connector Availability Status + */ + private AvailabilityStatus status; + + /* + * Set connector as preview + */ + private Boolean isPreview; + + /** + * Creates an instance of Availability class. + */ + public Availability() { + } + + /** + * Get the status property: The connector Availability Status. + * + * @return the status value. + */ + public AvailabilityStatus status() { + return this.status; + } + + /** + * Set the status property: The connector Availability Status. + * + * @param status the status value to set. + * @return the Availability object itself. + */ + public Availability withStatus(AvailabilityStatus status) { + this.status = status; + return this; + } + + /** + * Get the isPreview property: Set connector as preview. + * + * @return the isPreview value. + */ + public Boolean isPreview() { + return this.isPreview; + } + + /** + * Set the isPreview property: Set connector as preview. + * + * @param isPreview the isPreview value to set. + * @return the Availability object itself. + */ + public Availability withIsPreview(Boolean isPreview) { + this.isPreview = isPreview; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("status", this.status == null ? null : this.status.toInt()); + jsonWriter.writeBooleanField("isPreview", this.isPreview); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Availability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Availability if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Availability. + */ + public static Availability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Availability deserializedAvailability = new Availability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedAvailability.status = AvailabilityStatus.fromInt(reader.getInt()); + } else if ("isPreview".equals(fieldName)) { + deserializedAvailability.isPreview = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailability; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AvailabilityStatus.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AvailabilityStatus.java new file mode 100644 index 000000000000..68181631a628 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AvailabilityStatus.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +/** + * The connector Availability Status. + */ +public enum AvailabilityStatus { + /** + * Enum value 1. + */ + ONE(1); + + /** + * The actual serialized value for a AvailabilityStatus instance. + */ + private final int value; + + AvailabilityStatus(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a AvailabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AvailabilityStatus object, or null if unable to parse. + */ + public static AvailabilityStatus fromInt(int value) { + AvailabilityStatus[] items = AvailabilityStatus.values(); + for (AvailabilityStatus item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsAuthModel.java new file mode 100644 index 000000000000..3cc2b7b8da1a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsAuthModel.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for API authentication with AWS. + */ +@Fluent +public final class AwsAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.AWS; + + /* + * AWS STS assume role ARN + */ + private String roleArn; + + /* + * AWS STS assume role external ID. This is used to prevent the confused deputy problem: + * 'https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html' + */ + private String externalId; + + /** + * Creates an instance of AwsAuthModel class. + */ + public AwsAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the roleArn property: AWS STS assume role ARN. + * + * @return the roleArn value. + */ + public String roleArn() { + return this.roleArn; + } + + /** + * Set the roleArn property: AWS STS assume role ARN. + * + * @param roleArn the roleArn value to set. + * @return the AwsAuthModel object itself. + */ + public AwsAuthModel withRoleArn(String roleArn) { + this.roleArn = roleArn; + return this; + } + + /** + * Get the externalId property: AWS STS assume role external ID. This is used to prevent the confused deputy + * problem: 'https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html'. + * + * @return the externalId value. + */ + public String externalId() { + return this.externalId; + } + + /** + * Set the externalId property: AWS STS assume role external ID. This is used to prevent the confused deputy + * problem: 'https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html'. + * + * @param externalId the externalId value to set. + * @return the AwsAuthModel object itself. + */ + public AwsAuthModel withExternalId(String externalId) { + this.externalId = externalId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (roleArn() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property roleArn in model AwsAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AwsAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("roleArn", this.roleArn); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("externalId", this.externalId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwsAuthModel. + */ + public static AwsAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsAuthModel deserializedAwsAuthModel = new AwsAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("roleArn".equals(fieldName)) { + deserializedAwsAuthModel.roleArn = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAwsAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else if ("externalId".equals(fieldName)) { + deserializedAwsAuthModel.externalId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailCheckRequirements.java new file mode 100644 index 000000000000..55e28c6ce2c8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailCheckRequirements.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Amazon Web Services CloudTrail requirements check request. + */ +@Immutable +public final class AwsCloudTrailCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.AMAZON_WEB_SERVICES_CLOUD_TRAIL; + + /** + * Creates an instance of AwsCloudTrailCheckRequirements class. + */ + public AwsCloudTrailCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsCloudTrailCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsCloudTrailCheckRequirements if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AwsCloudTrailCheckRequirements. + */ + public static AwsCloudTrailCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsCloudTrailCheckRequirements deserializedAwsCloudTrailCheckRequirements + = new AwsCloudTrailCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedAwsCloudTrailCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsCloudTrailCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypes.java index a526e01a3a68..6651937eba09 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypes.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypes.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -54,11 +55,17 @@ public AwsCloudTrailDataConnectorDataTypes withLogs(AwsCloudTrailDataConnectorDa * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (logs() != null) { + if (logs() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logs in model AwsCloudTrailDataConnectorDataTypes")); + } else { logs().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(AwsCloudTrailDataConnectorDataTypes.class); + /** * {@inheritDoc} */ @@ -75,6 +82,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of AwsCloudTrailDataConnectorDataTypes if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the AwsCloudTrailDataConnectorDataTypes. */ public static AwsCloudTrailDataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypesLogs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypesLogs.java index c9b23f963d5f..8bd2878c8a96 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypesLogs.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsCloudTrailDataConnectorDataTypesLogs.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -37,8 +38,15 @@ public AwsCloudTrailDataConnectorDataTypesLogs withState(DataTypeState state) { */ @Override public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model AwsCloudTrailDataConnectorDataTypesLogs")); + } } + private static final ClientLogger LOGGER = new ClientLogger(AwsCloudTrailDataConnectorDataTypesLogs.class); + /** * {@inheritDoc} */ @@ -55,6 +63,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of AwsCloudTrailDataConnectorDataTypesLogs if the JsonReader was pointing to an instance of * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the AwsCloudTrailDataConnectorDataTypesLogs. */ public static AwsCloudTrailDataConnectorDataTypesLogs fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3CheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3CheckRequirements.java new file mode 100644 index 000000000000..049cc4e5c072 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3CheckRequirements.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Amazon Web Services S3 requirements check request. + */ +@Immutable +public final class AwsS3CheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.AMAZON_WEB_SERVICES_S3; + + /** + * Creates an instance of AwsS3CheckRequirements class. + */ + public AwsS3CheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsS3CheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsS3CheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AwsS3CheckRequirements. + */ + public static AwsS3CheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsS3CheckRequirements deserializedAwsS3CheckRequirements = new AwsS3CheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedAwsS3CheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsS3CheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnector.java new file mode 100644 index 000000000000..29b14650ecd1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnector.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AwsS3DataConnectorProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import java.io.IOException; +import java.util.List; + +/** + * Represents Amazon Web Services S3 data connector. + */ +@Fluent +public final class AwsS3DataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.AMAZON_WEB_SERVICES_S3; + + /* + * Amazon Web Services S3 data connector properties. + */ + private AwsS3DataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AwsS3DataConnector class. + */ + public AwsS3DataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Amazon Web Services S3 data connector properties. + * + * @return the innerProperties value. + */ + private AwsS3DataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public AwsS3DataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the destinationTable property: The logs destination table name in LogAnalytics. + * + * @return the destinationTable value. + */ + public String destinationTable() { + return this.innerProperties() == null ? null : this.innerProperties().destinationTable(); + } + + /** + * Set the destinationTable property: The logs destination table name in LogAnalytics. + * + * @param destinationTable the destinationTable value to set. + * @return the AwsS3DataConnector object itself. + */ + public AwsS3DataConnector withDestinationTable(String destinationTable) { + if (this.innerProperties() == null) { + this.innerProperties = new AwsS3DataConnectorProperties(); + } + this.innerProperties().withDestinationTable(destinationTable); + return this; + } + + /** + * Get the sqsUrls property: The AWS sqs urls for the connector. + * + * @return the sqsUrls value. + */ + public List sqsUrls() { + return this.innerProperties() == null ? null : this.innerProperties().sqsUrls(); + } + + /** + * Set the sqsUrls property: The AWS sqs urls for the connector. + * + * @param sqsUrls the sqsUrls value to set. + * @return the AwsS3DataConnector object itself. + */ + public AwsS3DataConnector withSqsUrls(List sqsUrls) { + if (this.innerProperties() == null) { + this.innerProperties = new AwsS3DataConnectorProperties(); + } + this.innerProperties().withSqsUrls(sqsUrls); + return this; + } + + /** + * Get the roleArn property: The Aws Role Arn that is used to access the Aws account. + * + * @return the roleArn value. + */ + public String roleArn() { + return this.innerProperties() == null ? null : this.innerProperties().roleArn(); + } + + /** + * Set the roleArn property: The Aws Role Arn that is used to access the Aws account. + * + * @param roleArn the roleArn value to set. + * @return the AwsS3DataConnector object itself. + */ + public AwsS3DataConnector withRoleArn(String roleArn) { + if (this.innerProperties() == null) { + this.innerProperties = new AwsS3DataConnectorProperties(); + } + this.innerProperties().withRoleArn(roleArn); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public AwsS3DataConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the AwsS3DataConnector object itself. + */ + public AwsS3DataConnector withDataTypes(AwsS3DataConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new AwsS3DataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsS3DataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsS3DataConnector if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwsS3DataConnector. + */ + public static AwsS3DataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsS3DataConnector deserializedAwsS3DataConnector = new AwsS3DataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAwsS3DataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAwsS3DataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAwsS3DataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedAwsS3DataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedAwsS3DataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedAwsS3DataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAwsS3DataConnector.innerProperties = AwsS3DataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsS3DataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnectorDataTypes.java new file mode 100644 index 000000000000..8244fe594a78 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnectorDataTypes.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Amazon Web Services S3 data connector. + */ +@Fluent +public final class AwsS3DataConnectorDataTypes implements JsonSerializable { + /* + * Logs data type. + */ + private AwsS3DataConnectorDataTypesLogs logs; + + /** + * Creates an instance of AwsS3DataConnectorDataTypes class. + */ + public AwsS3DataConnectorDataTypes() { + } + + /** + * Get the logs property: Logs data type. + * + * @return the logs value. + */ + public AwsS3DataConnectorDataTypesLogs logs() { + return this.logs; + } + + /** + * Set the logs property: Logs data type. + * + * @param logs the logs value to set. + * @return the AwsS3DataConnectorDataTypes object itself. + */ + public AwsS3DataConnectorDataTypes withLogs(AwsS3DataConnectorDataTypesLogs logs) { + this.logs = logs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logs() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logs in model AwsS3DataConnectorDataTypes")); + } else { + logs().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AwsS3DataConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("logs", this.logs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsS3DataConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsS3DataConnectorDataTypes if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwsS3DataConnectorDataTypes. + */ + public static AwsS3DataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsS3DataConnectorDataTypes deserializedAwsS3DataConnectorDataTypes = new AwsS3DataConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logs".equals(fieldName)) { + deserializedAwsS3DataConnectorDataTypes.logs = AwsS3DataConnectorDataTypesLogs.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsS3DataConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnectorDataTypesLogs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnectorDataTypesLogs.java new file mode 100644 index 000000000000..62841ab297a8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AwsS3DataConnectorDataTypesLogs.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Logs data type. + */ +@Fluent +public final class AwsS3DataConnectorDataTypesLogs extends DataConnectorDataTypeCommon { + /** + * Creates an instance of AwsS3DataConnectorDataTypesLogs class. + */ + public AwsS3DataConnectorDataTypesLogs() { + } + + /** + * {@inheritDoc} + */ + @Override + public AwsS3DataConnectorDataTypesLogs withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model AwsS3DataConnectorDataTypesLogs")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AwsS3DataConnectorDataTypesLogs.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsS3DataConnectorDataTypesLogs from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsS3DataConnectorDataTypesLogs if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwsS3DataConnectorDataTypesLogs. + */ + public static AwsS3DataConnectorDataTypesLogs fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsS3DataConnectorDataTypesLogs deserializedAwsS3DataConnectorDataTypesLogs + = new AwsS3DataConnectorDataTypesLogs(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedAwsS3DataConnectorDataTypesLogs.withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsS3DataConnectorDataTypesLogs; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureDevOpsResourceInfo.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureDevOpsResourceInfo.java new file mode 100644 index 000000000000..42d59174d3f2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureDevOpsResourceInfo.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resources created in Azure DevOps repository. + */ +@Fluent +public final class AzureDevOpsResourceInfo implements JsonSerializable { + /* + * Id of the pipeline created for the source-control. + */ + private String pipelineId; + + /* + * Id of the service-connection created for the source-control. + */ + private String serviceConnectionId; + + /** + * Creates an instance of AzureDevOpsResourceInfo class. + */ + public AzureDevOpsResourceInfo() { + } + + /** + * Get the pipelineId property: Id of the pipeline created for the source-control. + * + * @return the pipelineId value. + */ + public String pipelineId() { + return this.pipelineId; + } + + /** + * Set the pipelineId property: Id of the pipeline created for the source-control. + * + * @param pipelineId the pipelineId value to set. + * @return the AzureDevOpsResourceInfo object itself. + */ + public AzureDevOpsResourceInfo withPipelineId(String pipelineId) { + this.pipelineId = pipelineId; + return this; + } + + /** + * Get the serviceConnectionId property: Id of the service-connection created for the source-control. + * + * @return the serviceConnectionId value. + */ + public String serviceConnectionId() { + return this.serviceConnectionId; + } + + /** + * Set the serviceConnectionId property: Id of the service-connection created for the source-control. + * + * @param serviceConnectionId the serviceConnectionId value to set. + * @return the AzureDevOpsResourceInfo object itself. + */ + public AzureDevOpsResourceInfo withServiceConnectionId(String serviceConnectionId) { + this.serviceConnectionId = serviceConnectionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pipelineId", this.pipelineId); + jsonWriter.writeStringField("serviceConnectionId", this.serviceConnectionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsResourceInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsResourceInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsResourceInfo. + */ + public static AzureDevOpsResourceInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsResourceInfo deserializedAzureDevOpsResourceInfo = new AzureDevOpsResourceInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pipelineId".equals(fieldName)) { + deserializedAzureDevOpsResourceInfo.pipelineId = reader.getString(); + } else if ("serviceConnectionId".equals(fieldName)) { + deserializedAzureDevOpsResourceInfo.serviceConnectionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsResourceInfo; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureEntityResource.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureEntityResource.java new file mode 100644 index 000000000000..ccfc2daf3cfd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureEntityResource.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Entity Resource + * + * The resource model definition for an Azure Resource Manager resource with an etag. + */ +@Immutable +public class AzureEntityResource extends ProxyResource { + /* + * Resource Etag. + */ + private String etag; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzureEntityResource class. + */ + public AzureEntityResource() { + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Resource Etag. + * + * @param etag the etag value to set. + * @return the AzureEntityResource object itself. + */ + AzureEntityResource withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Set the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @param systemData the systemData value to set. + * @return the AzureEntityResource object itself. + */ + AzureEntityResource withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureEntityResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureEntityResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureEntityResource. + */ + public static AzureEntityResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureEntityResource deserializedAzureEntityResource = new AzureEntityResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureEntityResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureEntityResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureEntityResource.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedAzureEntityResource.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAzureEntityResource.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureEntityResource; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureResourceEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureResourceEntity.java index e1aff5c1a493..e63df79a4f79 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureResourceEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/AzureResourceEntity.java @@ -10,6 +10,7 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.fluent.models.AzureResourceEntityProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import java.io.IOException; import java.util.Map; @@ -17,7 +18,7 @@ * Represents an azure resource entity. */ @Immutable -public final class AzureResourceEntity extends Entity { +public final class AzureResourceEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BasicAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BasicAuthModel.java new file mode 100644 index 000000000000..7f1457f19130 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BasicAuthModel.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for API authentication with basic flow - user name + password. + */ +@Fluent +public final class BasicAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.BASIC; + + /* + * The user name. + */ + private String username; + + /* + * The password + */ + private String password; + + /** + * Creates an instance of BasicAuthModel class. + */ + public BasicAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the username property: The user name. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name. + * + * @param username the username value to set. + * @return the BasicAuthModel object itself. + */ + public BasicAuthModel withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password. + * + * @param password the password value to set. + * @return the BasicAuthModel object itself. + */ + public BasicAuthModel withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (username() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property username in model BasicAuthModel")); + } + if (password() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property password in model BasicAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BasicAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userName", this.username); + jsonWriter.writeStringField("password", this.password); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BasicAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BasicAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BasicAuthModel. + */ + public static BasicAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BasicAuthModel deserializedBasicAuthModel = new BasicAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userName".equals(fieldName)) { + deserializedBasicAuthModel.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedBasicAuthModel.password = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBasicAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBasicAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatistic.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatistic.java new file mode 100644 index 000000000000..d337cf2e29ae --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatistic.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner; + +/** + * An immutable client-side representation of BillingStatistic. + */ +public interface BillingStatistic { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Resource Etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the kind property: The kind of the billing statistic. + * + * @return the kind value. + */ + BillingStatisticKind kind(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner object. + * + * @return the inner object. + */ + BillingStatisticInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatisticKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatisticKind.java new file mode 100644 index 000000000000..008ca3fb2c12 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatisticKind.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the billing statistic. + */ +public final class BillingStatisticKind extends ExpandableStringEnum { + /** + * Static value SapSolutionUsage for BillingStatisticKind. + */ + public static final BillingStatisticKind SAP_SOLUTION_USAGE = fromString("SapSolutionUsage"); + + /** + * Creates a new instance of BillingStatisticKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingStatisticKind() { + } + + /** + * Creates or finds a BillingStatisticKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingStatisticKind. + */ + public static BillingStatisticKind fromString(String name) { + return fromString(name, BillingStatisticKind.class); + } + + /** + * Gets known BillingStatisticKind values. + * + * @return known BillingStatisticKind values. + */ + public static Collection values() { + return values(BillingStatisticKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatisticList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatisticList.java new file mode 100644 index 000000000000..68c87599c0a6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatisticList.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all Microsoft Sentinel billing statistics. + */ +@Fluent +public final class BillingStatisticList implements JsonSerializable { + /* + * URL to fetch the next set of billing statistics. + */ + private String nextLink; + + /* + * Array of billing statistics. + */ + private List value; + + /** + * Creates an instance of BillingStatisticList class. + */ + public BillingStatisticList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of billing statistics. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of billing statistics. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of billing statistics. + * + * @param value the value value to set. + * @return the BillingStatisticList object itself. + */ + public BillingStatisticList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model BillingStatisticList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BillingStatisticList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BillingStatisticList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BillingStatisticList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BillingStatisticList. + */ + public static BillingStatisticList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BillingStatisticList deserializedBillingStatisticList = new BillingStatisticList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BillingStatisticInner.fromJson(reader1)); + deserializedBillingStatisticList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBillingStatisticList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBillingStatisticList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatistics.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatistics.java new file mode 100644 index 000000000000..da93c3681b5e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BillingStatistics.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of BillingStatistics. + */ +public interface BillingStatistics { + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all Microsoft Sentinel billing statistics. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Microsoft Sentinel billing statistics as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String billingStatisticName, Context context); + + /** + * Gets a billing statistic. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param billingStatisticName The name of the billing statistic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing statistic. + */ + BillingStatistic get(String resourceGroupName, String workspaceName, String billingStatisticName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Bookmark.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Bookmark.java index 2eb8151af00d..348d0badacfc 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Bookmark.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Bookmark.java @@ -140,6 +140,27 @@ public interface Bookmark { */ IncidentInfo incidentInfo(); + /** + * Gets the entityMappings property: Describes the entity mappings of the bookmark. + * + * @return the entityMappings value. + */ + List entityMappings(); + + /** + * Gets the tactics property: A list of relevant mitre attacks. + * + * @return the tactics value. + */ + List tactics(); + + /** + * Gets the techniques property: A list of relevant mitre techniques. + * + * @return the techniques value. + */ + List techniques(); + /** * Gets the name of the resource group. * @@ -193,7 +214,8 @@ interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithCre DefinitionStages.WithCreatedBy, DefinitionStages.WithDisplayName, DefinitionStages.WithLabels, DefinitionStages.WithNotes, DefinitionStages.WithQuery, DefinitionStages.WithQueryResult, DefinitionStages.WithUpdated, DefinitionStages.WithUpdatedBy, DefinitionStages.WithEventTime, - DefinitionStages.WithQueryStartTime, DefinitionStages.WithQueryEndTime, DefinitionStages.WithIncidentInfo { + DefinitionStages.WithQueryStartTime, DefinitionStages.WithQueryEndTime, DefinitionStages.WithIncidentInfo, + DefinitionStages.WithEntityMappings, DefinitionStages.WithTactics, DefinitionStages.WithTechniques { /** * Executes the create request. * @@ -391,6 +413,45 @@ interface WithIncidentInfo { */ WithCreate withIncidentInfo(IncidentInfo incidentInfo); } + + /** + * The stage of the Bookmark definition allowing to specify entityMappings. + */ + interface WithEntityMappings { + /** + * Specifies the entityMappings property: Describes the entity mappings of the bookmark. + * + * @param entityMappings Describes the entity mappings of the bookmark. + * @return the next definition stage. + */ + WithCreate withEntityMappings(List entityMappings); + } + + /** + * The stage of the Bookmark definition allowing to specify tactics. + */ + interface WithTactics { + /** + * Specifies the tactics property: A list of relevant mitre attacks. + * + * @param tactics A list of relevant mitre attacks. + * @return the next definition stage. + */ + WithCreate withTactics(List tactics); + } + + /** + * The stage of the Bookmark definition allowing to specify techniques. + */ + interface WithTechniques { + /** + * Specifies the techniques property: A list of relevant mitre techniques. + * + * @param techniques A list of relevant mitre techniques. + * @return the next definition stage. + */ + WithCreate withTechniques(List techniques); + } } /** @@ -406,7 +467,8 @@ interface WithIncidentInfo { interface Update extends UpdateStages.WithEtag, UpdateStages.WithCreated, UpdateStages.WithCreatedBy, UpdateStages.WithDisplayName, UpdateStages.WithLabels, UpdateStages.WithNotes, UpdateStages.WithQuery, UpdateStages.WithQueryResult, UpdateStages.WithUpdated, UpdateStages.WithUpdatedBy, UpdateStages.WithEventTime, - UpdateStages.WithQueryStartTime, UpdateStages.WithQueryEndTime, UpdateStages.WithIncidentInfo { + UpdateStages.WithQueryStartTime, UpdateStages.WithQueryEndTime, UpdateStages.WithIncidentInfo, + UpdateStages.WithEntityMappings, UpdateStages.WithTactics, UpdateStages.WithTechniques { /** * Executes the update request. * @@ -608,6 +670,45 @@ interface WithIncidentInfo { */ Update withIncidentInfo(IncidentInfo incidentInfo); } + + /** + * The stage of the Bookmark update allowing to specify entityMappings. + */ + interface WithEntityMappings { + /** + * Specifies the entityMappings property: Describes the entity mappings of the bookmark. + * + * @param entityMappings Describes the entity mappings of the bookmark. + * @return the next definition stage. + */ + Update withEntityMappings(List entityMappings); + } + + /** + * The stage of the Bookmark update allowing to specify tactics. + */ + interface WithTactics { + /** + * Specifies the tactics property: A list of relevant mitre attacks. + * + * @param tactics A list of relevant mitre attacks. + * @return the next definition stage. + */ + Update withTactics(List tactics); + } + + /** + * The stage of the Bookmark update allowing to specify techniques. + */ + interface WithTechniques { + /** + * Specifies the techniques property: A list of relevant mitre techniques. + * + * @param techniques A list of relevant mitre techniques. + * @return the next definition stage. + */ + Update withTechniques(List techniques); + } } /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkEntityMappings.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkEntityMappings.java new file mode 100644 index 000000000000..2c579b49b556 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkEntityMappings.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes the entity mappings of a single entity. + */ +@Fluent +public final class BookmarkEntityMappings implements JsonSerializable { + /* + * The entity type + */ + private String entityType; + + /* + * Array of fields mapping for that entity type + */ + private List fieldMappings; + + /** + * Creates an instance of BookmarkEntityMappings class. + */ + public BookmarkEntityMappings() { + } + + /** + * Get the entityType property: The entity type. + * + * @return the entityType value. + */ + public String entityType() { + return this.entityType; + } + + /** + * Set the entityType property: The entity type. + * + * @param entityType the entityType value to set. + * @return the BookmarkEntityMappings object itself. + */ + public BookmarkEntityMappings withEntityType(String entityType) { + this.entityType = entityType; + return this; + } + + /** + * Get the fieldMappings property: Array of fields mapping for that entity type. + * + * @return the fieldMappings value. + */ + public List fieldMappings() { + return this.fieldMappings; + } + + /** + * Set the fieldMappings property: Array of fields mapping for that entity type. + * + * @param fieldMappings the fieldMappings value to set. + * @return the BookmarkEntityMappings object itself. + */ + public BookmarkEntityMappings withFieldMappings(List fieldMappings) { + this.fieldMappings = fieldMappings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (fieldMappings() != null) { + fieldMappings().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("entityType", this.entityType); + jsonWriter.writeArrayField("fieldMappings", this.fieldMappings, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookmarkEntityMappings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookmarkEntityMappings if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BookmarkEntityMappings. + */ + public static BookmarkEntityMappings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookmarkEntityMappings deserializedBookmarkEntityMappings = new BookmarkEntityMappings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entityType".equals(fieldName)) { + deserializedBookmarkEntityMappings.entityType = reader.getString(); + } else if ("fieldMappings".equals(fieldName)) { + List fieldMappings + = reader.readArray(reader1 -> EntityFieldMapping.fromJson(reader1)); + deserializedBookmarkEntityMappings.fieldMappings = fieldMappings; + } else { + reader.skipChildren(); + } + } + + return deserializedBookmarkEntityMappings; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandParameters.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandParameters.java new file mode 100644 index 000000000000..571c6d6c83c2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandParameters.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; +import java.util.UUID; + +/** + * The parameters required to execute an expand operation on the given bookmark. + */ +@Fluent +public final class BookmarkExpandParameters implements JsonSerializable { + /* + * The end date filter, so the only expansion results returned are before this date. + */ + private OffsetDateTime endTime; + + /* + * The Id of the expansion to perform. + */ + private UUID expansionId; + + /* + * The start date filter, so the only expansion results returned are after this date. + */ + private OffsetDateTime startTime; + + /** + * Creates an instance of BookmarkExpandParameters class. + */ + public BookmarkExpandParameters() { + } + + /** + * Get the endTime property: The end date filter, so the only expansion results returned are before this date. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end date filter, so the only expansion results returned are before this date. + * + * @param endTime the endTime value to set. + * @return the BookmarkExpandParameters object itself. + */ + public BookmarkExpandParameters withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the expansionId property: The Id of the expansion to perform. + * + * @return the expansionId value. + */ + public UUID expansionId() { + return this.expansionId; + } + + /** + * Set the expansionId property: The Id of the expansion to perform. + * + * @param expansionId the expansionId value to set. + * @return the BookmarkExpandParameters object itself. + */ + public BookmarkExpandParameters withExpansionId(UUID expansionId) { + this.expansionId = expansionId; + return this; + } + + /** + * Get the startTime property: The start date filter, so the only expansion results returned are after this date. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start date filter, so the only expansion results returned are after this date. + * + * @param startTime the startTime value to set. + * @return the BookmarkExpandParameters object itself. + */ + public BookmarkExpandParameters withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("expansionId", Objects.toString(this.expansionId, null)); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookmarkExpandParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookmarkExpandParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BookmarkExpandParameters. + */ + public static BookmarkExpandParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookmarkExpandParameters deserializedBookmarkExpandParameters = new BookmarkExpandParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endTime".equals(fieldName)) { + deserializedBookmarkExpandParameters.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expansionId".equals(fieldName)) { + deserializedBookmarkExpandParameters.expansionId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("startTime".equals(fieldName)) { + deserializedBookmarkExpandParameters.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedBookmarkExpandParameters; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandResponse.java new file mode 100644 index 000000000000..bd7abecdfabe --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandResponse.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkExpandResponseInner; + +/** + * An immutable client-side representation of BookmarkExpandResponse. + */ +public interface BookmarkExpandResponse { + /** + * Gets the metadata property: The metadata from the expansion operation results. + * + * @return the metadata value. + */ + ExpansionResultsMetadata metadata(); + + /** + * Gets the value property: The expansion result values. + * + * @return the value value. + */ + BookmarkExpandResponseValue value(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.BookmarkExpandResponseInner object. + * + * @return the inner object. + */ + BookmarkExpandResponseInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandResponseValue.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandResponseValue.java new file mode 100644 index 000000000000..c8d28e7d7438 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkExpandResponseValue.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import java.io.IOException; +import java.util.List; + +/** + * The expansion result values. + */ +@Fluent +public final class BookmarkExpandResponseValue implements JsonSerializable { + /* + * Array of the expansion result entities. + */ + private List entities; + + /* + * Array of expansion result connected entities + */ + private List edges; + + /** + * Creates an instance of BookmarkExpandResponseValue class. + */ + public BookmarkExpandResponseValue() { + } + + /** + * Get the entities property: Array of the expansion result entities. + * + * @return the entities value. + */ + public List entities() { + return this.entities; + } + + /** + * Set the entities property: Array of the expansion result entities. + * + * @param entities the entities value to set. + * @return the BookmarkExpandResponseValue object itself. + */ + public BookmarkExpandResponseValue withEntities(List entities) { + this.entities = entities; + return this; + } + + /** + * Get the edges property: Array of expansion result connected entities. + * + * @return the edges value. + */ + public List edges() { + return this.edges; + } + + /** + * Set the edges property: Array of expansion result connected entities. + * + * @param edges the edges value to set. + * @return the BookmarkExpandResponseValue object itself. + */ + public BookmarkExpandResponseValue withEdges(List edges) { + this.edges = edges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (entities() != null) { + entities().forEach(e -> e.validate()); + } + if (edges() != null) { + edges().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("entities", this.entities, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("edges", this.edges, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookmarkExpandResponseValue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookmarkExpandResponseValue if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BookmarkExpandResponseValue. + */ + public static BookmarkExpandResponseValue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookmarkExpandResponseValue deserializedBookmarkExpandResponseValue = new BookmarkExpandResponseValue(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entities".equals(fieldName)) { + List entities = reader.readArray(reader1 -> EntityInner.fromJson(reader1)); + deserializedBookmarkExpandResponseValue.entities = entities; + } else if ("edges".equals(fieldName)) { + List edges = reader.readArray(reader1 -> ConnectedEntity.fromJson(reader1)); + deserializedBookmarkExpandResponseValue.edges = edges; + } else { + reader.skipChildren(); + } + } + + return deserializedBookmarkExpandResponseValue; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkList.java index 36723c3b84f6..7bd14a051bbc 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkList.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkList.java @@ -20,7 +20,7 @@ @Fluent public final class BookmarkList implements JsonSerializable { /* - * URL to fetch the next set of cases. + * URL to fetch the next set of bookmarks. */ private String nextLink; @@ -36,7 +36,7 @@ public BookmarkList() { } /** - * Get the nextLink property: URL to fetch the next set of cases. + * Get the nextLink property: URL to fetch the next set of bookmarks. * * @return the nextLink value. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkOperations.java new file mode 100644 index 000000000000..21b4cefc76d3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkOperations.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of BookmarkOperations. + */ +public interface BookmarkOperations { + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response}. + */ + Response expandWithResponse(String resourceGroupName, String workspaceName, + String bookmarkId, BookmarkExpandParameters parameters, Context context); + + /** + * Expand an bookmark. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param parameters The parameters required to execute an expand operation on the given bookmark. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response. + */ + BookmarkExpandResponse expand(String resourceGroupName, String workspaceName, String bookmarkId, + BookmarkExpandParameters parameters); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkRelations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkRelations.java new file mode 100644 index 000000000000..32ac4cf02886 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkRelations.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of BookmarkRelations. + */ +public interface BookmarkRelations { + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId); + + /** + * Gets all bookmark relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all bookmark relations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String bookmarkId, String filter, + String orderby, Integer top, String skipToken, Context context); + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context); + + /** + * Gets a bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation. + */ + Relation get(String resourceGroupName, String workspaceName, String bookmarkId, String relationName); + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String bookmarkId, + String relationName, Context context); + + /** + * Delete the bookmark relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param bookmarkId Bookmark ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String bookmarkId, String relationName); + + /** + * Gets a bookmark relation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation along with {@link Response}. + */ + Relation getById(String id); + + /** + * Gets a bookmark relation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a bookmark relation along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete the bookmark relation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete the bookmark relation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Relation resource. + * + * @param name resource name. + * @return the first stage of the new Relation definition. + */ + Relation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkTimelineItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkTimelineItem.java new file mode 100644 index 000000000000..4f02c21b352a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BookmarkTimelineItem.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Represents bookmark timeline item. + */ +@Fluent +public final class BookmarkTimelineItem extends EntityTimelineItem { + /* + * The entity query kind type. + */ + private EntityTimelineKind kind = EntityTimelineKind.BOOKMARK; + + /* + * The bookmark azure resource id. + */ + private String azureResourceId; + + /* + * The bookmark display name. + */ + private String displayName; + + /* + * The notes of the bookmark + */ + private String notes; + + /* + * The bookmark end time. + */ + private OffsetDateTime endTimeUtc; + + /* + * The bookmark start time. + */ + private OffsetDateTime startTimeUtc; + + /* + * The bookmark event time. + */ + private OffsetDateTime eventTime; + + /* + * Describes a user that created the bookmark + */ + private UserInfo createdBy; + + /* + * List of labels relevant to this bookmark + */ + private List labels; + + /** + * Creates an instance of BookmarkTimelineItem class. + */ + public BookmarkTimelineItem() { + } + + /** + * Get the kind property: The entity query kind type. + * + * @return the kind value. + */ + @Override + public EntityTimelineKind kind() { + return this.kind; + } + + /** + * Get the azureResourceId property: The bookmark azure resource id. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: The bookmark azure resource id. + * + * @param azureResourceId the azureResourceId value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the displayName property: The bookmark display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The bookmark display name. + * + * @param displayName the displayName value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the notes property: The notes of the bookmark. + * + * @return the notes value. + */ + public String notes() { + return this.notes; + } + + /** + * Set the notes property: The notes of the bookmark. + * + * @param notes the notes value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withNotes(String notes) { + this.notes = notes; + return this; + } + + /** + * Get the endTimeUtc property: The bookmark end time. + * + * @return the endTimeUtc value. + */ + public OffsetDateTime endTimeUtc() { + return this.endTimeUtc; + } + + /** + * Set the endTimeUtc property: The bookmark end time. + * + * @param endTimeUtc the endTimeUtc value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withEndTimeUtc(OffsetDateTime endTimeUtc) { + this.endTimeUtc = endTimeUtc; + return this; + } + + /** + * Get the startTimeUtc property: The bookmark start time. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Set the startTimeUtc property: The bookmark start time. + * + * @param startTimeUtc the startTimeUtc value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withStartTimeUtc(OffsetDateTime startTimeUtc) { + this.startTimeUtc = startTimeUtc; + return this; + } + + /** + * Get the eventTime property: The bookmark event time. + * + * @return the eventTime value. + */ + public OffsetDateTime eventTime() { + return this.eventTime; + } + + /** + * Set the eventTime property: The bookmark event time. + * + * @param eventTime the eventTime value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + return this; + } + + /** + * Get the createdBy property: Describes a user that created the bookmark. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: Describes a user that created the bookmark. + * + * @param createdBy the createdBy value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withCreatedBy(UserInfo createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the labels property: List of labels relevant to this bookmark. + * + * @return the labels value. + */ + public List labels() { + return this.labels; + } + + /** + * Set the labels property: List of labels relevant to this bookmark. + * + * @param labels the labels value to set. + * @return the BookmarkTimelineItem object itself. + */ + public BookmarkTimelineItem withLabels(List labels) { + this.labels = labels; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (azureResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureResourceId in model BookmarkTimelineItem")); + } + if (createdBy() != null) { + createdBy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BookmarkTimelineItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureResourceId", this.azureResourceId); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("notes", this.notes); + jsonWriter.writeStringField("endTimeUtc", + this.endTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTimeUtc)); + jsonWriter.writeStringField("startTimeUtc", + this.startTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTimeUtc)); + jsonWriter.writeStringField("eventTime", + this.eventTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.eventTime)); + jsonWriter.writeJsonField("createdBy", this.createdBy); + jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookmarkTimelineItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookmarkTimelineItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookmarkTimelineItem. + */ + public static BookmarkTimelineItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookmarkTimelineItem deserializedBookmarkTimelineItem = new BookmarkTimelineItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureResourceId".equals(fieldName)) { + deserializedBookmarkTimelineItem.azureResourceId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedBookmarkTimelineItem.kind = EntityTimelineKind.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedBookmarkTimelineItem.displayName = reader.getString(); + } else if ("notes".equals(fieldName)) { + deserializedBookmarkTimelineItem.notes = reader.getString(); + } else if ("endTimeUtc".equals(fieldName)) { + deserializedBookmarkTimelineItem.endTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("startTimeUtc".equals(fieldName)) { + deserializedBookmarkTimelineItem.startTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("eventTime".equals(fieldName)) { + deserializedBookmarkTimelineItem.eventTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedBookmarkTimelineItem.createdBy = UserInfo.fromJson(reader); + } else if ("labels".equals(fieldName)) { + List labels = reader.readArray(reader1 -> reader1.getString()); + deserializedBookmarkTimelineItem.labels = labels; + } else { + reader.skipChildren(); + } + } + + return deserializedBookmarkTimelineItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BooleanConditionProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BooleanConditionProperties.java new file mode 100644 index 000000000000..4db07b0fbc70 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BooleanConditionProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes an automation rule condition that applies a boolean operator (e.g AND, OR) to conditions. + */ +@Fluent +public final class BooleanConditionProperties extends AutomationRuleCondition { + /* + * The conditionType property. + */ + private ConditionType conditionType = ConditionType.BOOLEAN; + + /* + * The conditionProperties property. + */ + private AutomationRuleBooleanCondition conditionProperties; + + /** + * Creates an instance of BooleanConditionProperties class. + */ + public BooleanConditionProperties() { + } + + /** + * Get the conditionType property: The conditionType property. + * + * @return the conditionType value. + */ + @Override + public ConditionType conditionType() { + return this.conditionType; + } + + /** + * Get the conditionProperties property: The conditionProperties property. + * + * @return the conditionProperties value. + */ + public AutomationRuleBooleanCondition conditionProperties() { + return this.conditionProperties; + } + + /** + * Set the conditionProperties property: The conditionProperties property. + * + * @param conditionProperties the conditionProperties value to set. + * @return the BooleanConditionProperties object itself. + */ + public BooleanConditionProperties withConditionProperties(AutomationRuleBooleanCondition conditionProperties) { + this.conditionProperties = conditionProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (conditionProperties() != null) { + conditionProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("conditionType", this.conditionType == null ? null : this.conditionType.toString()); + jsonWriter.writeJsonField("conditionProperties", this.conditionProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BooleanConditionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BooleanConditionProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BooleanConditionProperties. + */ + public static BooleanConditionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BooleanConditionProperties deserializedBooleanConditionProperties = new BooleanConditionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("conditionType".equals(fieldName)) { + deserializedBooleanConditionProperties.conditionType = ConditionType.fromString(reader.getString()); + } else if ("conditionProperties".equals(fieldName)) { + deserializedBooleanConditionProperties.conditionProperties + = AutomationRuleBooleanCondition.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBooleanConditionProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentOperations.java new file mode 100644 index 000000000000..7663fe8dbd5a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentOperations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of BusinessApplicationAgentOperations. + */ +public interface BusinessApplicationAgentOperations { + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, Context context); + + /** + * Gets Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return business Application Agent. + */ + BusinessApplicationAgentResource get(String resourceGroupName, String workspaceName, String agentResourceName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentResource.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentResource.java new file mode 100644 index 000000000000..c0940908e238 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentResource.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * An immutable client-side representation of BusinessApplicationAgentResource. + */ +public interface BusinessApplicationAgentResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the configuration property: Describes the configuration of a Business Application Agent. + * + * @return the configuration value. + */ + AgentConfiguration configuration(); + + /** + * Gets the agentSystems property: The agentSystems property. + * + * @return the agentSystems value. + */ + List agentSystems(); + + /** + * Gets the displayName property: The displayName property. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the lastModifiedTimeUtc property: The lastModifiedTimeUtc property. + * + * @return the lastModifiedTimeUtc value. + */ + OffsetDateTime lastModifiedTimeUtc(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner + * object. + * + * @return the inner object. + */ + BusinessApplicationAgentResourceInner innerModel(); + + /** + * The entirety of the BusinessApplicationAgentResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithConfiguration, DefinitionStages.WithDisplayName, DefinitionStages.WithCreate { + } + + /** + * The BusinessApplicationAgentResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the BusinessApplicationAgentResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the BusinessApplicationAgentResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithConfiguration withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the BusinessApplicationAgentResource definition allowing to specify configuration. + */ + interface WithConfiguration { + /** + * Specifies the configuration property: Describes the configuration of a Business Application Agent.. + * + * @param configuration Describes the configuration of a Business Application Agent. + * @return the next definition stage. + */ + WithDisplayName withConfiguration(AgentConfiguration configuration); + } + + /** + * The stage of the BusinessApplicationAgentResource definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The displayName property.. + * + * @param displayName The displayName property. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the BusinessApplicationAgentResource definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithEtag { + /** + * Executes the create request. + * + * @return the created resource. + */ + BusinessApplicationAgentResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BusinessApplicationAgentResource create(Context context); + } + + /** + * The stage of the BusinessApplicationAgentResource definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + } + + /** + * Begins update for the BusinessApplicationAgentResource resource. + * + * @return the stage of resource update. + */ + BusinessApplicationAgentResource.Update update(); + + /** + * The template for BusinessApplicationAgentResource update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithConfiguration, UpdateStages.WithDisplayName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BusinessApplicationAgentResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BusinessApplicationAgentResource apply(Context context); + } + + /** + * The BusinessApplicationAgentResource update stages. + */ + interface UpdateStages { + /** + * The stage of the BusinessApplicationAgentResource update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the BusinessApplicationAgentResource update allowing to specify configuration. + */ + interface WithConfiguration { + /** + * Specifies the configuration property: Describes the configuration of a Business Application Agent.. + * + * @param configuration Describes the configuration of a Business Application Agent. + * @return the next definition stage. + */ + Update withConfiguration(AgentConfiguration configuration); + } + + /** + * The stage of the BusinessApplicationAgentResource update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The displayName property.. + * + * @param displayName The displayName property. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgents.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgents.java new file mode 100644 index 000000000000..ebe936a8d969 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgents.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of BusinessApplicationAgents. + */ +public interface BusinessApplicationAgents { + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + Context context); + + /** + * Delete the Business Application Agent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String agentResourceName); + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all Business Application Agents under the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Business Application Agents under the workspace as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String skipToken, Context context); + + /** + * Delete the Business Application Agent. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete the Business Application Agent. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BusinessApplicationAgentResource resource. + * + * @param name resource name. + * @return the first stage of the new BusinessApplicationAgentResource definition. + */ + BusinessApplicationAgentResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentsList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentsList.java new file mode 100644 index 000000000000..8353503fc32c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/BusinessApplicationAgentsList.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.BusinessApplicationAgentResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * List of agents. + */ +@Fluent +public final class BusinessApplicationAgentsList implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of BusinessApplicationAgentsList class. + */ + public BusinessApplicationAgentsList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the BusinessApplicationAgentsList object itself. + */ + public BusinessApplicationAgentsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the BusinessApplicationAgentsList object itself. + */ + public BusinessApplicationAgentsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BusinessApplicationAgentsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BusinessApplicationAgentsList if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BusinessApplicationAgentsList. + */ + public static BusinessApplicationAgentsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BusinessApplicationAgentsList deserializedBusinessApplicationAgentsList + = new BusinessApplicationAgentsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BusinessApplicationAgentResourceInner.fromJson(reader1)); + deserializedBusinessApplicationAgentsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBusinessApplicationAgentsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBusinessApplicationAgentsList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpAuthConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpAuthConfig.java new file mode 100644 index 000000000000..f104abe09b3c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpAuthConfig.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Base Model for API authentication. + */ +@Immutable +public class CcpAuthConfig implements JsonSerializable { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.fromString("CcpAuthConfig"); + + /** + * Creates an instance of CcpAuthConfig class. + */ + public CcpAuthConfig() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + public CcpAuthType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CcpAuthConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CcpAuthConfig if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CcpAuthConfig. + */ + public static CcpAuthConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("APIKey".equals(discriminatorValue)) { + return ApiKeyAuthModel.fromJson(readerToUse.reset()); + } else if ("AWS".equals(discriminatorValue)) { + return AwsAuthModel.fromJson(readerToUse.reset()); + } else if ("Basic".equals(discriminatorValue)) { + return BasicAuthModel.fromJson(readerToUse.reset()); + } else if ("GCP".equals(discriminatorValue)) { + return GcpAuthModel.fromJson(readerToUse.reset()); + } else if ("ServiceBus".equals(discriminatorValue)) { + return GenericBlobSbsAuthModel.fromJson(readerToUse.reset()); + } else if ("GitHub".equals(discriminatorValue)) { + return GitHubAuthModel.fromJson(readerToUse.reset()); + } else if ("None".equals(discriminatorValue)) { + return NoneAuthModel.fromJson(readerToUse.reset()); + } else if ("JwtToken".equals(discriminatorValue)) { + return JwtAuthModel.fromJson(readerToUse.reset()); + } else if ("OAuth2".equals(discriminatorValue)) { + return OAuthModel.fromJson(readerToUse.reset()); + } else if ("Oracle".equals(discriminatorValue)) { + return OracleAuthModel.fromJson(readerToUse.reset()); + } else if ("Session".equals(discriminatorValue)) { + return SessionAuthModel.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static CcpAuthConfig fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CcpAuthConfig deserializedCcpAuthConfig = new CcpAuthConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedCcpAuthConfig.type = CcpAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCcpAuthConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpAuthType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpAuthType.java new file mode 100644 index 000000000000..0b1fbd09be7f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpAuthType.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of paging. + */ +public final class CcpAuthType extends ExpandableStringEnum { + /** + * Static value Basic for CcpAuthType. + */ + public static final CcpAuthType BASIC = fromString("Basic"); + + /** + * Static value APIKey for CcpAuthType. + */ + public static final CcpAuthType APIKEY = fromString("APIKey"); + + /** + * Static value OAuth2 for CcpAuthType. + */ + public static final CcpAuthType OAUTH2 = fromString("OAuth2"); + + /** + * Static value AWS for CcpAuthType. + */ + public static final CcpAuthType AWS = fromString("AWS"); + + /** + * Static value GCP for CcpAuthType. + */ + public static final CcpAuthType GCP = fromString("GCP"); + + /** + * Static value Session for CcpAuthType. + */ + public static final CcpAuthType SESSION = fromString("Session"); + + /** + * Static value JwtToken for CcpAuthType. + */ + public static final CcpAuthType JWT_TOKEN = fromString("JwtToken"); + + /** + * Static value GitHub for CcpAuthType. + */ + public static final CcpAuthType GIT_HUB = fromString("GitHub"); + + /** + * Static value ServiceBus for CcpAuthType. + */ + public static final CcpAuthType SERVICE_BUS = fromString("ServiceBus"); + + /** + * Static value Oracle for CcpAuthType. + */ + public static final CcpAuthType ORACLE = fromString("Oracle"); + + /** + * Static value None for CcpAuthType. + */ + public static final CcpAuthType NONE = fromString("None"); + + /** + * Creates a new instance of CcpAuthType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CcpAuthType() { + } + + /** + * Creates or finds a CcpAuthType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CcpAuthType. + */ + public static CcpAuthType fromString(String name) { + return fromString(name, CcpAuthType.class); + } + + /** + * Gets known CcpAuthType values. + * + * @return known CcpAuthType values. + */ + public static Collection values() { + return values(CcpAuthType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpResponseConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpResponseConfig.java new file mode 100644 index 000000000000..114f738aea3e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CcpResponseConfig.java @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A custom response configuration for a rule. + */ +@Fluent +public final class CcpResponseConfig implements JsonSerializable { + /* + * The json paths, '$' char is the json root. + */ + private List eventsJsonPaths; + + /* + * The value where the status message/code should appear in the response. + */ + private String successStatusJsonPath; + + /* + * The status value. + */ + private String successStatusValue; + + /* + * The value indicating whether the remote server support Gzip and we should expect Gzip response. + */ + private Boolean isGzipCompressed; + + /* + * The compression algorithm. For Example: 'gzip', 'multi-gzip', 'deflate'. + */ + private String compressionAlgo; + + /* + * The response format. possible values are json,csv,xml + */ + private String format; + + /* + * The csv delimiter, in case the response format is CSV. + */ + private String csvDelimiter; + + /* + * The value indicating whether the response has CSV boundary in case the response in CSV format. + */ + private Boolean hasCsvBoundary; + + /* + * The value indicating whether the response has headers in case the response in CSV format. + */ + private Boolean hasCsvHeader; + + /* + * The value indicating whether the response isn't an array of events / logs. By setting this flag to true it means + * the remote server will response with an object which each property has as a value an array of events / logs. + */ + private Boolean convertChildPropertiesToArray; + + /* + * The character used to escape characters in CSV. + */ + private String csvEscape; + + /** + * Creates an instance of CcpResponseConfig class. + */ + public CcpResponseConfig() { + } + + /** + * Get the eventsJsonPaths property: The json paths, '$' char is the json root. + * + * @return the eventsJsonPaths value. + */ + public List eventsJsonPaths() { + return this.eventsJsonPaths; + } + + /** + * Set the eventsJsonPaths property: The json paths, '$' char is the json root. + * + * @param eventsJsonPaths the eventsJsonPaths value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withEventsJsonPaths(List eventsJsonPaths) { + this.eventsJsonPaths = eventsJsonPaths; + return this; + } + + /** + * Get the successStatusJsonPath property: The value where the status message/code should appear in the response. + * + * @return the successStatusJsonPath value. + */ + public String successStatusJsonPath() { + return this.successStatusJsonPath; + } + + /** + * Set the successStatusJsonPath property: The value where the status message/code should appear in the response. + * + * @param successStatusJsonPath the successStatusJsonPath value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withSuccessStatusJsonPath(String successStatusJsonPath) { + this.successStatusJsonPath = successStatusJsonPath; + return this; + } + + /** + * Get the successStatusValue property: The status value. + * + * @return the successStatusValue value. + */ + public String successStatusValue() { + return this.successStatusValue; + } + + /** + * Set the successStatusValue property: The status value. + * + * @param successStatusValue the successStatusValue value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withSuccessStatusValue(String successStatusValue) { + this.successStatusValue = successStatusValue; + return this; + } + + /** + * Get the isGzipCompressed property: The value indicating whether the remote server support Gzip and we should + * expect Gzip response. + * + * @return the isGzipCompressed value. + */ + public Boolean isGzipCompressed() { + return this.isGzipCompressed; + } + + /** + * Set the isGzipCompressed property: The value indicating whether the remote server support Gzip and we should + * expect Gzip response. + * + * @param isGzipCompressed the isGzipCompressed value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withIsGzipCompressed(Boolean isGzipCompressed) { + this.isGzipCompressed = isGzipCompressed; + return this; + } + + /** + * Get the compressionAlgo property: The compression algorithm. For Example: 'gzip', 'multi-gzip', 'deflate'. + * + * @return the compressionAlgo value. + */ + public String compressionAlgo() { + return this.compressionAlgo; + } + + /** + * Set the compressionAlgo property: The compression algorithm. For Example: 'gzip', 'multi-gzip', 'deflate'. + * + * @param compressionAlgo the compressionAlgo value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withCompressionAlgo(String compressionAlgo) { + this.compressionAlgo = compressionAlgo; + return this; + } + + /** + * Get the format property: The response format. possible values are json,csv,xml. + * + * @return the format value. + */ + public String format() { + return this.format; + } + + /** + * Set the format property: The response format. possible values are json,csv,xml. + * + * @param format the format value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withFormat(String format) { + this.format = format; + return this; + } + + /** + * Get the csvDelimiter property: The csv delimiter, in case the response format is CSV. + * + * @return the csvDelimiter value. + */ + public String csvDelimiter() { + return this.csvDelimiter; + } + + /** + * Set the csvDelimiter property: The csv delimiter, in case the response format is CSV. + * + * @param csvDelimiter the csvDelimiter value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withCsvDelimiter(String csvDelimiter) { + this.csvDelimiter = csvDelimiter; + return this; + } + + /** + * Get the hasCsvBoundary property: The value indicating whether the response has CSV boundary in case the response + * in CSV format. + * + * @return the hasCsvBoundary value. + */ + public Boolean hasCsvBoundary() { + return this.hasCsvBoundary; + } + + /** + * Set the hasCsvBoundary property: The value indicating whether the response has CSV boundary in case the response + * in CSV format. + * + * @param hasCsvBoundary the hasCsvBoundary value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withHasCsvBoundary(Boolean hasCsvBoundary) { + this.hasCsvBoundary = hasCsvBoundary; + return this; + } + + /** + * Get the hasCsvHeader property: The value indicating whether the response has headers in case the response in CSV + * format. + * + * @return the hasCsvHeader value. + */ + public Boolean hasCsvHeader() { + return this.hasCsvHeader; + } + + /** + * Set the hasCsvHeader property: The value indicating whether the response has headers in case the response in CSV + * format. + * + * @param hasCsvHeader the hasCsvHeader value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withHasCsvHeader(Boolean hasCsvHeader) { + this.hasCsvHeader = hasCsvHeader; + return this; + } + + /** + * Get the convertChildPropertiesToArray property: The value indicating whether the response isn't an array of + * events / logs. By setting this flag to true it means the remote server will response with an object which each + * property has as a value an array of events / logs. + * + * @return the convertChildPropertiesToArray value. + */ + public Boolean convertChildPropertiesToArray() { + return this.convertChildPropertiesToArray; + } + + /** + * Set the convertChildPropertiesToArray property: The value indicating whether the response isn't an array of + * events / logs. By setting this flag to true it means the remote server will response with an object which each + * property has as a value an array of events / logs. + * + * @param convertChildPropertiesToArray the convertChildPropertiesToArray value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withConvertChildPropertiesToArray(Boolean convertChildPropertiesToArray) { + this.convertChildPropertiesToArray = convertChildPropertiesToArray; + return this; + } + + /** + * Get the csvEscape property: The character used to escape characters in CSV. + * + * @return the csvEscape value. + */ + public String csvEscape() { + return this.csvEscape; + } + + /** + * Set the csvEscape property: The character used to escape characters in CSV. + * + * @param csvEscape the csvEscape value to set. + * @return the CcpResponseConfig object itself. + */ + public CcpResponseConfig withCsvEscape(String csvEscape) { + this.csvEscape = csvEscape; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (eventsJsonPaths() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property eventsJsonPaths in model CcpResponseConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CcpResponseConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("eventsJsonPaths", this.eventsJsonPaths, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("successStatusJsonPath", this.successStatusJsonPath); + jsonWriter.writeStringField("successStatusValue", this.successStatusValue); + jsonWriter.writeBooleanField("isGzipCompressed", this.isGzipCompressed); + jsonWriter.writeStringField("compressionAlgo", this.compressionAlgo); + jsonWriter.writeStringField("format", this.format); + jsonWriter.writeStringField("csvDelimiter", this.csvDelimiter); + jsonWriter.writeBooleanField("hasCsvBoundary", this.hasCsvBoundary); + jsonWriter.writeBooleanField("hasCsvHeader", this.hasCsvHeader); + jsonWriter.writeBooleanField("convertChildPropertiesToArray", this.convertChildPropertiesToArray); + jsonWriter.writeStringField("csvEscape", this.csvEscape); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CcpResponseConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CcpResponseConfig if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CcpResponseConfig. + */ + public static CcpResponseConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CcpResponseConfig deserializedCcpResponseConfig = new CcpResponseConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("eventsJsonPaths".equals(fieldName)) { + List eventsJsonPaths = reader.readArray(reader1 -> reader1.getString()); + deserializedCcpResponseConfig.eventsJsonPaths = eventsJsonPaths; + } else if ("successStatusJsonPath".equals(fieldName)) { + deserializedCcpResponseConfig.successStatusJsonPath = reader.getString(); + } else if ("successStatusValue".equals(fieldName)) { + deserializedCcpResponseConfig.successStatusValue = reader.getString(); + } else if ("isGzipCompressed".equals(fieldName)) { + deserializedCcpResponseConfig.isGzipCompressed = reader.getNullable(JsonReader::getBoolean); + } else if ("compressionAlgo".equals(fieldName)) { + deserializedCcpResponseConfig.compressionAlgo = reader.getString(); + } else if ("format".equals(fieldName)) { + deserializedCcpResponseConfig.format = reader.getString(); + } else if ("csvDelimiter".equals(fieldName)) { + deserializedCcpResponseConfig.csvDelimiter = reader.getString(); + } else if ("hasCsvBoundary".equals(fieldName)) { + deserializedCcpResponseConfig.hasCsvBoundary = reader.getNullable(JsonReader::getBoolean); + } else if ("hasCsvHeader".equals(fieldName)) { + deserializedCcpResponseConfig.hasCsvHeader = reader.getNullable(JsonReader::getBoolean); + } else if ("convertChildPropertiesToArray".equals(fieldName)) { + deserializedCcpResponseConfig.convertChildPropertiesToArray + = reader.getNullable(JsonReader::getBoolean); + } else if ("csvEscape".equals(fieldName)) { + deserializedCcpResponseConfig.csvEscape = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCcpResponseConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CloudApplicationEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CloudApplicationEntity.java index f39f6f099e50..de53df981670 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CloudApplicationEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CloudApplicationEntity.java @@ -10,6 +10,7 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.fluent.models.CloudApplicationEntityProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import java.io.IOException; import java.util.Map; @@ -17,7 +18,7 @@ * Represents a cloud application entity. */ @Immutable -public final class CloudApplicationEntity extends Entity { +public final class CloudApplicationEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessApiPollingDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessApiPollingDataConnector.java new file mode 100644 index 000000000000..fdd215ec2a62 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessApiPollingDataConnector.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ApiPollingParameters; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import java.io.IOException; + +/** + * Represents Codeless API Polling data connector. + */ +@Fluent +public final class CodelessApiPollingDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.APIPOLLING; + + /* + * Codeless poling data connector properties + */ + private ApiPollingParameters innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CodelessApiPollingDataConnector class. + */ + public CodelessApiPollingDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Codeless poling data connector properties. + * + * @return the innerProperties value. + */ + private ApiPollingParameters innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessApiPollingDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the connectorUiConfig property: Config to describe the instructions blade. + * + * @return the connectorUiConfig value. + */ + public CodelessUiConnectorConfigProperties connectorUiConfig() { + return this.innerProperties() == null ? null : this.innerProperties().connectorUiConfig(); + } + + /** + * Set the connectorUiConfig property: Config to describe the instructions blade. + * + * @param connectorUiConfig the connectorUiConfig value to set. + * @return the CodelessApiPollingDataConnector object itself. + */ + public CodelessApiPollingDataConnector + withConnectorUiConfig(CodelessUiConnectorConfigProperties connectorUiConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiPollingParameters(); + } + this.innerProperties().withConnectorUiConfig(connectorUiConfig); + return this; + } + + /** + * Get the pollingConfig property: Config to describe the polling instructions. + * + * @return the pollingConfig value. + */ + public CodelessConnectorPollingConfigProperties pollingConfig() { + return this.innerProperties() == null ? null : this.innerProperties().pollingConfig(); + } + + /** + * Set the pollingConfig property: Config to describe the polling instructions. + * + * @param pollingConfig the pollingConfig value to set. + * @return the CodelessApiPollingDataConnector object itself. + */ + public CodelessApiPollingDataConnector withPollingConfig(CodelessConnectorPollingConfigProperties pollingConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiPollingParameters(); + } + this.innerProperties().withPollingConfig(pollingConfig); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessApiPollingDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessApiPollingDataConnector if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessApiPollingDataConnector. + */ + public static CodelessApiPollingDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessApiPollingDataConnector deserializedCodelessApiPollingDataConnector + = new CodelessApiPollingDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCodelessApiPollingDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCodelessApiPollingDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCodelessApiPollingDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedCodelessApiPollingDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedCodelessApiPollingDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedCodelessApiPollingDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedCodelessApiPollingDataConnector.innerProperties = ApiPollingParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessApiPollingDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingAuthProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingAuthProperties.java new file mode 100644 index 000000000000..3881fab099e8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingAuthProperties.java @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describe the authentication properties needed to successfully authenticate with the server. + */ +@Fluent +public final class CodelessConnectorPollingAuthProperties + implements JsonSerializable { + /* + * The authentication type + */ + private String authType; + + /* + * The header name which the token is sent with + */ + private String apiKeyName; + + /* + * A prefix send in the header before the actual token + */ + private String apiKeyIdentifier; + + /* + * Marks if the key should sent in header + */ + private String isApiKeyInPostPayload; + + /* + * Describes the flow name, for example 'AuthCode' for Oauth 2.0 + */ + private String flowName; + + /* + * The endpoint used to issue a token, used in Oauth 2.0 flow + */ + private String tokenEndpoint; + + /* + * The endpoint used to authorize the user, used in Oauth 2.0 flow + */ + private String authorizationEndpoint; + + /* + * The query parameters used in authorization request, used in Oauth 2.0 flow + */ + private Object authorizationEndpointQueryParameters; + + /* + * The redirect endpoint where we will get the authorization code, used in Oauth 2.0 flow + */ + private String redirectionEndpoint; + + /* + * The query headers used in token request, used in Oauth 2.0 flow + */ + private Object tokenEndpointHeaders; + + /* + * The query parameters used in token request, used in Oauth 2.0 flow + */ + private Object tokenEndpointQueryParameters; + + /* + * Marks if we should send the client secret in header or payload, used in Oauth 2.0 flow + */ + private Boolean isClientSecretInHeader; + + /* + * The OAuth token scope + */ + private String scope; + + /** + * Creates an instance of CodelessConnectorPollingAuthProperties class. + */ + public CodelessConnectorPollingAuthProperties() { + } + + /** + * Get the authType property: The authentication type. + * + * @return the authType value. + */ + public String authType() { + return this.authType; + } + + /** + * Set the authType property: The authentication type. + * + * @param authType the authType value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withAuthType(String authType) { + this.authType = authType; + return this; + } + + /** + * Get the apiKeyName property: The header name which the token is sent with. + * + * @return the apiKeyName value. + */ + public String apiKeyName() { + return this.apiKeyName; + } + + /** + * Set the apiKeyName property: The header name which the token is sent with. + * + * @param apiKeyName the apiKeyName value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withApiKeyName(String apiKeyName) { + this.apiKeyName = apiKeyName; + return this; + } + + /** + * Get the apiKeyIdentifier property: A prefix send in the header before the actual token. + * + * @return the apiKeyIdentifier value. + */ + public String apiKeyIdentifier() { + return this.apiKeyIdentifier; + } + + /** + * Set the apiKeyIdentifier property: A prefix send in the header before the actual token. + * + * @param apiKeyIdentifier the apiKeyIdentifier value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withApiKeyIdentifier(String apiKeyIdentifier) { + this.apiKeyIdentifier = apiKeyIdentifier; + return this; + } + + /** + * Get the isApiKeyInPostPayload property: Marks if the key should sent in header. + * + * @return the isApiKeyInPostPayload value. + */ + public String isApiKeyInPostPayload() { + return this.isApiKeyInPostPayload; + } + + /** + * Set the isApiKeyInPostPayload property: Marks if the key should sent in header. + * + * @param isApiKeyInPostPayload the isApiKeyInPostPayload value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withIsApiKeyInPostPayload(String isApiKeyInPostPayload) { + this.isApiKeyInPostPayload = isApiKeyInPostPayload; + return this; + } + + /** + * Get the flowName property: Describes the flow name, for example 'AuthCode' for Oauth 2.0. + * + * @return the flowName value. + */ + public String flowName() { + return this.flowName; + } + + /** + * Set the flowName property: Describes the flow name, for example 'AuthCode' for Oauth 2.0. + * + * @param flowName the flowName value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withFlowName(String flowName) { + this.flowName = flowName; + return this; + } + + /** + * Get the tokenEndpoint property: The endpoint used to issue a token, used in Oauth 2.0 flow. + * + * @return the tokenEndpoint value. + */ + public String tokenEndpoint() { + return this.tokenEndpoint; + } + + /** + * Set the tokenEndpoint property: The endpoint used to issue a token, used in Oauth 2.0 flow. + * + * @param tokenEndpoint the tokenEndpoint value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withTokenEndpoint(String tokenEndpoint) { + this.tokenEndpoint = tokenEndpoint; + return this; + } + + /** + * Get the authorizationEndpoint property: The endpoint used to authorize the user, used in Oauth 2.0 flow. + * + * @return the authorizationEndpoint value. + */ + public String authorizationEndpoint() { + return this.authorizationEndpoint; + } + + /** + * Set the authorizationEndpoint property: The endpoint used to authorize the user, used in Oauth 2.0 flow. + * + * @param authorizationEndpoint the authorizationEndpoint value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withAuthorizationEndpoint(String authorizationEndpoint) { + this.authorizationEndpoint = authorizationEndpoint; + return this; + } + + /** + * Get the authorizationEndpointQueryParameters property: The query parameters used in authorization request, used + * in Oauth 2.0 flow. + * + * @return the authorizationEndpointQueryParameters value. + */ + public Object authorizationEndpointQueryParameters() { + return this.authorizationEndpointQueryParameters; + } + + /** + * Set the authorizationEndpointQueryParameters property: The query parameters used in authorization request, used + * in Oauth 2.0 flow. + * + * @param authorizationEndpointQueryParameters the authorizationEndpointQueryParameters value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties + withAuthorizationEndpointQueryParameters(Object authorizationEndpointQueryParameters) { + this.authorizationEndpointQueryParameters = authorizationEndpointQueryParameters; + return this; + } + + /** + * Get the redirectionEndpoint property: The redirect endpoint where we will get the authorization code, used in + * Oauth 2.0 flow. + * + * @return the redirectionEndpoint value. + */ + public String redirectionEndpoint() { + return this.redirectionEndpoint; + } + + /** + * Set the redirectionEndpoint property: The redirect endpoint where we will get the authorization code, used in + * Oauth 2.0 flow. + * + * @param redirectionEndpoint the redirectionEndpoint value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withRedirectionEndpoint(String redirectionEndpoint) { + this.redirectionEndpoint = redirectionEndpoint; + return this; + } + + /** + * Get the tokenEndpointHeaders property: The query headers used in token request, used in Oauth 2.0 flow. + * + * @return the tokenEndpointHeaders value. + */ + public Object tokenEndpointHeaders() { + return this.tokenEndpointHeaders; + } + + /** + * Set the tokenEndpointHeaders property: The query headers used in token request, used in Oauth 2.0 flow. + * + * @param tokenEndpointHeaders the tokenEndpointHeaders value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withTokenEndpointHeaders(Object tokenEndpointHeaders) { + this.tokenEndpointHeaders = tokenEndpointHeaders; + return this; + } + + /** + * Get the tokenEndpointQueryParameters property: The query parameters used in token request, used in Oauth 2.0 + * flow. + * + * @return the tokenEndpointQueryParameters value. + */ + public Object tokenEndpointQueryParameters() { + return this.tokenEndpointQueryParameters; + } + + /** + * Set the tokenEndpointQueryParameters property: The query parameters used in token request, used in Oauth 2.0 + * flow. + * + * @param tokenEndpointQueryParameters the tokenEndpointQueryParameters value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties + withTokenEndpointQueryParameters(Object tokenEndpointQueryParameters) { + this.tokenEndpointQueryParameters = tokenEndpointQueryParameters; + return this; + } + + /** + * Get the isClientSecretInHeader property: Marks if we should send the client secret in header or payload, used in + * Oauth 2.0 flow. + * + * @return the isClientSecretInHeader value. + */ + public Boolean isClientSecretInHeader() { + return this.isClientSecretInHeader; + } + + /** + * Set the isClientSecretInHeader property: Marks if we should send the client secret in header or payload, used in + * Oauth 2.0 flow. + * + * @param isClientSecretInHeader the isClientSecretInHeader value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withIsClientSecretInHeader(Boolean isClientSecretInHeader) { + this.isClientSecretInHeader = isClientSecretInHeader; + return this; + } + + /** + * Get the scope property: The OAuth token scope. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The OAuth token scope. + * + * @param scope the scope value to set. + * @return the CodelessConnectorPollingAuthProperties object itself. + */ + public CodelessConnectorPollingAuthProperties withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property authType in model CodelessConnectorPollingAuthProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodelessConnectorPollingAuthProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("authType", this.authType); + jsonWriter.writeStringField("apiKeyName", this.apiKeyName); + jsonWriter.writeStringField("apiKeyIdentifier", this.apiKeyIdentifier); + jsonWriter.writeStringField("isApiKeyInPostPayload", this.isApiKeyInPostPayload); + jsonWriter.writeStringField("flowName", this.flowName); + jsonWriter.writeStringField("tokenEndpoint", this.tokenEndpoint); + jsonWriter.writeStringField("authorizationEndpoint", this.authorizationEndpoint); + jsonWriter.writeUntypedField("authorizationEndpointQueryParameters", this.authorizationEndpointQueryParameters); + jsonWriter.writeStringField("redirectionEndpoint", this.redirectionEndpoint); + jsonWriter.writeUntypedField("tokenEndpointHeaders", this.tokenEndpointHeaders); + jsonWriter.writeUntypedField("tokenEndpointQueryParameters", this.tokenEndpointQueryParameters); + jsonWriter.writeBooleanField("isClientSecretInHeader", this.isClientSecretInHeader); + jsonWriter.writeStringField("scope", this.scope); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessConnectorPollingAuthProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessConnectorPollingAuthProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessConnectorPollingAuthProperties. + */ + public static CodelessConnectorPollingAuthProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessConnectorPollingAuthProperties deserializedCodelessConnectorPollingAuthProperties + = new CodelessConnectorPollingAuthProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authType".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.authType = reader.getString(); + } else if ("apiKeyName".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.apiKeyName = reader.getString(); + } else if ("apiKeyIdentifier".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.apiKeyIdentifier = reader.getString(); + } else if ("isApiKeyInPostPayload".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.isApiKeyInPostPayload = reader.getString(); + } else if ("flowName".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.flowName = reader.getString(); + } else if ("tokenEndpoint".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.tokenEndpoint = reader.getString(); + } else if ("authorizationEndpoint".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.authorizationEndpoint = reader.getString(); + } else if ("authorizationEndpointQueryParameters".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.authorizationEndpointQueryParameters + = reader.readUntyped(); + } else if ("redirectionEndpoint".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.redirectionEndpoint = reader.getString(); + } else if ("tokenEndpointHeaders".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.tokenEndpointHeaders = reader.readUntyped(); + } else if ("tokenEndpointQueryParameters".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.tokenEndpointQueryParameters + = reader.readUntyped(); + } else if ("isClientSecretInHeader".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.isClientSecretInHeader + = reader.getNullable(JsonReader::getBoolean); + } else if ("scope".equals(fieldName)) { + deserializedCodelessConnectorPollingAuthProperties.scope = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessConnectorPollingAuthProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingConfigProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingConfigProperties.java new file mode 100644 index 000000000000..84b7cd20a2f7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingConfigProperties.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Config to describe the polling config for API poller connector. + */ +@Fluent +public final class CodelessConnectorPollingConfigProperties + implements JsonSerializable { + /* + * The poller active status + */ + private Boolean isActive; + + /* + * Describe the authentication type of the poller + */ + private CodelessConnectorPollingAuthProperties auth; + + /* + * Describe the poll request config parameters of the poller + */ + private CodelessConnectorPollingRequestProperties request; + + /* + * Describe the poll request paging config of the poller + */ + private CodelessConnectorPollingPagingProperties paging; + + /* + * Describe the response config parameters of the poller + */ + private CodelessConnectorPollingResponseProperties response; + + /** + * Creates an instance of CodelessConnectorPollingConfigProperties class. + */ + public CodelessConnectorPollingConfigProperties() { + } + + /** + * Get the isActive property: The poller active status. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Set the isActive property: The poller active status. + * + * @param isActive the isActive value to set. + * @return the CodelessConnectorPollingConfigProperties object itself. + */ + public CodelessConnectorPollingConfigProperties withIsActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get the auth property: Describe the authentication type of the poller. + * + * @return the auth value. + */ + public CodelessConnectorPollingAuthProperties auth() { + return this.auth; + } + + /** + * Set the auth property: Describe the authentication type of the poller. + * + * @param auth the auth value to set. + * @return the CodelessConnectorPollingConfigProperties object itself. + */ + public CodelessConnectorPollingConfigProperties withAuth(CodelessConnectorPollingAuthProperties auth) { + this.auth = auth; + return this; + } + + /** + * Get the request property: Describe the poll request config parameters of the poller. + * + * @return the request value. + */ + public CodelessConnectorPollingRequestProperties request() { + return this.request; + } + + /** + * Set the request property: Describe the poll request config parameters of the poller. + * + * @param request the request value to set. + * @return the CodelessConnectorPollingConfigProperties object itself. + */ + public CodelessConnectorPollingConfigProperties withRequest(CodelessConnectorPollingRequestProperties request) { + this.request = request; + return this; + } + + /** + * Get the paging property: Describe the poll request paging config of the poller. + * + * @return the paging value. + */ + public CodelessConnectorPollingPagingProperties paging() { + return this.paging; + } + + /** + * Set the paging property: Describe the poll request paging config of the poller. + * + * @param paging the paging value to set. + * @return the CodelessConnectorPollingConfigProperties object itself. + */ + public CodelessConnectorPollingConfigProperties withPaging(CodelessConnectorPollingPagingProperties paging) { + this.paging = paging; + return this; + } + + /** + * Get the response property: Describe the response config parameters of the poller. + * + * @return the response value. + */ + public CodelessConnectorPollingResponseProperties response() { + return this.response; + } + + /** + * Set the response property: Describe the response config parameters of the poller. + * + * @param response the response value to set. + * @return the CodelessConnectorPollingConfigProperties object itself. + */ + public CodelessConnectorPollingConfigProperties withResponse(CodelessConnectorPollingResponseProperties response) { + this.response = response; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (auth() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property auth in model CodelessConnectorPollingConfigProperties")); + } else { + auth().validate(); + } + if (request() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property request in model CodelessConnectorPollingConfigProperties")); + } else { + request().validate(); + } + if (paging() != null) { + paging().validate(); + } + if (response() != null) { + response().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodelessConnectorPollingConfigProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("auth", this.auth); + jsonWriter.writeJsonField("request", this.request); + jsonWriter.writeBooleanField("isActive", this.isActive); + jsonWriter.writeJsonField("paging", this.paging); + jsonWriter.writeJsonField("response", this.response); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessConnectorPollingConfigProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessConnectorPollingConfigProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessConnectorPollingConfigProperties. + */ + public static CodelessConnectorPollingConfigProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessConnectorPollingConfigProperties deserializedCodelessConnectorPollingConfigProperties + = new CodelessConnectorPollingConfigProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("auth".equals(fieldName)) { + deserializedCodelessConnectorPollingConfigProperties.auth + = CodelessConnectorPollingAuthProperties.fromJson(reader); + } else if ("request".equals(fieldName)) { + deserializedCodelessConnectorPollingConfigProperties.request + = CodelessConnectorPollingRequestProperties.fromJson(reader); + } else if ("isActive".equals(fieldName)) { + deserializedCodelessConnectorPollingConfigProperties.isActive + = reader.getNullable(JsonReader::getBoolean); + } else if ("paging".equals(fieldName)) { + deserializedCodelessConnectorPollingConfigProperties.paging + = CodelessConnectorPollingPagingProperties.fromJson(reader); + } else if ("response".equals(fieldName)) { + deserializedCodelessConnectorPollingConfigProperties.response + = CodelessConnectorPollingResponseProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessConnectorPollingConfigProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingPagingProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingPagingProperties.java new file mode 100644 index 000000000000..f661f65934f4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingPagingProperties.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describe the properties needed to make a pagination call. + */ +@Fluent +public final class CodelessConnectorPollingPagingProperties + implements JsonSerializable { + /* + * Describes the type. could be 'None', 'PageToken', 'PageCount', 'TimeStamp' + */ + private String pagingType; + + /* + * Defines the name of a next page attribute + */ + private String nextPageParaName; + + /* + * Defines the path to a next page token JSON + */ + private String nextPageTokenJsonPath; + + /* + * Defines the path to a page count attribute + */ + private String pageCountAttributePath; + + /* + * Defines the path to a page total count attribute + */ + private String pageTotalCountAttributePath; + + /* + * Defines the path to a paging time stamp attribute + */ + private String pageTimestampAttributePath; + + /* + * Determines whether to search for the latest time stamp in the events list + */ + private String searchTheLatestTimestampFromEventsList; + + /* + * Defines the name of the page size parameter + */ + private String pageSizeParaName; + + /* + * Defines the paging size + */ + private Integer pageSize; + + /** + * Creates an instance of CodelessConnectorPollingPagingProperties class. + */ + public CodelessConnectorPollingPagingProperties() { + } + + /** + * Get the pagingType property: Describes the type. could be 'None', 'PageToken', 'PageCount', 'TimeStamp'. + * + * @return the pagingType value. + */ + public String pagingType() { + return this.pagingType; + } + + /** + * Set the pagingType property: Describes the type. could be 'None', 'PageToken', 'PageCount', 'TimeStamp'. + * + * @param pagingType the pagingType value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties withPagingType(String pagingType) { + this.pagingType = pagingType; + return this; + } + + /** + * Get the nextPageParaName property: Defines the name of a next page attribute. + * + * @return the nextPageParaName value. + */ + public String nextPageParaName() { + return this.nextPageParaName; + } + + /** + * Set the nextPageParaName property: Defines the name of a next page attribute. + * + * @param nextPageParaName the nextPageParaName value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties withNextPageParaName(String nextPageParaName) { + this.nextPageParaName = nextPageParaName; + return this; + } + + /** + * Get the nextPageTokenJsonPath property: Defines the path to a next page token JSON. + * + * @return the nextPageTokenJsonPath value. + */ + public String nextPageTokenJsonPath() { + return this.nextPageTokenJsonPath; + } + + /** + * Set the nextPageTokenJsonPath property: Defines the path to a next page token JSON. + * + * @param nextPageTokenJsonPath the nextPageTokenJsonPath value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties withNextPageTokenJsonPath(String nextPageTokenJsonPath) { + this.nextPageTokenJsonPath = nextPageTokenJsonPath; + return this; + } + + /** + * Get the pageCountAttributePath property: Defines the path to a page count attribute. + * + * @return the pageCountAttributePath value. + */ + public String pageCountAttributePath() { + return this.pageCountAttributePath; + } + + /** + * Set the pageCountAttributePath property: Defines the path to a page count attribute. + * + * @param pageCountAttributePath the pageCountAttributePath value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties withPageCountAttributePath(String pageCountAttributePath) { + this.pageCountAttributePath = pageCountAttributePath; + return this; + } + + /** + * Get the pageTotalCountAttributePath property: Defines the path to a page total count attribute. + * + * @return the pageTotalCountAttributePath value. + */ + public String pageTotalCountAttributePath() { + return this.pageTotalCountAttributePath; + } + + /** + * Set the pageTotalCountAttributePath property: Defines the path to a page total count attribute. + * + * @param pageTotalCountAttributePath the pageTotalCountAttributePath value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties + withPageTotalCountAttributePath(String pageTotalCountAttributePath) { + this.pageTotalCountAttributePath = pageTotalCountAttributePath; + return this; + } + + /** + * Get the pageTimestampAttributePath property: Defines the path to a paging time stamp attribute. + * + * @return the pageTimestampAttributePath value. + */ + public String pageTimestampAttributePath() { + return this.pageTimestampAttributePath; + } + + /** + * Set the pageTimestampAttributePath property: Defines the path to a paging time stamp attribute. + * + * @param pageTimestampAttributePath the pageTimestampAttributePath value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties withPageTimestampAttributePath(String pageTimestampAttributePath) { + this.pageTimestampAttributePath = pageTimestampAttributePath; + return this; + } + + /** + * Get the searchTheLatestTimestampFromEventsList property: Determines whether to search for the latest time stamp + * in the events list. + * + * @return the searchTheLatestTimestampFromEventsList value. + */ + public String searchTheLatestTimestampFromEventsList() { + return this.searchTheLatestTimestampFromEventsList; + } + + /** + * Set the searchTheLatestTimestampFromEventsList property: Determines whether to search for the latest time stamp + * in the events list. + * + * @param searchTheLatestTimestampFromEventsList the searchTheLatestTimestampFromEventsList value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties + withSearchTheLatestTimestampFromEventsList(String searchTheLatestTimestampFromEventsList) { + this.searchTheLatestTimestampFromEventsList = searchTheLatestTimestampFromEventsList; + return this; + } + + /** + * Get the pageSizeParaName property: Defines the name of the page size parameter. + * + * @return the pageSizeParaName value. + */ + public String pageSizeParaName() { + return this.pageSizeParaName; + } + + /** + * Set the pageSizeParaName property: Defines the name of the page size parameter. + * + * @param pageSizeParaName the pageSizeParaName value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties withPageSizeParaName(String pageSizeParaName) { + this.pageSizeParaName = pageSizeParaName; + return this; + } + + /** + * Get the pageSize property: Defines the paging size. + * + * @return the pageSize value. + */ + public Integer pageSize() { + return this.pageSize; + } + + /** + * Set the pageSize property: Defines the paging size. + * + * @param pageSize the pageSize value to set. + * @return the CodelessConnectorPollingPagingProperties object itself. + */ + public CodelessConnectorPollingPagingProperties withPageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (pagingType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pagingType in model CodelessConnectorPollingPagingProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodelessConnectorPollingPagingProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pagingType", this.pagingType); + jsonWriter.writeStringField("nextPageParaName", this.nextPageParaName); + jsonWriter.writeStringField("nextPageTokenJsonPath", this.nextPageTokenJsonPath); + jsonWriter.writeStringField("pageCountAttributePath", this.pageCountAttributePath); + jsonWriter.writeStringField("pageTotalCountAttributePath", this.pageTotalCountAttributePath); + jsonWriter.writeStringField("pageTimeStampAttributePath", this.pageTimestampAttributePath); + jsonWriter.writeStringField("searchTheLatestTimeStampFromEventsList", + this.searchTheLatestTimestampFromEventsList); + jsonWriter.writeStringField("pageSizeParaName", this.pageSizeParaName); + jsonWriter.writeNumberField("pageSize", this.pageSize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessConnectorPollingPagingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessConnectorPollingPagingProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessConnectorPollingPagingProperties. + */ + public static CodelessConnectorPollingPagingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessConnectorPollingPagingProperties deserializedCodelessConnectorPollingPagingProperties + = new CodelessConnectorPollingPagingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pagingType".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.pagingType = reader.getString(); + } else if ("nextPageParaName".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.nextPageParaName = reader.getString(); + } else if ("nextPageTokenJsonPath".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.nextPageTokenJsonPath = reader.getString(); + } else if ("pageCountAttributePath".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.pageCountAttributePath = reader.getString(); + } else if ("pageTotalCountAttributePath".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.pageTotalCountAttributePath + = reader.getString(); + } else if ("pageTimeStampAttributePath".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.pageTimestampAttributePath + = reader.getString(); + } else if ("searchTheLatestTimeStampFromEventsList".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.searchTheLatestTimestampFromEventsList + = reader.getString(); + } else if ("pageSizeParaName".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.pageSizeParaName = reader.getString(); + } else if ("pageSize".equals(fieldName)) { + deserializedCodelessConnectorPollingPagingProperties.pageSize + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessConnectorPollingPagingProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingRequestProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingRequestProperties.java new file mode 100644 index 000000000000..234f8cc78f6f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingRequestProperties.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describe the request properties needed to successfully pull from the server. + */ +@Fluent +public final class CodelessConnectorPollingRequestProperties + implements JsonSerializable { + /* + * Describe the endpoint we should pull the data from + */ + private String apiEndpoint; + + /* + * Defines the rate limit QPS + */ + private Integer rateLimitQps; + + /* + * The window interval we will use the pull the data + */ + private int queryWindowInMin; + + /* + * The http method type we will use in the poll request, GET or POST + */ + private String httpMethod; + + /* + * The time format will be used the query events in a specific window + */ + private String queryTimeFormat; + + /* + * Describe the amount of time we should try and poll the data in case of failure + */ + private Integer retryCount; + + /* + * The number of seconds we will consider as a request timeout + */ + private Integer timeoutInSeconds; + + /* + * Describe the headers sent in the poll request + */ + private Object headers; + + /* + * Describe the query parameters sent in the poll request + */ + private Object queryParameters; + + /* + * For advanced scenarios for example user name/password embedded in nested JSON payload + */ + private String queryParametersTemplate; + + /* + * This will be used the query events from a start of the time window + */ + private String startTimeAttributeName; + + /* + * This will be used the query events from the end of the time window + */ + private String endTimeAttributeName; + + /** + * Creates an instance of CodelessConnectorPollingRequestProperties class. + */ + public CodelessConnectorPollingRequestProperties() { + } + + /** + * Get the apiEndpoint property: Describe the endpoint we should pull the data from. + * + * @return the apiEndpoint value. + */ + public String apiEndpoint() { + return this.apiEndpoint; + } + + /** + * Set the apiEndpoint property: Describe the endpoint we should pull the data from. + * + * @param apiEndpoint the apiEndpoint value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withApiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; + return this; + } + + /** + * Get the rateLimitQps property: Defines the rate limit QPS. + * + * @return the rateLimitQps value. + */ + public Integer rateLimitQps() { + return this.rateLimitQps; + } + + /** + * Set the rateLimitQps property: Defines the rate limit QPS. + * + * @param rateLimitQps the rateLimitQps value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withRateLimitQps(Integer rateLimitQps) { + this.rateLimitQps = rateLimitQps; + return this; + } + + /** + * Get the queryWindowInMin property: The window interval we will use the pull the data. + * + * @return the queryWindowInMin value. + */ + public int queryWindowInMin() { + return this.queryWindowInMin; + } + + /** + * Set the queryWindowInMin property: The window interval we will use the pull the data. + * + * @param queryWindowInMin the queryWindowInMin value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withQueryWindowInMin(int queryWindowInMin) { + this.queryWindowInMin = queryWindowInMin; + return this; + } + + /** + * Get the httpMethod property: The http method type we will use in the poll request, GET or POST. + * + * @return the httpMethod value. + */ + public String httpMethod() { + return this.httpMethod; + } + + /** + * Set the httpMethod property: The http method type we will use in the poll request, GET or POST. + * + * @param httpMethod the httpMethod value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + /** + * Get the queryTimeFormat property: The time format will be used the query events in a specific window. + * + * @return the queryTimeFormat value. + */ + public String queryTimeFormat() { + return this.queryTimeFormat; + } + + /** + * Set the queryTimeFormat property: The time format will be used the query events in a specific window. + * + * @param queryTimeFormat the queryTimeFormat value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withQueryTimeFormat(String queryTimeFormat) { + this.queryTimeFormat = queryTimeFormat; + return this; + } + + /** + * Get the retryCount property: Describe the amount of time we should try and poll the data in case of failure. + * + * @return the retryCount value. + */ + public Integer retryCount() { + return this.retryCount; + } + + /** + * Set the retryCount property: Describe the amount of time we should try and poll the data in case of failure. + * + * @param retryCount the retryCount value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withRetryCount(Integer retryCount) { + this.retryCount = retryCount; + return this; + } + + /** + * Get the timeoutInSeconds property: The number of seconds we will consider as a request timeout. + * + * @return the timeoutInSeconds value. + */ + public Integer timeoutInSeconds() { + return this.timeoutInSeconds; + } + + /** + * Set the timeoutInSeconds property: The number of seconds we will consider as a request timeout. + * + * @param timeoutInSeconds the timeoutInSeconds value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withTimeoutInSeconds(Integer timeoutInSeconds) { + this.timeoutInSeconds = timeoutInSeconds; + return this; + } + + /** + * Get the headers property: Describe the headers sent in the poll request. + * + * @return the headers value. + */ + public Object headers() { + return this.headers; + } + + /** + * Set the headers property: Describe the headers sent in the poll request. + * + * @param headers the headers value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withHeaders(Object headers) { + this.headers = headers; + return this; + } + + /** + * Get the queryParameters property: Describe the query parameters sent in the poll request. + * + * @return the queryParameters value. + */ + public Object queryParameters() { + return this.queryParameters; + } + + /** + * Set the queryParameters property: Describe the query parameters sent in the poll request. + * + * @param queryParameters the queryParameters value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withQueryParameters(Object queryParameters) { + this.queryParameters = queryParameters; + return this; + } + + /** + * Get the queryParametersTemplate property: For advanced scenarios for example user name/password embedded in + * nested JSON payload. + * + * @return the queryParametersTemplate value. + */ + public String queryParametersTemplate() { + return this.queryParametersTemplate; + } + + /** + * Set the queryParametersTemplate property: For advanced scenarios for example user name/password embedded in + * nested JSON payload. + * + * @param queryParametersTemplate the queryParametersTemplate value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withQueryParametersTemplate(String queryParametersTemplate) { + this.queryParametersTemplate = queryParametersTemplate; + return this; + } + + /** + * Get the startTimeAttributeName property: This will be used the query events from a start of the time window. + * + * @return the startTimeAttributeName value. + */ + public String startTimeAttributeName() { + return this.startTimeAttributeName; + } + + /** + * Set the startTimeAttributeName property: This will be used the query events from a start of the time window. + * + * @param startTimeAttributeName the startTimeAttributeName value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withStartTimeAttributeName(String startTimeAttributeName) { + this.startTimeAttributeName = startTimeAttributeName; + return this; + } + + /** + * Get the endTimeAttributeName property: This will be used the query events from the end of the time window. + * + * @return the endTimeAttributeName value. + */ + public String endTimeAttributeName() { + return this.endTimeAttributeName; + } + + /** + * Set the endTimeAttributeName property: This will be used the query events from the end of the time window. + * + * @param endTimeAttributeName the endTimeAttributeName value to set. + * @return the CodelessConnectorPollingRequestProperties object itself. + */ + public CodelessConnectorPollingRequestProperties withEndTimeAttributeName(String endTimeAttributeName) { + this.endTimeAttributeName = endTimeAttributeName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (apiEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property apiEndpoint in model CodelessConnectorPollingRequestProperties")); + } + if (httpMethod() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property httpMethod in model CodelessConnectorPollingRequestProperties")); + } + if (queryTimeFormat() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property queryTimeFormat in model CodelessConnectorPollingRequestProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodelessConnectorPollingRequestProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("apiEndpoint", this.apiEndpoint); + jsonWriter.writeIntField("queryWindowInMin", this.queryWindowInMin); + jsonWriter.writeStringField("httpMethod", this.httpMethod); + jsonWriter.writeStringField("queryTimeFormat", this.queryTimeFormat); + jsonWriter.writeNumberField("rateLimitQps", this.rateLimitQps); + jsonWriter.writeNumberField("retryCount", this.retryCount); + jsonWriter.writeNumberField("timeoutInSeconds", this.timeoutInSeconds); + jsonWriter.writeUntypedField("headers", this.headers); + jsonWriter.writeUntypedField("queryParameters", this.queryParameters); + jsonWriter.writeStringField("queryParametersTemplate", this.queryParametersTemplate); + jsonWriter.writeStringField("startTimeAttributeName", this.startTimeAttributeName); + jsonWriter.writeStringField("endTimeAttributeName", this.endTimeAttributeName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessConnectorPollingRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessConnectorPollingRequestProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessConnectorPollingRequestProperties. + */ + public static CodelessConnectorPollingRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessConnectorPollingRequestProperties deserializedCodelessConnectorPollingRequestProperties + = new CodelessConnectorPollingRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("apiEndpoint".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.apiEndpoint = reader.getString(); + } else if ("queryWindowInMin".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.queryWindowInMin = reader.getInt(); + } else if ("httpMethod".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.httpMethod = reader.getString(); + } else if ("queryTimeFormat".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.queryTimeFormat = reader.getString(); + } else if ("rateLimitQps".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.rateLimitQps + = reader.getNullable(JsonReader::getInt); + } else if ("retryCount".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.retryCount + = reader.getNullable(JsonReader::getInt); + } else if ("timeoutInSeconds".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.timeoutInSeconds + = reader.getNullable(JsonReader::getInt); + } else if ("headers".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.headers = reader.readUntyped(); + } else if ("queryParameters".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.queryParameters = reader.readUntyped(); + } else if ("queryParametersTemplate".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.queryParametersTemplate = reader.getString(); + } else if ("startTimeAttributeName".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.startTimeAttributeName = reader.getString(); + } else if ("endTimeAttributeName".equals(fieldName)) { + deserializedCodelessConnectorPollingRequestProperties.endTimeAttributeName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessConnectorPollingRequestProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingResponseProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingResponseProperties.java new file mode 100644 index 000000000000..5f109a93df0a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessConnectorPollingResponseProperties.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes the response from the external server. + */ +@Fluent +public final class CodelessConnectorPollingResponseProperties + implements JsonSerializable { + /* + * Describes the path we should extract the data in the response + */ + private List eventsJsonPaths; + + /* + * Describes the path we should extract the status code in the response + */ + private String successStatusJsonPath; + + /* + * Describes the path we should extract the status value in the response + */ + private String successStatusValue; + + /* + * Describes if the data in the response is Gzip + */ + private Boolean isGzipCompressed; + + /** + * Creates an instance of CodelessConnectorPollingResponseProperties class. + */ + public CodelessConnectorPollingResponseProperties() { + } + + /** + * Get the eventsJsonPaths property: Describes the path we should extract the data in the response. + * + * @return the eventsJsonPaths value. + */ + public List eventsJsonPaths() { + return this.eventsJsonPaths; + } + + /** + * Set the eventsJsonPaths property: Describes the path we should extract the data in the response. + * + * @param eventsJsonPaths the eventsJsonPaths value to set. + * @return the CodelessConnectorPollingResponseProperties object itself. + */ + public CodelessConnectorPollingResponseProperties withEventsJsonPaths(List eventsJsonPaths) { + this.eventsJsonPaths = eventsJsonPaths; + return this; + } + + /** + * Get the successStatusJsonPath property: Describes the path we should extract the status code in the response. + * + * @return the successStatusJsonPath value. + */ + public String successStatusJsonPath() { + return this.successStatusJsonPath; + } + + /** + * Set the successStatusJsonPath property: Describes the path we should extract the status code in the response. + * + * @param successStatusJsonPath the successStatusJsonPath value to set. + * @return the CodelessConnectorPollingResponseProperties object itself. + */ + public CodelessConnectorPollingResponseProperties withSuccessStatusJsonPath(String successStatusJsonPath) { + this.successStatusJsonPath = successStatusJsonPath; + return this; + } + + /** + * Get the successStatusValue property: Describes the path we should extract the status value in the response. + * + * @return the successStatusValue value. + */ + public String successStatusValue() { + return this.successStatusValue; + } + + /** + * Set the successStatusValue property: Describes the path we should extract the status value in the response. + * + * @param successStatusValue the successStatusValue value to set. + * @return the CodelessConnectorPollingResponseProperties object itself. + */ + public CodelessConnectorPollingResponseProperties withSuccessStatusValue(String successStatusValue) { + this.successStatusValue = successStatusValue; + return this; + } + + /** + * Get the isGzipCompressed property: Describes if the data in the response is Gzip. + * + * @return the isGzipCompressed value. + */ + public Boolean isGzipCompressed() { + return this.isGzipCompressed; + } + + /** + * Set the isGzipCompressed property: Describes if the data in the response is Gzip. + * + * @param isGzipCompressed the isGzipCompressed value to set. + * @return the CodelessConnectorPollingResponseProperties object itself. + */ + public CodelessConnectorPollingResponseProperties withIsGzipCompressed(Boolean isGzipCompressed) { + this.isGzipCompressed = isGzipCompressed; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (eventsJsonPaths() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property eventsJsonPaths in model CodelessConnectorPollingResponseProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodelessConnectorPollingResponseProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("eventsJsonPaths", this.eventsJsonPaths, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("successStatusJsonPath", this.successStatusJsonPath); + jsonWriter.writeStringField("successStatusValue", this.successStatusValue); + jsonWriter.writeBooleanField("isGzipCompressed", this.isGzipCompressed); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessConnectorPollingResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessConnectorPollingResponseProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessConnectorPollingResponseProperties. + */ + public static CodelessConnectorPollingResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessConnectorPollingResponseProperties deserializedCodelessConnectorPollingResponseProperties + = new CodelessConnectorPollingResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("eventsJsonPaths".equals(fieldName)) { + List eventsJsonPaths = reader.readArray(reader1 -> reader1.getString()); + deserializedCodelessConnectorPollingResponseProperties.eventsJsonPaths = eventsJsonPaths; + } else if ("successStatusJsonPath".equals(fieldName)) { + deserializedCodelessConnectorPollingResponseProperties.successStatusJsonPath = reader.getString(); + } else if ("successStatusValue".equals(fieldName)) { + deserializedCodelessConnectorPollingResponseProperties.successStatusValue = reader.getString(); + } else if ("isGzipCompressed".equals(fieldName)) { + deserializedCodelessConnectorPollingResponseProperties.isGzipCompressed + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessConnectorPollingResponseProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigProperties.java new file mode 100644 index 000000000000..908de21a9c97 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigProperties.java @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Config to describe the instructions blade. + */ +@Fluent +public final class CodelessUiConnectorConfigProperties + implements JsonSerializable { + /* + * Connector blade title + */ + private String title; + + /* + * Connector publisher name + */ + private String publisher; + + /* + * Connector description + */ + private String descriptionMarkdown; + + /* + * An optional custom image to be used when displaying the connector within Azure Sentinel's connector's gallery + */ + private String customImage; + + /* + * Name of the table the connector will insert the data to + */ + private String graphQueriesTableName; + + /* + * The graph query to show the current data status + */ + private List graphQueries; + + /* + * The sample queries for the connector + */ + private List sampleQueries; + + /* + * Data types to check for last data received + */ + private List dataTypes; + + /* + * Define the way the connector check connectivity + */ + private List connectivityCriteria; + + /* + * Connector Availability Status + */ + private Availability availability; + + /* + * Permissions required for the connector + */ + private Permissions permissions; + + /* + * Instruction steps to enable the connector + */ + private List instructionSteps; + + /** + * Creates an instance of CodelessUiConnectorConfigProperties class. + */ + public CodelessUiConnectorConfigProperties() { + } + + /** + * Get the title property: Connector blade title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Connector blade title. + * + * @param title the title value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the publisher property: Connector publisher name. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: Connector publisher name. + * + * @param publisher the publisher value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the descriptionMarkdown property: Connector description. + * + * @return the descriptionMarkdown value. + */ + public String descriptionMarkdown() { + return this.descriptionMarkdown; + } + + /** + * Set the descriptionMarkdown property: Connector description. + * + * @param descriptionMarkdown the descriptionMarkdown value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withDescriptionMarkdown(String descriptionMarkdown) { + this.descriptionMarkdown = descriptionMarkdown; + return this; + } + + /** + * Get the customImage property: An optional custom image to be used when displaying the connector within Azure + * Sentinel's connector's gallery. + * + * @return the customImage value. + */ + public String customImage() { + return this.customImage; + } + + /** + * Set the customImage property: An optional custom image to be used when displaying the connector within Azure + * Sentinel's connector's gallery. + * + * @param customImage the customImage value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withCustomImage(String customImage) { + this.customImage = customImage; + return this; + } + + /** + * Get the graphQueriesTableName property: Name of the table the connector will insert the data to. + * + * @return the graphQueriesTableName value. + */ + public String graphQueriesTableName() { + return this.graphQueriesTableName; + } + + /** + * Set the graphQueriesTableName property: Name of the table the connector will insert the data to. + * + * @param graphQueriesTableName the graphQueriesTableName value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withGraphQueriesTableName(String graphQueriesTableName) { + this.graphQueriesTableName = graphQueriesTableName; + return this; + } + + /** + * Get the graphQueries property: The graph query to show the current data status. + * + * @return the graphQueries value. + */ + public List graphQueries() { + return this.graphQueries; + } + + /** + * Set the graphQueries property: The graph query to show the current data status. + * + * @param graphQueries the graphQueries value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties + withGraphQueries(List graphQueries) { + this.graphQueries = graphQueries; + return this; + } + + /** + * Get the sampleQueries property: The sample queries for the connector. + * + * @return the sampleQueries value. + */ + public List sampleQueries() { + return this.sampleQueries; + } + + /** + * Set the sampleQueries property: The sample queries for the connector. + * + * @param sampleQueries the sampleQueries value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties + withSampleQueries(List sampleQueries) { + this.sampleQueries = sampleQueries; + return this; + } + + /** + * Get the dataTypes property: Data types to check for last data received. + * + * @return the dataTypes value. + */ + public List dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: Data types to check for last data received. + * + * @param dataTypes the dataTypes value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties + withDataTypes(List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * Get the connectivityCriteria property: Define the way the connector check connectivity. + * + * @return the connectivityCriteria value. + */ + public List connectivityCriteria() { + return this.connectivityCriteria; + } + + /** + * Set the connectivityCriteria property: Define the way the connector check connectivity. + * + * @param connectivityCriteria the connectivityCriteria value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withConnectivityCriteria( + List connectivityCriteria) { + this.connectivityCriteria = connectivityCriteria; + return this; + } + + /** + * Get the availability property: Connector Availability Status. + * + * @return the availability value. + */ + public Availability availability() { + return this.availability; + } + + /** + * Set the availability property: Connector Availability Status. + * + * @param availability the availability value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withAvailability(Availability availability) { + this.availability = availability; + return this; + } + + /** + * Get the permissions property: Permissions required for the connector. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.permissions; + } + + /** + * Set the permissions property: Permissions required for the connector. + * + * @param permissions the permissions value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties withPermissions(Permissions permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the instructionSteps property: Instruction steps to enable the connector. + * + * @return the instructionSteps value. + */ + public List instructionSteps() { + return this.instructionSteps; + } + + /** + * Set the instructionSteps property: Instruction steps to enable the connector. + * + * @param instructionSteps the instructionSteps value to set. + * @return the CodelessUiConnectorConfigProperties object itself. + */ + public CodelessUiConnectorConfigProperties + withInstructionSteps(List instructionSteps) { + this.instructionSteps = instructionSteps; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property title in model CodelessUiConnectorConfigProperties")); + } + if (publisher() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property publisher in model CodelessUiConnectorConfigProperties")); + } + if (descriptionMarkdown() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property descriptionMarkdown in model CodelessUiConnectorConfigProperties")); + } + if (graphQueriesTableName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property graphQueriesTableName in model CodelessUiConnectorConfigProperties")); + } + if (graphQueries() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property graphQueries in model CodelessUiConnectorConfigProperties")); + } else { + graphQueries().forEach(e -> e.validate()); + } + if (sampleQueries() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sampleQueries in model CodelessUiConnectorConfigProperties")); + } else { + sampleQueries().forEach(e -> e.validate()); + } + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model CodelessUiConnectorConfigProperties")); + } else { + dataTypes().forEach(e -> e.validate()); + } + if (connectivityCriteria() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectivityCriteria in model CodelessUiConnectorConfigProperties")); + } else { + connectivityCriteria().forEach(e -> e.validate()); + } + if (availability() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property availability in model CodelessUiConnectorConfigProperties")); + } else { + availability().validate(); + } + if (permissions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property permissions in model CodelessUiConnectorConfigProperties")); + } else { + permissions().validate(); + } + if (instructionSteps() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property instructionSteps in model CodelessUiConnectorConfigProperties")); + } else { + instructionSteps().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodelessUiConnectorConfigProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("descriptionMarkdown", this.descriptionMarkdown); + jsonWriter.writeStringField("graphQueriesTableName", this.graphQueriesTableName); + jsonWriter.writeArrayField("graphQueries", this.graphQueries, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("sampleQueries", this.sampleQueries, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("dataTypes", this.dataTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("connectivityCriteria", this.connectivityCriteria, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("availability", this.availability); + jsonWriter.writeJsonField("permissions", this.permissions); + jsonWriter.writeArrayField("instructionSteps", this.instructionSteps, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("customImage", this.customImage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessUiConnectorConfigProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessUiConnectorConfigProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessUiConnectorConfigProperties. + */ + public static CodelessUiConnectorConfigProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessUiConnectorConfigProperties deserializedCodelessUiConnectorConfigProperties + = new CodelessUiConnectorConfigProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedCodelessUiConnectorConfigProperties.title = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedCodelessUiConnectorConfigProperties.publisher = reader.getString(); + } else if ("descriptionMarkdown".equals(fieldName)) { + deserializedCodelessUiConnectorConfigProperties.descriptionMarkdown = reader.getString(); + } else if ("graphQueriesTableName".equals(fieldName)) { + deserializedCodelessUiConnectorConfigProperties.graphQueriesTableName = reader.getString(); + } else if ("graphQueries".equals(fieldName)) { + List graphQueries = reader + .readArray(reader1 -> CodelessUiConnectorConfigPropertiesGraphQueriesItem.fromJson(reader1)); + deserializedCodelessUiConnectorConfigProperties.graphQueries = graphQueries; + } else if ("sampleQueries".equals(fieldName)) { + List sampleQueries = reader + .readArray(reader1 -> CodelessUiConnectorConfigPropertiesSampleQueriesItem.fromJson(reader1)); + deserializedCodelessUiConnectorConfigProperties.sampleQueries = sampleQueries; + } else if ("dataTypes".equals(fieldName)) { + List dataTypes = reader + .readArray(reader1 -> CodelessUiConnectorConfigPropertiesDataTypesItem.fromJson(reader1)); + deserializedCodelessUiConnectorConfigProperties.dataTypes = dataTypes; + } else if ("connectivityCriteria".equals(fieldName)) { + List connectivityCriteria + = reader.readArray( + reader1 -> CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.fromJson(reader1)); + deserializedCodelessUiConnectorConfigProperties.connectivityCriteria = connectivityCriteria; + } else if ("availability".equals(fieldName)) { + deserializedCodelessUiConnectorConfigProperties.availability = Availability.fromJson(reader); + } else if ("permissions".equals(fieldName)) { + deserializedCodelessUiConnectorConfigProperties.permissions = Permissions.fromJson(reader); + } else if ("instructionSteps".equals(fieldName)) { + List instructionSteps = reader.readArray( + reader1 -> CodelessUiConnectorConfigPropertiesInstructionStepsItem.fromJson(reader1)); + deserializedCodelessUiConnectorConfigProperties.instructionSteps = instructionSteps; + } else if ("customImage".equals(fieldName)) { + deserializedCodelessUiConnectorConfigProperties.customImage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessUiConnectorConfigProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.java new file mode 100644 index 000000000000..dc42ff96bae4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem model. + */ +@Fluent +public final class CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem extends ConnectivityCriteria { + /** + * Creates an instance of CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem class. + */ + public CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem withType(ConnectivityType type) { + super.withType(type); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem withValue(List value) { + super.withValue(value); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeArrayField("value", value(), (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem. + */ + public static CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem deserializedCodelessUiConnectorConfigPropertiesConnectivityCriteriaItem + = new CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesConnectivityCriteriaItem + .withType(ConnectivityType.fromString(reader.getString())); + } else if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> reader1.getString()); + deserializedCodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.withValue(value); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessUiConnectorConfigPropertiesConnectivityCriteriaItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesDataTypesItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesDataTypesItem.java new file mode 100644 index 000000000000..ce1265f70042 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesDataTypesItem.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CodelessUiConnectorConfigPropertiesDataTypesItem model. + */ +@Fluent +public final class CodelessUiConnectorConfigPropertiesDataTypesItem extends LastDataReceivedDataType { + /** + * Creates an instance of CodelessUiConnectorConfigPropertiesDataTypesItem class. + */ + public CodelessUiConnectorConfigPropertiesDataTypesItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesDataTypesItem withName(String name) { + super.withName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesDataTypesItem withLastDataReceivedQuery(String lastDataReceivedQuery) { + super.withLastDataReceivedQuery(lastDataReceivedQuery); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("lastDataReceivedQuery", lastDataReceivedQuery()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessUiConnectorConfigPropertiesDataTypesItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessUiConnectorConfigPropertiesDataTypesItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CodelessUiConnectorConfigPropertiesDataTypesItem. + */ + public static CodelessUiConnectorConfigPropertiesDataTypesItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessUiConnectorConfigPropertiesDataTypesItem deserializedCodelessUiConnectorConfigPropertiesDataTypesItem + = new CodelessUiConnectorConfigPropertiesDataTypesItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesDataTypesItem.withName(reader.getString()); + } else if ("lastDataReceivedQuery".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesDataTypesItem + .withLastDataReceivedQuery(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessUiConnectorConfigPropertiesDataTypesItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesGraphQueriesItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesGraphQueriesItem.java new file mode 100644 index 000000000000..7b9c204b7755 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesGraphQueriesItem.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CodelessUiConnectorConfigPropertiesGraphQueriesItem model. + */ +@Fluent +public final class CodelessUiConnectorConfigPropertiesGraphQueriesItem extends GraphQueries { + /** + * Creates an instance of CodelessUiConnectorConfigPropertiesGraphQueriesItem class. + */ + public CodelessUiConnectorConfigPropertiesGraphQueriesItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesGraphQueriesItem withMetricName(String metricName) { + super.withMetricName(metricName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesGraphQueriesItem withLegend(String legend) { + super.withLegend(legend); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesGraphQueriesItem withBaseQuery(String baseQuery) { + super.withBaseQuery(baseQuery); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("metricName", metricName()); + jsonWriter.writeStringField("legend", legend()); + jsonWriter.writeStringField("baseQuery", baseQuery()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessUiConnectorConfigPropertiesGraphQueriesItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessUiConnectorConfigPropertiesGraphQueriesItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CodelessUiConnectorConfigPropertiesGraphQueriesItem. + */ + public static CodelessUiConnectorConfigPropertiesGraphQueriesItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + CodelessUiConnectorConfigPropertiesGraphQueriesItem deserializedCodelessUiConnectorConfigPropertiesGraphQueriesItem + = new CodelessUiConnectorConfigPropertiesGraphQueriesItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metricName".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesGraphQueriesItem.withMetricName(reader.getString()); + } else if ("legend".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesGraphQueriesItem.withLegend(reader.getString()); + } else if ("baseQuery".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesGraphQueriesItem.withBaseQuery(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessUiConnectorConfigPropertiesGraphQueriesItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesInstructionStepsItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesInstructionStepsItem.java new file mode 100644 index 000000000000..61be2beb44bf --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesInstructionStepsItem.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The CodelessUiConnectorConfigPropertiesInstructionStepsItem model. + */ +@Fluent +public final class CodelessUiConnectorConfigPropertiesInstructionStepsItem extends InstructionSteps { + /** + * Creates an instance of CodelessUiConnectorConfigPropertiesInstructionStepsItem class. + */ + public CodelessUiConnectorConfigPropertiesInstructionStepsItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesInstructionStepsItem withTitle(String title) { + super.withTitle(title); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesInstructionStepsItem withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesInstructionStepsItem + withInstructions(List instructions) { + super.withInstructions(instructions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (instructions() != null) { + instructions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", title()); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeArrayField("instructions", instructions(), (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessUiConnectorConfigPropertiesInstructionStepsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessUiConnectorConfigPropertiesInstructionStepsItem if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CodelessUiConnectorConfigPropertiesInstructionStepsItem. + */ + public static CodelessUiConnectorConfigPropertiesInstructionStepsItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + CodelessUiConnectorConfigPropertiesInstructionStepsItem deserializedCodelessUiConnectorConfigPropertiesInstructionStepsItem + = new CodelessUiConnectorConfigPropertiesInstructionStepsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesInstructionStepsItem.withTitle(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesInstructionStepsItem + .withDescription(reader.getString()); + } else if ("instructions".equals(fieldName)) { + List instructions + = reader.readArray(reader1 -> InstructionStepsInstructionsItem.fromJson(reader1)); + deserializedCodelessUiConnectorConfigPropertiesInstructionStepsItem.withInstructions(instructions); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessUiConnectorConfigPropertiesInstructionStepsItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesSampleQueriesItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesSampleQueriesItem.java new file mode 100644 index 000000000000..76be1475e737 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiConnectorConfigPropertiesSampleQueriesItem.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CodelessUiConnectorConfigPropertiesSampleQueriesItem model. + */ +@Fluent +public final class CodelessUiConnectorConfigPropertiesSampleQueriesItem extends SampleQueries { + /** + * Creates an instance of CodelessUiConnectorConfigPropertiesSampleQueriesItem class. + */ + public CodelessUiConnectorConfigPropertiesSampleQueriesItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesSampleQueriesItem withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiConnectorConfigPropertiesSampleQueriesItem withQuery(String query) { + super.withQuery(query); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("query", query()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessUiConnectorConfigPropertiesSampleQueriesItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessUiConnectorConfigPropertiesSampleQueriesItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CodelessUiConnectorConfigPropertiesSampleQueriesItem. + */ + public static CodelessUiConnectorConfigPropertiesSampleQueriesItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + CodelessUiConnectorConfigPropertiesSampleQueriesItem deserializedCodelessUiConnectorConfigPropertiesSampleQueriesItem + = new CodelessUiConnectorConfigPropertiesSampleQueriesItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesSampleQueriesItem + .withDescription(reader.getString()); + } else if ("query".equals(fieldName)) { + deserializedCodelessUiConnectorConfigPropertiesSampleQueriesItem.withQuery(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessUiConnectorConfigPropertiesSampleQueriesItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiDataConnector.java new file mode 100644 index 000000000000..c35c32cc51c4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CodelessUiDataConnector.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.CodelessParameters; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import java.io.IOException; + +/** + * Represents Codeless UI data connector. + */ +@Fluent +public final class CodelessUiDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.GENERIC_UI; + + /* + * Codeless UI data connector properties + */ + private CodelessParameters innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CodelessUiDataConnector class. + */ + public CodelessUiDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Codeless UI data connector properties. + * + * @return the innerProperties value. + */ + private CodelessParameters innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CodelessUiDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the connectorUiConfig property: Config to describe the instructions blade. + * + * @return the connectorUiConfig value. + */ + public CodelessUiConnectorConfigProperties connectorUiConfig() { + return this.innerProperties() == null ? null : this.innerProperties().connectorUiConfig(); + } + + /** + * Set the connectorUiConfig property: Config to describe the instructions blade. + * + * @param connectorUiConfig the connectorUiConfig value to set. + * @return the CodelessUiDataConnector object itself. + */ + public CodelessUiDataConnector withConnectorUiConfig(CodelessUiConnectorConfigProperties connectorUiConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new CodelessParameters(); + } + this.innerProperties().withConnectorUiConfig(connectorUiConfig); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodelessUiDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodelessUiDataConnector if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CodelessUiDataConnector. + */ + public static CodelessUiDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodelessUiDataConnector deserializedCodelessUiDataConnector = new CodelessUiDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCodelessUiDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCodelessUiDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCodelessUiDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedCodelessUiDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedCodelessUiDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedCodelessUiDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedCodelessUiDataConnector.innerProperties = CodelessParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCodelessUiDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionClause.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionClause.java new file mode 100644 index 000000000000..176cef878895 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionClause.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a single clause to be evaluated by a NormalizedCondition. + */ +@Fluent +public final class ConditionClause implements JsonSerializable { + /* + * The connective used to join all values in this ConditionClause + */ + private Connective clauseConnective; + + /* + * The name of the field that is evaluated. + */ + private String field; + + /* + * Represents an operator in a ConditionClause. + */ + private Operator operator; + + /* + * The top level connective operator for this condition. + */ + private List values; + + /** + * Creates an instance of ConditionClause class. + */ + public ConditionClause() { + } + + /** + * Get the clauseConnective property: The connective used to join all values in this ConditionClause. + * + * @return the clauseConnective value. + */ + public Connective clauseConnective() { + return this.clauseConnective; + } + + /** + * Set the clauseConnective property: The connective used to join all values in this ConditionClause. + * + * @param clauseConnective the clauseConnective value to set. + * @return the ConditionClause object itself. + */ + public ConditionClause withClauseConnective(Connective clauseConnective) { + this.clauseConnective = clauseConnective; + return this; + } + + /** + * Get the field property: The name of the field that is evaluated. + * + * @return the field value. + */ + public String field() { + return this.field; + } + + /** + * Set the field property: The name of the field that is evaluated. + * + * @param field the field value to set. + * @return the ConditionClause object itself. + */ + public ConditionClause withField(String field) { + this.field = field; + return this; + } + + /** + * Get the operator property: Represents an operator in a ConditionClause. + * + * @return the operator value. + */ + public Operator operator() { + return this.operator; + } + + /** + * Set the operator property: Represents an operator in a ConditionClause. + * + * @param operator the operator value to set. + * @return the ConditionClause object itself. + */ + public ConditionClause withOperator(Operator operator) { + this.operator = operator; + return this; + } + + /** + * Get the values property: The top level connective operator for this condition. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The top level connective operator for this condition. + * + * @param values the values value to set. + * @return the ConditionClause object itself. + */ + public ConditionClause withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (field() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property field in model ConditionClause")); + } + if (operator() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property operator in model ConditionClause")); + } + if (values() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property values in model ConditionClause")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConditionClause.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("field", this.field); + jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString()); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("clauseConnective", + this.clauseConnective == null ? null : this.clauseConnective.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConditionClause from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConditionClause if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConditionClause. + */ + public static ConditionClause fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConditionClause deserializedConditionClause = new ConditionClause(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("field".equals(fieldName)) { + deserializedConditionClause.field = reader.getString(); + } else if ("operator".equals(fieldName)) { + deserializedConditionClause.operator = Operator.fromString(reader.getString()); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> reader1.getString()); + deserializedConditionClause.values = values; + } else if ("clauseConnective".equals(fieldName)) { + deserializedConditionClause.clauseConnective = Connective.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedConditionClause; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionProperties.java new file mode 100644 index 000000000000..56da6ff20875 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a condition used to query for TI objects. + */ +@Fluent +public final class ConditionProperties implements JsonSerializable { + /* + * The STIX type for the objects returned by this query. + */ + private String stixObjectType; + + /* + * The list of clauses to be evaluated in disjunction or conjunction base on the specified top level connective + * operator. + */ + private List clauses; + + /* + * The top level connective operator for this condition. + */ + private Connective conditionConnective; + + /** + * Creates an instance of ConditionProperties class. + */ + public ConditionProperties() { + } + + /** + * Get the stixObjectType property: The STIX type for the objects returned by this query. + * + * @return the stixObjectType value. + */ + public String stixObjectType() { + return this.stixObjectType; + } + + /** + * Get the clauses property: The list of clauses to be evaluated in disjunction or conjunction base on the specified + * top level connective operator. + * + * @return the clauses value. + */ + public List clauses() { + return this.clauses; + } + + /** + * Set the clauses property: The list of clauses to be evaluated in disjunction or conjunction base on the specified + * top level connective operator. + * + * @param clauses the clauses value to set. + * @return the ConditionProperties object itself. + */ + public ConditionProperties withClauses(List clauses) { + this.clauses = clauses; + return this; + } + + /** + * Get the conditionConnective property: The top level connective operator for this condition. + * + * @return the conditionConnective value. + */ + public Connective conditionConnective() { + return this.conditionConnective; + } + + /** + * Set the conditionConnective property: The top level connective operator for this condition. + * + * @param conditionConnective the conditionConnective value to set. + * @return the ConditionProperties object itself. + */ + public ConditionProperties withConditionConnective(Connective conditionConnective) { + this.conditionConnective = conditionConnective; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (clauses() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property clauses in model ConditionProperties")); + } else { + clauses().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConditionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("clauses", this.clauses, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("conditionConnective", + this.conditionConnective == null ? null : this.conditionConnective.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConditionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConditionProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConditionProperties. + */ + public static ConditionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConditionProperties deserializedConditionProperties = new ConditionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clauses".equals(fieldName)) { + List clauses = reader.readArray(reader1 -> ConditionClause.fromJson(reader1)); + deserializedConditionProperties.clauses = clauses; + } else if ("stixObjectType".equals(fieldName)) { + deserializedConditionProperties.stixObjectType = reader.getString(); + } else if ("conditionConnective".equals(fieldName)) { + deserializedConditionProperties.conditionConnective = Connective.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedConditionProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionType.java index 0a3e8189a76f..05b01ac636f3 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionType.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConditionType.java @@ -16,6 +16,11 @@ public final class ConditionType extends ExpandableStringEnum { */ public static final ConditionType PROPERTY = fromString("Property"); + /** + * Static value PropertyArray for ConditionType. + */ + public static final ConditionType PROPERTY_ARRAY = fromString("PropertyArray"); + /** * Static value PropertyChanged for ConditionType. */ @@ -26,6 +31,11 @@ public final class ConditionType extends ExpandableStringEnum { */ public static final ConditionType PROPERTY_ARRAY_CHANGED = fromString("PropertyArrayChanged"); + /** + * Static value Boolean for ConditionType. + */ + public static final ConditionType BOOLEAN = fromString("Boolean"); + /** * Creates a new instance of ConditionType value. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConfigurationType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConfigurationType.java new file mode 100644 index 000000000000..da2897904838 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConfigurationType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents the types of configuration for a system. + */ +public final class ConfigurationType extends ExpandableStringEnum { + /** + * Static value SAP for ConfigurationType. + */ + public static final ConfigurationType SAP = fromString("SAP"); + + /** + * Creates a new instance of ConfigurationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConfigurationType() { + } + + /** + * Creates or finds a ConfigurationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigurationType. + */ + public static ConfigurationType fromString(String name) { + return fromString(name, ConfigurationType.class); + } + + /** + * Gets known ConfigurationType values. + * + * @return known ConfigurationType values. + */ + public static Collection values() { + return values(ConfigurationType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectAuthKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectAuthKind.java new file mode 100644 index 000000000000..7274d015790f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectAuthKind.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The authentication kind used to poll the data. + */ +public final class ConnectAuthKind extends ExpandableStringEnum { + /** + * Static value Basic for ConnectAuthKind. + */ + public static final ConnectAuthKind BASIC = fromString("Basic"); + + /** + * Static value OAuth2 for ConnectAuthKind. + */ + public static final ConnectAuthKind OAUTH2 = fromString("OAuth2"); + + /** + * Static value APIKey for ConnectAuthKind. + */ + public static final ConnectAuthKind APIKEY = fromString("APIKey"); + + /** + * Creates a new instance of ConnectAuthKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConnectAuthKind() { + } + + /** + * Creates or finds a ConnectAuthKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectAuthKind. + */ + public static ConnectAuthKind fromString(String name) { + return fromString(name, ConnectAuthKind.class); + } + + /** + * Gets known ConnectAuthKind values. + * + * @return known ConnectAuthKind values. + */ + public static Collection values() { + return values(ConnectAuthKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectedEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectedEntity.java new file mode 100644 index 000000000000..596a458b629b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectedEntity.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Expansion result connected entities. + */ +@Fluent +public final class ConnectedEntity implements JsonSerializable { + /* + * Entity Id of the connected entity + */ + private String targetEntityId; + + /* + * key-value pairs for a connected entity mapping + */ + private Object additionalData; + + /** + * Creates an instance of ConnectedEntity class. + */ + public ConnectedEntity() { + } + + /** + * Get the targetEntityId property: Entity Id of the connected entity. + * + * @return the targetEntityId value. + */ + public String targetEntityId() { + return this.targetEntityId; + } + + /** + * Set the targetEntityId property: Entity Id of the connected entity. + * + * @param targetEntityId the targetEntityId value to set. + * @return the ConnectedEntity object itself. + */ + public ConnectedEntity withTargetEntityId(String targetEntityId) { + this.targetEntityId = targetEntityId; + return this; + } + + /** + * Get the additionalData property: key-value pairs for a connected entity mapping. + * + * @return the additionalData value. + */ + public Object additionalData() { + return this.additionalData; + } + + /** + * Set the additionalData property: key-value pairs for a connected entity mapping. + * + * @param additionalData the additionalData value to set. + * @return the ConnectedEntity object itself. + */ + public ConnectedEntity withAdditionalData(Object additionalData) { + this.additionalData = additionalData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetEntityId", this.targetEntityId); + jsonWriter.writeUntypedField("additionalData", this.additionalData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectedEntity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectedEntity if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectedEntity. + */ + public static ConnectedEntity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectedEntity deserializedConnectedEntity = new ConnectedEntity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetEntityId".equals(fieldName)) { + deserializedConnectedEntity.targetEntityId = reader.getString(); + } else if ("additionalData".equals(fieldName)) { + deserializedConnectedEntity.additionalData = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectedEntity; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Connective.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Connective.java new file mode 100644 index 000000000000..b3ec54c0fd23 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Connective.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents boolean connectives used to join clauses in conditions. + */ +public final class Connective extends ExpandableStringEnum { + /** + * Static value And for Connective. + */ + public static final Connective AND = fromString("And"); + + /** + * Static value Or for Connective. + */ + public static final Connective OR = fromString("Or"); + + /** + * Creates a new instance of Connective value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Connective() { + } + + /** + * Creates or finds a Connective from its string representation. + * + * @param name a name to look for. + * @return the corresponding Connective. + */ + public static Connective fromString(String name) { + return fromString(name, Connective.class); + } + + /** + * Gets known Connective values. + * + * @return known Connective values. + */ + public static Collection values() { + return values(Connective.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityCriteria.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityCriteria.java new file mode 100644 index 000000000000..d2cc6ff92cef --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityCriteria.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Setting for the connector check connectivity. + */ +@Fluent +public class ConnectivityCriteria implements JsonSerializable { + /* + * type of connectivity + */ + private ConnectivityType type; + + /* + * Queries for checking connectivity + */ + private List value; + + /** + * Creates an instance of ConnectivityCriteria class. + */ + public ConnectivityCriteria() { + } + + /** + * Get the type property: type of connectivity. + * + * @return the type value. + */ + public ConnectivityType type() { + return this.type; + } + + /** + * Set the type property: type of connectivity. + * + * @param type the type value to set. + * @return the ConnectivityCriteria object itself. + */ + public ConnectivityCriteria withType(ConnectivityType type) { + this.type = type; + return this; + } + + /** + * Get the value property: Queries for checking connectivity. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Queries for checking connectivity. + * + * @param value the value value to set. + * @return the ConnectivityCriteria object itself. + */ + public ConnectivityCriteria withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectivityCriteria from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectivityCriteria if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectivityCriteria. + */ + public static ConnectivityCriteria fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectivityCriteria deserializedConnectivityCriteria = new ConnectivityCriteria(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedConnectivityCriteria.type = ConnectivityType.fromString(reader.getString()); + } else if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> reader1.getString()); + deserializedConnectivityCriteria.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedConnectivityCriteria; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityCriterion.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityCriterion.java new file mode 100644 index 000000000000..5c51f76c5aec --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityCriterion.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The criteria by which we determine whether the connector is connected or not. + * For Example, use a KQL query to check if the expected data type is flowing). + */ +@Fluent +public final class ConnectivityCriterion implements JsonSerializable { + /* + * Gets or sets the type of connectivity. + */ + private String type; + + /* + * Gets or sets the queries for checking connectivity. + */ + private List value; + + /** + * Creates an instance of ConnectivityCriterion class. + */ + public ConnectivityCriterion() { + } + + /** + * Get the type property: Gets or sets the type of connectivity. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the type of connectivity. + * + * @param type the type value to set. + * @return the ConnectivityCriterion object itself. + */ + public ConnectivityCriterion withType(String type) { + this.type = type; + return this; + } + + /** + * Get the value property: Gets or sets the queries for checking connectivity. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the queries for checking connectivity. + * + * @param value the value value to set. + * @return the ConnectivityCriterion object itself. + */ + public ConnectivityCriterion withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ConnectivityCriterion")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectivityCriterion.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectivityCriterion from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectivityCriterion if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectivityCriterion. + */ + public static ConnectivityCriterion fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectivityCriterion deserializedConnectivityCriterion = new ConnectivityCriterion(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedConnectivityCriterion.type = reader.getString(); + } else if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> reader1.getString()); + deserializedConnectivityCriterion.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedConnectivityCriterion; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityType.java new file mode 100644 index 000000000000..300851fddfb3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectivityType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * type of connectivity. + */ +public final class ConnectivityType extends ExpandableStringEnum { + /** + * Static value IsConnectedQuery for ConnectivityType. + */ + public static final ConnectivityType IS_CONNECTED_QUERY = fromString("IsConnectedQuery"); + + /** + * Creates a new instance of ConnectivityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConnectivityType() { + } + + /** + * Creates or finds a ConnectivityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectivityType. + */ + public static ConnectivityType fromString(String name) { + return fromString(name, ConnectivityType.class); + } + + /** + * Gets known ConnectivityType values. + * + * @return known ConnectivityType values. + */ + public static Collection values() { + return values(ConnectivityType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDataType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDataType.java new file mode 100644 index 000000000000..667d410a634e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDataType.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The data type which is created by the connector, + * including a query indicated when was the last time that data type was received in the workspace. + */ +@Fluent +public final class ConnectorDataType implements JsonSerializable { + /* + * Gets or sets the name of the data type to show in the graph. + */ + private String name; + + /* + * Gets or sets the query to indicate when relevant data was last received in the workspace. + */ + private String lastDataReceivedQuery; + + /** + * Creates an instance of ConnectorDataType class. + */ + public ConnectorDataType() { + } + + /** + * Get the name property: Gets or sets the name of the data type to show in the graph. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the data type to show in the graph. + * + * @param name the name value to set. + * @return the ConnectorDataType object itself. + */ + public ConnectorDataType withName(String name) { + this.name = name; + return this; + } + + /** + * Get the lastDataReceivedQuery property: Gets or sets the query to indicate when relevant data was last received + * in the workspace. + * + * @return the lastDataReceivedQuery value. + */ + public String lastDataReceivedQuery() { + return this.lastDataReceivedQuery; + } + + /** + * Set the lastDataReceivedQuery property: Gets or sets the query to indicate when relevant data was last received + * in the workspace. + * + * @param lastDataReceivedQuery the lastDataReceivedQuery value to set. + * @return the ConnectorDataType object itself. + */ + public ConnectorDataType withLastDataReceivedQuery(String lastDataReceivedQuery) { + this.lastDataReceivedQuery = lastDataReceivedQuery; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model ConnectorDataType")); + } + if (lastDataReceivedQuery() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property lastDataReceivedQuery in model ConnectorDataType")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectorDataType.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("lastDataReceivedQuery", this.lastDataReceivedQuery); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorDataType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorDataType if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectorDataType. + */ + public static ConnectorDataType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorDataType deserializedConnectorDataType = new ConnectorDataType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedConnectorDataType.name = reader.getString(); + } else if ("lastDataReceivedQuery".equals(fieldName)) { + deserializedConnectorDataType.lastDataReceivedQuery = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorDataType; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsAvailability.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsAvailability.java new file mode 100644 index 000000000000..bed0663160aa --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsAvailability.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The exposure status of the connector to the customers. + */ +@Fluent +public final class ConnectorDefinitionsAvailability implements JsonSerializable { + /* + * The exposure status of the connector to the customers. Available values are 0-4 (0=None, 1=Available, + * 2=FeatureFlag, 3=Internal). + */ + private Integer status; + + /* + * Gets or sets a value indicating whether the connector is preview. + */ + private Boolean isPreview; + + /** + * Creates an instance of ConnectorDefinitionsAvailability class. + */ + public ConnectorDefinitionsAvailability() { + } + + /** + * Get the status property: The exposure status of the connector to the customers. Available values are 0-4 (0=None, + * 1=Available, 2=FeatureFlag, 3=Internal). + * + * @return the status value. + */ + public Integer status() { + return this.status; + } + + /** + * Set the status property: The exposure status of the connector to the customers. Available values are 0-4 (0=None, + * 1=Available, 2=FeatureFlag, 3=Internal). + * + * @param status the status value to set. + * @return the ConnectorDefinitionsAvailability object itself. + */ + public ConnectorDefinitionsAvailability withStatus(Integer status) { + this.status = status; + return this; + } + + /** + * Get the isPreview property: Gets or sets a value indicating whether the connector is preview. + * + * @return the isPreview value. + */ + public Boolean isPreview() { + return this.isPreview; + } + + /** + * Set the isPreview property: Gets or sets a value indicating whether the connector is preview. + * + * @param isPreview the isPreview value to set. + * @return the ConnectorDefinitionsAvailability object itself. + */ + public ConnectorDefinitionsAvailability withIsPreview(Boolean isPreview) { + this.isPreview = isPreview; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("status", this.status); + jsonWriter.writeBooleanField("isPreview", this.isPreview); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorDefinitionsAvailability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorDefinitionsAvailability if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectorDefinitionsAvailability. + */ + public static ConnectorDefinitionsAvailability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorDefinitionsAvailability deserializedConnectorDefinitionsAvailability + = new ConnectorDefinitionsAvailability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedConnectorDefinitionsAvailability.status = reader.getNullable(JsonReader::getInt); + } else if ("isPreview".equals(fieldName)) { + deserializedConnectorDefinitionsAvailability.isPreview = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorDefinitionsAvailability; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsPermissions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsPermissions.java new file mode 100644 index 000000000000..2cafd869b035 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsPermissions.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The required Permissions for the connector. + */ +@Fluent +public final class ConnectorDefinitionsPermissions implements JsonSerializable { + /* + * Gets or sets the required tenant permissions for the connector. + */ + private List tenant; + + /* + * Gets or sets the required licenses for the user to create connections. + */ + private List licenses; + + /* + * Gets or sets the resource provider permissions required for the user to create connections. + */ + private List resourceProvider; + + /* + * Gets or sets the customs permissions required for the user to create connections. + */ + private List customs; + + /** + * Creates an instance of ConnectorDefinitionsPermissions class. + */ + public ConnectorDefinitionsPermissions() { + } + + /** + * Get the tenant property: Gets or sets the required tenant permissions for the connector. + * + * @return the tenant value. + */ + public List tenant() { + return this.tenant; + } + + /** + * Set the tenant property: Gets or sets the required tenant permissions for the connector. + * + * @param tenant the tenant value to set. + * @return the ConnectorDefinitionsPermissions object itself. + */ + public ConnectorDefinitionsPermissions withTenant(List tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the licenses property: Gets or sets the required licenses for the user to create connections. + * + * @return the licenses value. + */ + public List licenses() { + return this.licenses; + } + + /** + * Set the licenses property: Gets or sets the required licenses for the user to create connections. + * + * @param licenses the licenses value to set. + * @return the ConnectorDefinitionsPermissions object itself. + */ + public ConnectorDefinitionsPermissions withLicenses(List licenses) { + this.licenses = licenses; + return this; + } + + /** + * Get the resourceProvider property: Gets or sets the resource provider permissions required for the user to create + * connections. + * + * @return the resourceProvider value. + */ + public List resourceProvider() { + return this.resourceProvider; + } + + /** + * Set the resourceProvider property: Gets or sets the resource provider permissions required for the user to create + * connections. + * + * @param resourceProvider the resourceProvider value to set. + * @return the ConnectorDefinitionsPermissions object itself. + */ + public ConnectorDefinitionsPermissions + withResourceProvider(List resourceProvider) { + this.resourceProvider = resourceProvider; + return this; + } + + /** + * Get the customs property: Gets or sets the customs permissions required for the user to create connections. + * + * @return the customs value. + */ + public List customs() { + return this.customs; + } + + /** + * Set the customs property: Gets or sets the customs permissions required for the user to create connections. + * + * @param customs the customs value to set. + * @return the ConnectorDefinitionsPermissions object itself. + */ + public ConnectorDefinitionsPermissions withCustoms(List customs) { + this.customs = customs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceProvider() != null) { + resourceProvider().forEach(e -> e.validate()); + } + if (customs() != null) { + customs().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tenant", this.tenant, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("licenses", this.licenses, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("resourceProvider", this.resourceProvider, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("customs", this.customs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorDefinitionsPermissions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorDefinitionsPermissions if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectorDefinitionsPermissions. + */ + public static ConnectorDefinitionsPermissions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorDefinitionsPermissions deserializedConnectorDefinitionsPermissions + = new ConnectorDefinitionsPermissions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenant".equals(fieldName)) { + List tenant = reader.readArray(reader1 -> reader1.getString()); + deserializedConnectorDefinitionsPermissions.tenant = tenant; + } else if ("licenses".equals(fieldName)) { + List licenses = reader.readArray(reader1 -> reader1.getString()); + deserializedConnectorDefinitionsPermissions.licenses = licenses; + } else if ("resourceProvider".equals(fieldName)) { + List resourceProvider + = reader.readArray(reader1 -> ConnectorDefinitionsResourceProvider.fromJson(reader1)); + deserializedConnectorDefinitionsPermissions.resourceProvider = resourceProvider; + } else if ("customs".equals(fieldName)) { + List customs + = reader.readArray(reader1 -> CustomPermissionDetails.fromJson(reader1)); + deserializedConnectorDefinitionsPermissions.customs = customs; + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorDefinitionsPermissions; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsResourceProvider.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsResourceProvider.java new file mode 100644 index 000000000000..8ccdc1b657ce --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorDefinitionsResourceProvider.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource provider details include the required permissions for the user to create connections. + * The user should have the required permissions(Read\Write, ..) in the specified scope ProviderPermissionsScope against + * the specified resource provider. + */ +@Fluent +public final class ConnectorDefinitionsResourceProvider + implements JsonSerializable { + /* + * Gets or sets the provider name. + */ + private String provider; + + /* + * Gets or sets the permissions description text. + */ + private String permissionsDisplayText; + + /* + * Gets or sets the permissions provider display name. + */ + private String providerDisplayName; + + /* + * The scope on which the user should have permissions, in order to be able to create connections. + */ + private ProviderPermissionsScope scope; + + /* + * Required permissions for the connector resource provider that define in ResourceProviders. + * For more information about the permissions see here. + */ + private ResourceProviderRequiredPermissions requiredPermissions; + + /** + * Creates an instance of ConnectorDefinitionsResourceProvider class. + */ + public ConnectorDefinitionsResourceProvider() { + } + + /** + * Get the provider property: Gets or sets the provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Gets or sets the provider name. + * + * @param provider the provider value to set. + * @return the ConnectorDefinitionsResourceProvider object itself. + */ + public ConnectorDefinitionsResourceProvider withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the permissionsDisplayText property: Gets or sets the permissions description text. + * + * @return the permissionsDisplayText value. + */ + public String permissionsDisplayText() { + return this.permissionsDisplayText; + } + + /** + * Set the permissionsDisplayText property: Gets or sets the permissions description text. + * + * @param permissionsDisplayText the permissionsDisplayText value to set. + * @return the ConnectorDefinitionsResourceProvider object itself. + */ + public ConnectorDefinitionsResourceProvider withPermissionsDisplayText(String permissionsDisplayText) { + this.permissionsDisplayText = permissionsDisplayText; + return this; + } + + /** + * Get the providerDisplayName property: Gets or sets the permissions provider display name. + * + * @return the providerDisplayName value. + */ + public String providerDisplayName() { + return this.providerDisplayName; + } + + /** + * Set the providerDisplayName property: Gets or sets the permissions provider display name. + * + * @param providerDisplayName the providerDisplayName value to set. + * @return the ConnectorDefinitionsResourceProvider object itself. + */ + public ConnectorDefinitionsResourceProvider withProviderDisplayName(String providerDisplayName) { + this.providerDisplayName = providerDisplayName; + return this; + } + + /** + * Get the scope property: The scope on which the user should have permissions, in order to be able to create + * connections. + * + * @return the scope value. + */ + public ProviderPermissionsScope scope() { + return this.scope; + } + + /** + * Set the scope property: The scope on which the user should have permissions, in order to be able to create + * connections. + * + * @param scope the scope value to set. + * @return the ConnectorDefinitionsResourceProvider object itself. + */ + public ConnectorDefinitionsResourceProvider withScope(ProviderPermissionsScope scope) { + this.scope = scope; + return this; + } + + /** + * Get the requiredPermissions property: Required permissions for the connector resource provider that define in + * ResourceProviders. + * For more information about the permissions see <see + * href="https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#actions-format">here</see>. + * + * @return the requiredPermissions value. + */ + public ResourceProviderRequiredPermissions requiredPermissions() { + return this.requiredPermissions; + } + + /** + * Set the requiredPermissions property: Required permissions for the connector resource provider that define in + * ResourceProviders. + * For more information about the permissions see <see + * href="https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#actions-format">here</see>. + * + * @param requiredPermissions the requiredPermissions value to set. + * @return the ConnectorDefinitionsResourceProvider object itself. + */ + public ConnectorDefinitionsResourceProvider + withRequiredPermissions(ResourceProviderRequiredPermissions requiredPermissions) { + this.requiredPermissions = requiredPermissions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provider() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property provider in model ConnectorDefinitionsResourceProvider")); + } + if (permissionsDisplayText() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property permissionsDisplayText in model ConnectorDefinitionsResourceProvider")); + } + if (providerDisplayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property providerDisplayName in model ConnectorDefinitionsResourceProvider")); + } + if (scope() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property scope in model ConnectorDefinitionsResourceProvider")); + } + if (requiredPermissions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property requiredPermissions in model ConnectorDefinitionsResourceProvider")); + } else { + requiredPermissions().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectorDefinitionsResourceProvider.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", this.provider); + jsonWriter.writeStringField("permissionsDisplayText", this.permissionsDisplayText); + jsonWriter.writeStringField("providerDisplayName", this.providerDisplayName); + jsonWriter.writeStringField("scope", this.scope == null ? null : this.scope.toString()); + jsonWriter.writeJsonField("requiredPermissions", this.requiredPermissions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorDefinitionsResourceProvider from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorDefinitionsResourceProvider if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectorDefinitionsResourceProvider. + */ + public static ConnectorDefinitionsResourceProvider fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorDefinitionsResourceProvider deserializedConnectorDefinitionsResourceProvider + = new ConnectorDefinitionsResourceProvider(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedConnectorDefinitionsResourceProvider.provider = reader.getString(); + } else if ("permissionsDisplayText".equals(fieldName)) { + deserializedConnectorDefinitionsResourceProvider.permissionsDisplayText = reader.getString(); + } else if ("providerDisplayName".equals(fieldName)) { + deserializedConnectorDefinitionsResourceProvider.providerDisplayName = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedConnectorDefinitionsResourceProvider.scope + = ProviderPermissionsScope.fromString(reader.getString()); + } else if ("requiredPermissions".equals(fieldName)) { + deserializedConnectorDefinitionsResourceProvider.requiredPermissions + = ResourceProviderRequiredPermissions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorDefinitionsResourceProvider; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorInstructionModelBase.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorInstructionModelBase.java new file mode 100644 index 000000000000..ff7a4fef93de --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ConnectorInstructionModelBase.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Instruction step details. + */ +@Fluent +public class ConnectorInstructionModelBase implements JsonSerializable { + /* + * The parameters for the setting + */ + private Object parameters; + + /* + * The kind of the setting + */ + private SettingType type; + + /** + * Creates an instance of ConnectorInstructionModelBase class. + */ + public ConnectorInstructionModelBase() { + } + + /** + * Get the parameters property: The parameters for the setting. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters for the setting. + * + * @param parameters the parameters value to set. + * @return the ConnectorInstructionModelBase object itself. + */ + public ConnectorInstructionModelBase withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the type property: The kind of the setting. + * + * @return the type value. + */ + public SettingType type() { + return this.type; + } + + /** + * Set the type property: The kind of the setting. + * + * @param type the type value to set. + * @return the ConnectorInstructionModelBase object itself. + */ + public ConnectorInstructionModelBase withType(SettingType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model ConnectorInstructionModelBase")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectorInstructionModelBase.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeUntypedField("parameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorInstructionModelBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorInstructionModelBase if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectorInstructionModelBase. + */ + public static ConnectorInstructionModelBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorInstructionModelBase deserializedConnectorInstructionModelBase + = new ConnectorInstructionModelBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedConnectorInstructionModelBase.type = SettingType.fromString(reader.getString()); + } else if ("parameters".equals(fieldName)) { + deserializedConnectorInstructionModelBase.parameters = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorInstructionModelBase; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentPackageOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentPackageOperations.java new file mode 100644 index 000000000000..1582d6f1670a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentPackageOperations.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ContentPackageOperations. + */ +public interface ContentPackageOperations { + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response uninstallWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context); + + /** + * Uninstall a package from the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void uninstall(String resourceGroupName, String workspaceName, String packageId); + + /** + * Begins definition for a new PackageModel resource. + * + * @param name resource name. + * @return the first stage of the new PackageModel definition. + */ + PackageModel.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentPackages.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentPackages.java new file mode 100644 index 000000000000..a2e96c6e88e1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentPackages.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ContentPackages. + */ +public interface ContentPackages { + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all installed packages. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed packages as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + String search, Boolean count, Integer top, Integer skip, String skipToken, Context context); + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context); + + /** + * Gets an installed packages by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an installed packages by its id. + */ + PackageModel get(String resourceGroupName, String workspaceName, String packageId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentTemplateOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentTemplateOperations.java new file mode 100644 index 000000000000..65c17f7ef3c7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentTemplateOperations.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ContentTemplateOperations. + */ +public interface ContentTemplateOperations { + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context); + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + */ + TemplateModel get(String resourceGroupName, String workspaceName, String templateId); + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context); + + /** + * Delete an installed template. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String templateId); + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link Response}. + */ + TemplateModel getById(String id); + + /** + * Gets a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template byt its identifier. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an installed template. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an installed template. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TemplateModel resource. + * + * @param name resource name. + * @return the first stage of the new TemplateModel definition. + */ + TemplateModel.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentTemplates.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentTemplates.java new file mode 100644 index 000000000000..6affdc0d1d81 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentTemplates.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of ContentTemplates. + */ +public interface ContentTemplates { + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param expand Expands the object with optional fiends that are not included by default. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all installed templates. + * Expandable properties: + * - properties/mainTemplate + * - properties/dependantTemplates as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + String expand, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentType.java new file mode 100644 index 000000000000..88c06160d62f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ContentType.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The content type of a source control path. + */ +public final class ContentType extends ExpandableStringEnum { + /** + * Static value AnalyticsRule for ContentType. + */ + public static final ContentType ANALYTICS_RULE = fromString("AnalyticsRule"); + + /** + * Static value AutomationRule for ContentType. + */ + public static final ContentType AUTOMATION_RULE = fromString("AutomationRule"); + + /** + * Static value HuntingQuery for ContentType. + */ + public static final ContentType HUNTING_QUERY = fromString("HuntingQuery"); + + /** + * Static value Parser for ContentType. + */ + public static final ContentType PARSER = fromString("Parser"); + + /** + * Static value Playbook for ContentType. + */ + public static final ContentType PLAYBOOK = fromString("Playbook"); + + /** + * Static value Workbook for ContentType. + */ + public static final ContentType WORKBOOK = fromString("Workbook"); + + /** + * Creates a new instance of ContentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ContentType() { + } + + /** + * Creates or finds a ContentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContentType. + */ + public static ContentType fromString(String name) { + return fromString(name, ContentType.class); + } + + /** + * Gets known ContentType values. + * + * @return known ContentType values. + */ + public static Collection values() { + return values(ContentType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CountQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CountQuery.java new file mode 100644 index 000000000000..54c886809f66 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CountQuery.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.QueryProperties; +import java.io.IOException; + +/** + * Represents a query to run on the TI objects in the workspace. + */ +@Fluent +public final class CountQuery implements JsonSerializable { + /* + * Query properties + */ + private QueryProperties innerProperties; + + /** + * Creates an instance of CountQuery class. + */ + public CountQuery() { + } + + /** + * Get the innerProperties property: Query properties. + * + * @return the innerProperties value. + */ + private QueryProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the condition property: Represents a condition used to query for TI objects. + * + * @return the condition value. + */ + public ConditionProperties condition() { + return this.innerProperties() == null ? null : this.innerProperties().condition(); + } + + /** + * Set the condition property: Represents a condition used to query for TI objects. + * + * @param condition the condition value to set. + * @return the CountQuery object itself. + */ + public CountQuery withCondition(ConditionProperties condition) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryProperties(); + } + this.innerProperties().withCondition(condition); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CountQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CountQuery if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the CountQuery. + */ + public static CountQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CountQuery deserializedCountQuery = new CountQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedCountQuery.innerProperties = QueryProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCountQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomEntityQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomEntityQuery.java new file mode 100644 index 000000000000..df505aee5ee2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomEntityQuery.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specific entity query that supports put requests. + */ +@Fluent +public class CustomEntityQuery extends ResourceWithEtag { + /* + * the entity query kind + */ + private CustomEntityQueryKind kind = CustomEntityQueryKind.fromString("CustomEntityQuery"); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CustomEntityQuery class. + */ + public CustomEntityQuery() { + } + + /** + * Get the kind property: the entity query kind. + * + * @return the kind value. + */ + public CustomEntityQueryKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CustomEntityQuery withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityQuery if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomEntityQuery. + */ + public static CustomEntityQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Activity".equals(discriminatorValue)) { + return ActivityCustomEntityQuery.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static CustomEntityQuery fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityQuery deserializedCustomEntityQuery = new CustomEntityQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomEntityQuery.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomEntityQuery.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomEntityQuery.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedCustomEntityQuery.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedCustomEntityQuery.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedCustomEntityQuery.kind = CustomEntityQueryKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomEntityQueryKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomEntityQueryKind.java new file mode 100644 index 000000000000..33f7979cb73e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomEntityQueryKind.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the entity query that supports put request. + */ +public final class CustomEntityQueryKind extends ExpandableStringEnum { + /** + * Static value Activity for CustomEntityQueryKind. + */ + public static final CustomEntityQueryKind ACTIVITY = fromString("Activity"); + + /** + * Creates a new instance of CustomEntityQueryKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CustomEntityQueryKind() { + } + + /** + * Creates or finds a CustomEntityQueryKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding CustomEntityQueryKind. + */ + public static CustomEntityQueryKind fromString(String name) { + return fromString(name, CustomEntityQueryKind.class); + } + + /** + * Gets known CustomEntityQueryKind values. + * + * @return known CustomEntityQueryKind values. + */ + public static Collection values() { + return values(CustomEntityQueryKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomPermissionDetails.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomPermissionDetails.java new file mode 100644 index 000000000000..75f28e694958 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomPermissionDetails.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Custom permissions required for the connector. + */ +@Fluent +public final class CustomPermissionDetails implements JsonSerializable { + /* + * Gets or sets the custom permissions name. + */ + private String name; + + /* + * Gets or sets the custom permissions description. + */ + private String description; + + /** + * Creates an instance of CustomPermissionDetails class. + */ + public CustomPermissionDetails() { + } + + /** + * Get the name property: Gets or sets the custom permissions name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the custom permissions name. + * + * @param name the name value to set. + * @return the CustomPermissionDetails object itself. + */ + public CustomPermissionDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: Gets or sets the custom permissions description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Gets or sets the custom permissions description. + * + * @param description the description value to set. + * @return the CustomPermissionDetails object itself. + */ + public CustomPermissionDetails withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model CustomPermissionDetails")); + } + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model CustomPermissionDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CustomPermissionDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomPermissionDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomPermissionDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomPermissionDetails. + */ + public static CustomPermissionDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomPermissionDetails deserializedCustomPermissionDetails = new CustomPermissionDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCustomPermissionDetails.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomPermissionDetails.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomPermissionDetails; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectionsConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectionsConfig.java new file mode 100644 index 000000000000..c7e7ae0d1a00 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectionsConfig.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The UiConfig for 'Customizable' connector definition kind. + */ +@Fluent +public final class CustomizableConnectionsConfig implements JsonSerializable { + /* + * Gets or sets the template name. The template includes ARM templates that can be created by the connector, usually + * it will be the dataConnectors ARM templates. + */ + private String templateSpecName; + + /* + * Gets or sets the template version. + */ + private String templateSpecVersion; + + /** + * Creates an instance of CustomizableConnectionsConfig class. + */ + public CustomizableConnectionsConfig() { + } + + /** + * Get the templateSpecName property: Gets or sets the template name. The template includes ARM templates that can + * be created by the connector, usually it will be the dataConnectors ARM templates. + * + * @return the templateSpecName value. + */ + public String templateSpecName() { + return this.templateSpecName; + } + + /** + * Set the templateSpecName property: Gets or sets the template name. The template includes ARM templates that can + * be created by the connector, usually it will be the dataConnectors ARM templates. + * + * @param templateSpecName the templateSpecName value to set. + * @return the CustomizableConnectionsConfig object itself. + */ + public CustomizableConnectionsConfig withTemplateSpecName(String templateSpecName) { + this.templateSpecName = templateSpecName; + return this; + } + + /** + * Get the templateSpecVersion property: Gets or sets the template version. + * + * @return the templateSpecVersion value. + */ + public String templateSpecVersion() { + return this.templateSpecVersion; + } + + /** + * Set the templateSpecVersion property: Gets or sets the template version. + * + * @param templateSpecVersion the templateSpecVersion value to set. + * @return the CustomizableConnectionsConfig object itself. + */ + public CustomizableConnectionsConfig withTemplateSpecVersion(String templateSpecVersion) { + this.templateSpecVersion = templateSpecVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (templateSpecName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property templateSpecName in model CustomizableConnectionsConfig")); + } + if (templateSpecVersion() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property templateSpecVersion in model CustomizableConnectionsConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CustomizableConnectionsConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("templateSpecName", this.templateSpecName); + jsonWriter.writeStringField("templateSpecVersion", this.templateSpecVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomizableConnectionsConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomizableConnectionsConfig if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomizableConnectionsConfig. + */ + public static CustomizableConnectionsConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomizableConnectionsConfig deserializedCustomizableConnectionsConfig + = new CustomizableConnectionsConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("templateSpecName".equals(fieldName)) { + deserializedCustomizableConnectionsConfig.templateSpecName = reader.getString(); + } else if ("templateSpecVersion".equals(fieldName)) { + deserializedCustomizableConnectionsConfig.templateSpecVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomizableConnectionsConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectorDefinition.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectorDefinition.java new file mode 100644 index 000000000000..98b501e0a7b4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectorDefinition.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.CustomizableConnectorDefinitionProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Connector definition for kind 'Customizable'. + */ +@Fluent +public final class CustomizableConnectorDefinition extends DataConnectorDefinitionInner { + /* + * The data connector kind + */ + private DataConnectorDefinitionKind kind = DataConnectorDefinitionKind.CUSTOMIZABLE; + + /* + * Customizable properties. + */ + private CustomizableConnectorDefinitionProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CustomizableConnectorDefinition class. + */ + public CustomizableConnectorDefinition() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorDefinitionKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Customizable properties. + * + * @return the innerProperties value. + */ + private CustomizableConnectorDefinitionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CustomizableConnectorDefinition withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the createdTimeUtc property: Gets or sets the connector definition created date in UTC format. + * + * @return the createdTimeUtc value. + */ + public OffsetDateTime createdTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdTimeUtc(); + } + + /** + * Set the createdTimeUtc property: Gets or sets the connector definition created date in UTC format. + * + * @param createdTimeUtc the createdTimeUtc value to set. + * @return the CustomizableConnectorDefinition object itself. + */ + public CustomizableConnectorDefinition withCreatedTimeUtc(OffsetDateTime createdTimeUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomizableConnectorDefinitionProperties(); + } + this.innerProperties().withCreatedTimeUtc(createdTimeUtc); + return this; + } + + /** + * Get the lastModifiedUtc property: Gets or sets the connector definition last modified date in UTC format. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc(); + } + + /** + * Set the lastModifiedUtc property: Gets or sets the connector definition last modified date in UTC format. + * + * @param lastModifiedUtc the lastModifiedUtc value to set. + * @return the CustomizableConnectorDefinition object itself. + */ + public CustomizableConnectorDefinition withLastModifiedUtc(OffsetDateTime lastModifiedUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomizableConnectorDefinitionProperties(); + } + this.innerProperties().withLastModifiedUtc(lastModifiedUtc); + return this; + } + + /** + * Get the connectorUiConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @return the connectorUiConfig value. + */ + public CustomizableConnectorUiConfig connectorUiConfig() { + return this.innerProperties() == null ? null : this.innerProperties().connectorUiConfig(); + } + + /** + * Set the connectorUiConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @param connectorUiConfig the connectorUiConfig value to set. + * @return the CustomizableConnectorDefinition object itself. + */ + public CustomizableConnectorDefinition withConnectorUiConfig(CustomizableConnectorUiConfig connectorUiConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomizableConnectorDefinitionProperties(); + } + this.innerProperties().withConnectorUiConfig(connectorUiConfig); + return this; + } + + /** + * Get the connectionsConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @return the connectionsConfig value. + */ + public CustomizableConnectionsConfig connectionsConfig() { + return this.innerProperties() == null ? null : this.innerProperties().connectionsConfig(); + } + + /** + * Set the connectionsConfig property: The UiConfig for 'Customizable' connector definition kind. + * + * @param connectionsConfig the connectionsConfig value to set. + * @return the CustomizableConnectorDefinition object itself. + */ + public CustomizableConnectorDefinition withConnectionsConfig(CustomizableConnectionsConfig connectionsConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomizableConnectorDefinitionProperties(); + } + this.innerProperties().withConnectionsConfig(connectionsConfig); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomizableConnectorDefinition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomizableConnectorDefinition if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomizableConnectorDefinition. + */ + public static CustomizableConnectorDefinition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomizableConnectorDefinition deserializedCustomizableConnectorDefinition + = new CustomizableConnectorDefinition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomizableConnectorDefinition.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomizableConnectorDefinition.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomizableConnectorDefinition.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedCustomizableConnectorDefinition.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedCustomizableConnectorDefinition.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedCustomizableConnectorDefinition.kind + = DataConnectorDefinitionKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedCustomizableConnectorDefinition.innerProperties + = CustomizableConnectorDefinitionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomizableConnectorDefinition; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectorUiConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectorUiConfig.java new file mode 100644 index 000000000000..91e636c31b07 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomizableConnectorUiConfig.java @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The UiConfig for 'Customizable' connector definition kind. + */ +@Fluent +public final class CustomizableConnectorUiConfig implements JsonSerializable { + /* + * Gets or sets custom connector id. optional field. + */ + private String id; + + /* + * Gets or sets the connector blade title. + */ + private String title; + + /* + * Gets or sets the connector publisher name. + */ + private String publisher; + + /* + * Gets or sets the connector description in markdown format. + */ + private String descriptionMarkdown; + + /* + * Gets or sets the graph queries to show the current data volume over time. + */ + private List graphQueries; + + /* + * Gets or sets the data types to check for last data received. + */ + private List dataTypes; + + /* + * Gets or sets the way the connector checks whether the connector is connected. + */ + private List connectivityCriteria; + + /* + * The exposure status of the connector to the customers. + */ + private ConnectorDefinitionsAvailability availability; + + /* + * The required Permissions for the connector. + */ + private ConnectorDefinitionsPermissions permissions; + + /* + * Gets or sets the instruction steps to enable the connector. + */ + private List instructionSteps; + + /* + * Gets or sets the connector logo to be used when displaying the connector within Azure Sentinel's connector's + * gallery. + * The logo value should be in SVG format. + */ + private String logo; + + /* + * Gets or sets a value indicating whether to use 'OR'(SOME) or 'AND' between ConnectivityCriteria items. + */ + private Boolean isConnectivityCriteriasMatchSome; + + /** + * Creates an instance of CustomizableConnectorUiConfig class. + */ + public CustomizableConnectorUiConfig() { + } + + /** + * Get the id property: Gets or sets custom connector id. optional field. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Gets or sets custom connector id. optional field. + * + * @param id the id value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withId(String id) { + this.id = id; + return this; + } + + /** + * Get the title property: Gets or sets the connector blade title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Gets or sets the connector blade title. + * + * @param title the title value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the publisher property: Gets or sets the connector publisher name. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: Gets or sets the connector publisher name. + * + * @param publisher the publisher value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the descriptionMarkdown property: Gets or sets the connector description in markdown format. + * + * @return the descriptionMarkdown value. + */ + public String descriptionMarkdown() { + return this.descriptionMarkdown; + } + + /** + * Set the descriptionMarkdown property: Gets or sets the connector description in markdown format. + * + * @param descriptionMarkdown the descriptionMarkdown value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withDescriptionMarkdown(String descriptionMarkdown) { + this.descriptionMarkdown = descriptionMarkdown; + return this; + } + + /** + * Get the graphQueries property: Gets or sets the graph queries to show the current data volume over time. + * + * @return the graphQueries value. + */ + public List graphQueries() { + return this.graphQueries; + } + + /** + * Set the graphQueries property: Gets or sets the graph queries to show the current data volume over time. + * + * @param graphQueries the graphQueries value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withGraphQueries(List graphQueries) { + this.graphQueries = graphQueries; + return this; + } + + /** + * Get the dataTypes property: Gets or sets the data types to check for last data received. + * + * @return the dataTypes value. + */ + public List dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: Gets or sets the data types to check for last data received. + * + * @param dataTypes the dataTypes value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withDataTypes(List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * Get the connectivityCriteria property: Gets or sets the way the connector checks whether the connector is + * connected. + * + * @return the connectivityCriteria value. + */ + public List connectivityCriteria() { + return this.connectivityCriteria; + } + + /** + * Set the connectivityCriteria property: Gets or sets the way the connector checks whether the connector is + * connected. + * + * @param connectivityCriteria the connectivityCriteria value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withConnectivityCriteria(List connectivityCriteria) { + this.connectivityCriteria = connectivityCriteria; + return this; + } + + /** + * Get the availability property: The exposure status of the connector to the customers. + * + * @return the availability value. + */ + public ConnectorDefinitionsAvailability availability() { + return this.availability; + } + + /** + * Set the availability property: The exposure status of the connector to the customers. + * + * @param availability the availability value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withAvailability(ConnectorDefinitionsAvailability availability) { + this.availability = availability; + return this; + } + + /** + * Get the permissions property: The required Permissions for the connector. + * + * @return the permissions value. + */ + public ConnectorDefinitionsPermissions permissions() { + return this.permissions; + } + + /** + * Set the permissions property: The required Permissions for the connector. + * + * @param permissions the permissions value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withPermissions(ConnectorDefinitionsPermissions permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the instructionSteps property: Gets or sets the instruction steps to enable the connector. + * + * @return the instructionSteps value. + */ + public List instructionSteps() { + return this.instructionSteps; + } + + /** + * Set the instructionSteps property: Gets or sets the instruction steps to enable the connector. + * + * @param instructionSteps the instructionSteps value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withInstructionSteps(List instructionSteps) { + this.instructionSteps = instructionSteps; + return this; + } + + /** + * Get the logo property: Gets or sets the connector logo to be used when displaying the connector within Azure + * Sentinel's connector's gallery. + * The logo value should be in SVG format. + * + * @return the logo value. + */ + public String logo() { + return this.logo; + } + + /** + * Set the logo property: Gets or sets the connector logo to be used when displaying the connector within Azure + * Sentinel's connector's gallery. + * The logo value should be in SVG format. + * + * @param logo the logo value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig withLogo(String logo) { + this.logo = logo; + return this; + } + + /** + * Get the isConnectivityCriteriasMatchSome property: Gets or sets a value indicating whether to use 'OR'(SOME) or + * 'AND' between ConnectivityCriteria items. + * + * @return the isConnectivityCriteriasMatchSome value. + */ + public Boolean isConnectivityCriteriasMatchSome() { + return this.isConnectivityCriteriasMatchSome; + } + + /** + * Set the isConnectivityCriteriasMatchSome property: Gets or sets a value indicating whether to use 'OR'(SOME) or + * 'AND' between ConnectivityCriteria items. + * + * @param isConnectivityCriteriasMatchSome the isConnectivityCriteriasMatchSome value to set. + * @return the CustomizableConnectorUiConfig object itself. + */ + public CustomizableConnectorUiConfig + withIsConnectivityCriteriasMatchSome(Boolean isConnectivityCriteriasMatchSome) { + this.isConnectivityCriteriasMatchSome = isConnectivityCriteriasMatchSome; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property title in model CustomizableConnectorUiConfig")); + } + if (publisher() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property publisher in model CustomizableConnectorUiConfig")); + } + if (descriptionMarkdown() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property descriptionMarkdown in model CustomizableConnectorUiConfig")); + } + if (graphQueries() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property graphQueries in model CustomizableConnectorUiConfig")); + } else { + graphQueries().forEach(e -> e.validate()); + } + if (dataTypes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataTypes in model CustomizableConnectorUiConfig")); + } else { + dataTypes().forEach(e -> e.validate()); + } + if (connectivityCriteria() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectivityCriteria in model CustomizableConnectorUiConfig")); + } else { + connectivityCriteria().forEach(e -> e.validate()); + } + if (availability() != null) { + availability().validate(); + } + if (permissions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property permissions in model CustomizableConnectorUiConfig")); + } else { + permissions().validate(); + } + if (instructionSteps() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property instructionSteps in model CustomizableConnectorUiConfig")); + } else { + instructionSteps().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CustomizableConnectorUiConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("descriptionMarkdown", this.descriptionMarkdown); + jsonWriter.writeArrayField("graphQueries", this.graphQueries, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("dataTypes", this.dataTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("connectivityCriteria", this.connectivityCriteria, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("permissions", this.permissions); + jsonWriter.writeArrayField("instructionSteps", this.instructionSteps, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("availability", this.availability); + jsonWriter.writeStringField("logo", this.logo); + jsonWriter.writeBooleanField("isConnectivityCriteriasMatchSome", this.isConnectivityCriteriasMatchSome); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomizableConnectorUiConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomizableConnectorUiConfig if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomizableConnectorUiConfig. + */ + public static CustomizableConnectorUiConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomizableConnectorUiConfig deserializedCustomizableConnectorUiConfig + = new CustomizableConnectorUiConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.title = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.publisher = reader.getString(); + } else if ("descriptionMarkdown".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.descriptionMarkdown = reader.getString(); + } else if ("graphQueries".equals(fieldName)) { + List graphQueries = reader.readArray(reader1 -> GraphQuery.fromJson(reader1)); + deserializedCustomizableConnectorUiConfig.graphQueries = graphQueries; + } else if ("dataTypes".equals(fieldName)) { + List dataTypes + = reader.readArray(reader1 -> ConnectorDataType.fromJson(reader1)); + deserializedCustomizableConnectorUiConfig.dataTypes = dataTypes; + } else if ("connectivityCriteria".equals(fieldName)) { + List connectivityCriteria + = reader.readArray(reader1 -> ConnectivityCriterion.fromJson(reader1)); + deserializedCustomizableConnectorUiConfig.connectivityCriteria = connectivityCriteria; + } else if ("permissions".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.permissions + = ConnectorDefinitionsPermissions.fromJson(reader); + } else if ("instructionSteps".equals(fieldName)) { + List instructionSteps + = reader.readArray(reader1 -> InstructionStep.fromJson(reader1)); + deserializedCustomizableConnectorUiConfig.instructionSteps = instructionSteps; + } else if ("id".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.id = reader.getString(); + } else if ("availability".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.availability + = ConnectorDefinitionsAvailability.fromJson(reader); + } else if ("logo".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.logo = reader.getString(); + } else if ("isConnectivityCriteriasMatchSome".equals(fieldName)) { + deserializedCustomizableConnectorUiConfig.isConnectivityCriteriasMatchSome + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomizableConnectorUiConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Customs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Customs.java new file mode 100644 index 000000000000..d5ef458465e1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Customs.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Customs permissions required for the connector. + */ +@Fluent +public class Customs extends CustomsPermission { + /** + * Creates an instance of Customs class. + */ + public Customs() { + } + + /** + * {@inheritDoc} + */ + @Override + public Customs withName(String name) { + super.withName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public Customs withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("description", description()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Customs from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Customs if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Customs. + */ + public static Customs fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Customs deserializedCustoms = new Customs(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCustoms.withName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedCustoms.withDescription(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCustoms; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomsPermission.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomsPermission.java new file mode 100644 index 000000000000..88caf61f74e5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/CustomsPermission.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Customs permissions required for the connector. + */ +@Fluent +public class CustomsPermission implements JsonSerializable { + /* + * Customs permissions name + */ + private String name; + + /* + * Customs permissions description + */ + private String description; + + /** + * Creates an instance of CustomsPermission class. + */ + public CustomsPermission() { + } + + /** + * Get the name property: Customs permissions name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Customs permissions name. + * + * @param name the name value to set. + * @return the CustomsPermission object itself. + */ + public CustomsPermission withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: Customs permissions description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Customs permissions description. + * + * @param description the description value to set. + * @return the CustomsPermission object itself. + */ + public CustomsPermission withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomsPermission from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomsPermission if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomsPermission. + */ + public static CustomsPermission fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomsPermission deserializedCustomsPermission = new CustomsPermission(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCustomsPermission.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomsPermission.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomsPermission; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorAuthorizationState.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorAuthorizationState.java new file mode 100644 index 000000000000..ba40b7a81fef --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorAuthorizationState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes the state of user's authorization for a connector kind. + */ +public final class DataConnectorAuthorizationState extends ExpandableStringEnum { + /** + * Static value Valid for DataConnectorAuthorizationState. + */ + public static final DataConnectorAuthorizationState VALID = fromString("Valid"); + + /** + * Static value Invalid for DataConnectorAuthorizationState. + */ + public static final DataConnectorAuthorizationState INVALID = fromString("Invalid"); + + /** + * Creates a new instance of DataConnectorAuthorizationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataConnectorAuthorizationState() { + } + + /** + * Creates or finds a DataConnectorAuthorizationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataConnectorAuthorizationState. + */ + public static DataConnectorAuthorizationState fromString(String name) { + return fromString(name, DataConnectorAuthorizationState.class); + } + + /** + * Gets known DataConnectorAuthorizationState values. + * + * @return known DataConnectorAuthorizationState values. + */ + public static Collection values() { + return values(DataConnectorAuthorizationState.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorConnectBody.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorConnectBody.java new file mode 100644 index 000000000000..4961fd4195f8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorConnectBody.java @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents Codeless API Polling data connector. + */ +@Fluent +public final class DataConnectorConnectBody implements JsonSerializable { + /* + * The authentication kind used to poll the data + */ + private ConnectAuthKind kind; + + /* + * The API key of the audit server. + */ + private String apiKey; + + /* + * Used in v2 logs connector. Represents the data collection ingestion endpoint in log analytics. + */ + private String dataCollectionEndpoint; + + /* + * Used in v2 logs connector. The data collection rule immutable id, the rule defines the transformation and data + * destination. + */ + private String dataCollectionRuleImmutableId; + + /* + * Used in v2 logs connector. The stream we are sending the data to, this is the name of the streamDeclarations + * defined in the DCR. + */ + private String outputStream; + + /* + * The client secret of the OAuth 2.0 application. + */ + private String clientSecret; + + /* + * The client id of the OAuth 2.0 application. + */ + private String clientId; + + /* + * The authorization code used in OAuth 2.0 code flow to issue a token. + */ + private String authorizationCode; + + /* + * The user name in the audit log server. + */ + private String username; + + /* + * The user password in the audit log server. + */ + private String password; + + /* + * The requestConfigUserInputValues property. + */ + private List requestConfigUserInputValues; + + /** + * Creates an instance of DataConnectorConnectBody class. + */ + public DataConnectorConnectBody() { + } + + /** + * Get the kind property: The authentication kind used to poll the data. + * + * @return the kind value. + */ + public ConnectAuthKind kind() { + return this.kind; + } + + /** + * Set the kind property: The authentication kind used to poll the data. + * + * @param kind the kind value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withKind(ConnectAuthKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the apiKey property: The API key of the audit server. + * + * @return the apiKey value. + */ + public String apiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: The API key of the audit server. + * + * @param apiKey the apiKey value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Get the dataCollectionEndpoint property: Used in v2 logs connector. Represents the data collection ingestion + * endpoint in log analytics. + * + * @return the dataCollectionEndpoint value. + */ + public String dataCollectionEndpoint() { + return this.dataCollectionEndpoint; + } + + /** + * Set the dataCollectionEndpoint property: Used in v2 logs connector. Represents the data collection ingestion + * endpoint in log analytics. + * + * @param dataCollectionEndpoint the dataCollectionEndpoint value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withDataCollectionEndpoint(String dataCollectionEndpoint) { + this.dataCollectionEndpoint = dataCollectionEndpoint; + return this; + } + + /** + * Get the dataCollectionRuleImmutableId property: Used in v2 logs connector. The data collection rule immutable id, + * the rule defines the transformation and data destination. + * + * @return the dataCollectionRuleImmutableId value. + */ + public String dataCollectionRuleImmutableId() { + return this.dataCollectionRuleImmutableId; + } + + /** + * Set the dataCollectionRuleImmutableId property: Used in v2 logs connector. The data collection rule immutable id, + * the rule defines the transformation and data destination. + * + * @param dataCollectionRuleImmutableId the dataCollectionRuleImmutableId value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withDataCollectionRuleImmutableId(String dataCollectionRuleImmutableId) { + this.dataCollectionRuleImmutableId = dataCollectionRuleImmutableId; + return this; + } + + /** + * Get the outputStream property: Used in v2 logs connector. The stream we are sending the data to, this is the name + * of the streamDeclarations defined in the DCR. + * + * @return the outputStream value. + */ + public String outputStream() { + return this.outputStream; + } + + /** + * Set the outputStream property: Used in v2 logs connector. The stream we are sending the data to, this is the name + * of the streamDeclarations defined in the DCR. + * + * @param outputStream the outputStream value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withOutputStream(String outputStream) { + this.outputStream = outputStream; + return this; + } + + /** + * Get the clientSecret property: The client secret of the OAuth 2.0 application. + * + * @return the clientSecret value. + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set the clientSecret property: The client secret of the OAuth 2.0 application. + * + * @param clientSecret the clientSecret value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get the clientId property: The client id of the OAuth 2.0 application. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: The client id of the OAuth 2.0 application. + * + * @param clientId the clientId value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the authorizationCode property: The authorization code used in OAuth 2.0 code flow to issue a token. + * + * @return the authorizationCode value. + */ + public String authorizationCode() { + return this.authorizationCode; + } + + /** + * Set the authorizationCode property: The authorization code used in OAuth 2.0 code flow to issue a token. + * + * @param authorizationCode the authorizationCode value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withAuthorizationCode(String authorizationCode) { + this.authorizationCode = authorizationCode; + return this; + } + + /** + * Get the username property: The user name in the audit log server. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name in the audit log server. + * + * @param username the username value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The user password in the audit log server. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The user password in the audit log server. + * + * @param password the password value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the requestConfigUserInputValues property: The requestConfigUserInputValues property. + * + * @return the requestConfigUserInputValues value. + */ + public List requestConfigUserInputValues() { + return this.requestConfigUserInputValues; + } + + /** + * Set the requestConfigUserInputValues property: The requestConfigUserInputValues property. + * + * @param requestConfigUserInputValues the requestConfigUserInputValues value to set. + * @return the DataConnectorConnectBody object itself. + */ + public DataConnectorConnectBody withRequestConfigUserInputValues(List requestConfigUserInputValues) { + this.requestConfigUserInputValues = requestConfigUserInputValues; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("apiKey", this.apiKey); + jsonWriter.writeStringField("dataCollectionEndpoint", this.dataCollectionEndpoint); + jsonWriter.writeStringField("dataCollectionRuleImmutableId", this.dataCollectionRuleImmutableId); + jsonWriter.writeStringField("outputStream", this.outputStream); + jsonWriter.writeStringField("clientSecret", this.clientSecret); + jsonWriter.writeStringField("clientId", this.clientId); + jsonWriter.writeStringField("authorizationCode", this.authorizationCode); + jsonWriter.writeStringField("userName", this.username); + jsonWriter.writeStringField("password", this.password); + jsonWriter.writeArrayField("requestConfigUserInputValues", this.requestConfigUserInputValues, + (writer, element) -> writer.writeUntyped(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorConnectBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorConnectBody if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataConnectorConnectBody. + */ + public static DataConnectorConnectBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorConnectBody deserializedDataConnectorConnectBody = new DataConnectorConnectBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedDataConnectorConnectBody.kind = ConnectAuthKind.fromString(reader.getString()); + } else if ("apiKey".equals(fieldName)) { + deserializedDataConnectorConnectBody.apiKey = reader.getString(); + } else if ("dataCollectionEndpoint".equals(fieldName)) { + deserializedDataConnectorConnectBody.dataCollectionEndpoint = reader.getString(); + } else if ("dataCollectionRuleImmutableId".equals(fieldName)) { + deserializedDataConnectorConnectBody.dataCollectionRuleImmutableId = reader.getString(); + } else if ("outputStream".equals(fieldName)) { + deserializedDataConnectorConnectBody.outputStream = reader.getString(); + } else if ("clientSecret".equals(fieldName)) { + deserializedDataConnectorConnectBody.clientSecret = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedDataConnectorConnectBody.clientId = reader.getString(); + } else if ("authorizationCode".equals(fieldName)) { + deserializedDataConnectorConnectBody.authorizationCode = reader.getString(); + } else if ("userName".equals(fieldName)) { + deserializedDataConnectorConnectBody.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedDataConnectorConnectBody.password = reader.getString(); + } else if ("requestConfigUserInputValues".equals(fieldName)) { + List requestConfigUserInputValues = reader.readArray(reader1 -> reader1.readUntyped()); + deserializedDataConnectorConnectBody.requestConfigUserInputValues = requestConfigUserInputValues; + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorConnectBody; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDataTypeCommon.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDataTypeCommon.java index ebdff8a38efb..22cf6e0578f8 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDataTypeCommon.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDataTypeCommon.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -53,8 +54,15 @@ public DataConnectorDataTypeCommon withState(DataTypeState state) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model DataConnectorDataTypeCommon")); + } } + private static final ClientLogger LOGGER = new ClientLogger(DataConnectorDataTypeCommon.class); + /** * {@inheritDoc} */ @@ -71,6 +79,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of DataConnectorDataTypeCommon if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the DataConnectorDataTypeCommon. */ public static DataConnectorDataTypeCommon fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinition.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinition.java new file mode 100644 index 000000000000..cce67600aad6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinition.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; + +/** + * An immutable client-side representation of DataConnectorDefinition. + */ +public interface DataConnectorDefinition { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the kind property: The data connector kind. + * + * @return the kind value. + */ + DataConnectorDefinitionKind kind(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner object. + * + * @return the inner object. + */ + DataConnectorDefinitionInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitionArmCollectionWrapper.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitionArmCollectionWrapper.java new file mode 100644 index 000000000000..8a7a694e7b13 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitionArmCollectionWrapper.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; +import java.io.IOException; +import java.util.List; + +/** + * Encapsulate the data connector definition object. + */ +@Fluent +public final class DataConnectorDefinitionArmCollectionWrapper + implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of DataConnectorDefinitionArmCollectionWrapper class. + */ + public DataConnectorDefinitionArmCollectionWrapper() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the DataConnectorDefinitionArmCollectionWrapper object itself. + */ + public DataConnectorDefinitionArmCollectionWrapper withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the DataConnectorDefinitionArmCollectionWrapper object itself. + */ + public DataConnectorDefinitionArmCollectionWrapper withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorDefinitionArmCollectionWrapper from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorDefinitionArmCollectionWrapper if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataConnectorDefinitionArmCollectionWrapper. + */ + public static DataConnectorDefinitionArmCollectionWrapper fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorDefinitionArmCollectionWrapper deserializedDataConnectorDefinitionArmCollectionWrapper + = new DataConnectorDefinitionArmCollectionWrapper(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DataConnectorDefinitionInner.fromJson(reader1)); + deserializedDataConnectorDefinitionArmCollectionWrapper.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDataConnectorDefinitionArmCollectionWrapper.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorDefinitionArmCollectionWrapper; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitionKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitionKind.java new file mode 100644 index 000000000000..7beb462b59bf --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitionKind.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the data connector definitions. + */ +public final class DataConnectorDefinitionKind extends ExpandableStringEnum { + /** + * Static value Customizable for DataConnectorDefinitionKind. + */ + public static final DataConnectorDefinitionKind CUSTOMIZABLE = fromString("Customizable"); + + /** + * Creates a new instance of DataConnectorDefinitionKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataConnectorDefinitionKind() { + } + + /** + * Creates or finds a DataConnectorDefinitionKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataConnectorDefinitionKind. + */ + public static DataConnectorDefinitionKind fromString(String name) { + return fromString(name, DataConnectorDefinitionKind.class); + } + + /** + * Gets known DataConnectorDefinitionKind values. + * + * @return known DataConnectorDefinitionKind values. + */ + public static Collection values() { + return values(DataConnectorDefinitionKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitions.java new file mode 100644 index 000000000000..a93872df5e69 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorDefinitions.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorDefinitionInner; + +/** + * Resource collection API of DataConnectorDefinitions. + */ +public interface DataConnectorDefinitions { + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all data connector definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all data connector definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context); + + /** + * Gets a data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a data connector definition. + */ + DataConnectorDefinition get(String resourceGroupName, String workspaceName, String dataConnectorDefinitionName); + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections along with {@link Response}. + */ + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput, Context context); + + /** + * Creates or updates the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param connectorDefinitionInput The data connector definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure resource, which encapsulate the entire info requires to display a data connector page in Azure + * portal, + * and the info required to define data connections. + */ + DataConnectorDefinition createOrUpdate(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, DataConnectorDefinitionInner connectorDefinitionInput); + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String dataConnectorDefinitionName, Context context); + + /** + * Delete the data connector definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorDefinitionName The data connector definition name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String dataConnectorDefinitionName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorKind.java index db1f66cb50f9..5ec9d4c50d54 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorKind.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorKind.java @@ -31,16 +31,52 @@ public final class DataConnectorKind extends ExpandableStringEnum { + /** + * Static value Valid for DataConnectorLicenseState. + */ + public static final DataConnectorLicenseState VALID = fromString("Valid"); + + /** + * Static value Invalid for DataConnectorLicenseState. + */ + public static final DataConnectorLicenseState INVALID = fromString("Invalid"); + + /** + * Static value Unknown for DataConnectorLicenseState. + */ + public static final DataConnectorLicenseState UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of DataConnectorLicenseState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataConnectorLicenseState() { + } + + /** + * Creates or finds a DataConnectorLicenseState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataConnectorLicenseState. + */ + public static DataConnectorLicenseState fromString(String name) { + return fromString(name, DataConnectorLicenseState.class); + } + + /** + * Gets known DataConnectorLicenseState values. + * + * @return known DataConnectorLicenseState values. + */ + public static Collection values() { + return values(DataConnectorLicenseState.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorRequirementsState.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorRequirementsState.java new file mode 100644 index 000000000000..039364a89b15 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorRequirementsState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorRequirementsStateInner; + +/** + * An immutable client-side representation of DataConnectorRequirementsState. + */ +public interface DataConnectorRequirementsState { + /** + * Gets the authorizationState property: Authorization state for this connector. + * + * @return the authorizationState value. + */ + DataConnectorAuthorizationState authorizationState(); + + /** + * Gets the licenseState property: License state for this connector. + * + * @return the licenseState value. + */ + DataConnectorLicenseState licenseState(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorRequirementsStateInner + * object. + * + * @return the inner object. + */ + DataConnectorRequirementsStateInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorTenantId.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorTenantId.java new file mode 100644 index 000000000000..5b8c63e7d843 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorTenantId.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties data connector on tenant level. + */ +@Fluent +public class DataConnectorTenantId implements JsonSerializable { + /* + * The tenant id to connect to, and get the data from. + */ + private String tenantId; + + /** + * Creates an instance of DataConnectorTenantId class. + */ + public DataConnectorTenantId() { + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the DataConnectorTenantId object itself. + */ + public DataConnectorTenantId withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property tenantId in model DataConnectorTenantId")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataConnectorTenantId.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", this.tenantId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorTenantId from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorTenantId if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataConnectorTenantId. + */ + public static DataConnectorTenantId fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorTenantId deserializedDataConnectorTenantId = new DataConnectorTenantId(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedDataConnectorTenantId.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorTenantId; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectors.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectors.java index da8a6da80a6f..41a7a9f8415e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectors.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectors.java @@ -123,4 +123,61 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ void delete(String resourceGroupName, String workspaceName, String dataConnectorId); + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response connectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody, Context context); + + /** + * Connects a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param connectBody The data connector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void connect(String resourceGroupName, String workspaceName, String dataConnectorId, + DataConnectorConnectBody connectBody); + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response disconnectWithResponse(String resourceGroupName, String workspaceName, String dataConnectorId, + Context context); + + /** + * Disconnect a data connector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorId Connector ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void disconnect(String resourceGroupName, String workspaceName, String dataConnectorId); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorsCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorsCheckRequirements.java new file mode 100644 index 000000000000..44ea729be186 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorsCheckRequirements.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Data connector requirements properties. + */ +@Immutable +public class DataConnectorsCheckRequirements implements JsonSerializable { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.fromString("DataConnectorsCheckRequirements"); + + /** + * Creates an instance of DataConnectorsCheckRequirements class. + */ + public DataConnectorsCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorsCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorsCheckRequirements if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataConnectorsCheckRequirements. + */ + public static DataConnectorsCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureActiveDirectory".equals(discriminatorValue)) { + return AadCheckRequirements.fromJson(readerToUse.reset()); + } else if ("AzureAdvancedThreatProtection".equals(discriminatorValue)) { + return AatpCheckRequirements.fromJson(readerToUse.reset()); + } else if ("AzureSecurityCenter".equals(discriminatorValue)) { + return AscCheckRequirements.fromJson(readerToUse.reset()); + } else if ("AmazonWebServicesCloudTrail".equals(discriminatorValue)) { + return AwsCloudTrailCheckRequirements.fromJson(readerToUse.reset()); + } else if ("AmazonWebServicesS3".equals(discriminatorValue)) { + return AwsS3CheckRequirements.fromJson(readerToUse.reset()); + } else if ("Dynamics365".equals(discriminatorValue)) { + return Dynamics365CheckRequirements.fromJson(readerToUse.reset()); + } else if ("MicrosoftCloudAppSecurity".equals(discriminatorValue)) { + return McasCheckRequirements.fromJson(readerToUse.reset()); + } else if ("MicrosoftDefenderAdvancedThreatProtection".equals(discriminatorValue)) { + return MdatpCheckRequirements.fromJson(readerToUse.reset()); + } else if ("MicrosoftThreatIntelligence".equals(discriminatorValue)) { + return MstiCheckRequirements.fromJson(readerToUse.reset()); + } else if ("MicrosoftThreatProtection".equals(discriminatorValue)) { + return MtpCheckRequirements.fromJson(readerToUse.reset()); + } else if ("OfficeATP".equals(discriminatorValue)) { + return OfficeAtpCheckRequirements.fromJson(readerToUse.reset()); + } else if ("OfficeIRM".equals(discriminatorValue)) { + return OfficeIrmCheckRequirements.fromJson(readerToUse.reset()); + } else if ("MicrosoftPurviewInformationProtection".equals(discriminatorValue)) { + return MicrosoftPurviewInformationProtectionCheckRequirements.fromJson(readerToUse.reset()); + } else if ("Office365Project".equals(discriminatorValue)) { + return Office365ProjectCheckRequirements.fromJson(readerToUse.reset()); + } else if ("OfficePowerBI".equals(discriminatorValue)) { + return OfficePowerBICheckRequirements.fromJson(readerToUse.reset()); + } else if ("PurviewAudit".equals(discriminatorValue)) { + return PurviewAuditCheckRequirements.fromJson(readerToUse.reset()); + } else if ("ThreatIntelligence".equals(discriminatorValue)) { + return TICheckRequirements.fromJson(readerToUse.reset()); + } else if ("ThreatIntelligenceTaxii".equals(discriminatorValue)) { + return TiTaxiiCheckRequirements.fromJson(readerToUse.reset()); + } else if ("IOT".equals(discriminatorValue)) { + return IoTCheckRequirements.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static DataConnectorsCheckRequirements fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorsCheckRequirements deserializedDataConnectorsCheckRequirements + = new DataConnectorsCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedDataConnectorsCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorsCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorsCheckRequirementsOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorsCheckRequirementsOperations.java new file mode 100644 index 000000000000..6dd61aa5ffc9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataConnectorsCheckRequirementsOperations.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of DataConnectorsCheckRequirementsOperations. + */ +public interface DataConnectorsCheckRequirementsOperations { + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type along with {@link Response}. + */ + Response postWithResponse(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements, Context context); + + /** + * Get requirements state for a data connector type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataConnectorsCheckRequirements The parameters for requirements check message. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return requirements state for a data connector type. + */ + DataConnectorRequirementsState post(String resourceGroupName, String workspaceName, + DataConnectorsCheckRequirements dataConnectorsCheckRequirements); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataTypeDefinitions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataTypeDefinitions.java new file mode 100644 index 000000000000..22a1379fd2f7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DataTypeDefinitions.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The data type definition. + */ +@Fluent +public final class DataTypeDefinitions implements JsonSerializable { + /* + * The data type name + */ + private String dataType; + + /** + * Creates an instance of DataTypeDefinitions class. + */ + public DataTypeDefinitions() { + } + + /** + * Get the dataType property: The data type name. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Set the dataType property: The data type name. + * + * @param dataType the dataType value to set. + * @return the DataTypeDefinitions object itself. + */ + public DataTypeDefinitions withDataType(String dataType) { + this.dataType = dataType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataType", this.dataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataTypeDefinitions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataTypeDefinitions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DataTypeDefinitions. + */ + public static DataTypeDefinitions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataTypeDefinitions deserializedDataTypeDefinitions = new DataTypeDefinitions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataType".equals(fieldName)) { + deserializedDataTypeDefinitions.dataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataTypeDefinitions; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DcrConfiguration.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DcrConfiguration.java new file mode 100644 index 000000000000..f83cc53d13e1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DcrConfiguration.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The configuration of the destination of the data. + */ +@Fluent +public final class DcrConfiguration implements JsonSerializable { + /* + * Represents the data collection ingestion endpoint in log analytics. + */ + private String dataCollectionEndpoint; + + /* + * The data collection rule immutable id, the rule defines the transformation and data destination. + */ + private String dataCollectionRuleImmutableId; + + /* + * The stream we are sending the data to. + */ + private String streamName; + + /** + * Creates an instance of DcrConfiguration class. + */ + public DcrConfiguration() { + } + + /** + * Get the dataCollectionEndpoint property: Represents the data collection ingestion endpoint in log analytics. + * + * @return the dataCollectionEndpoint value. + */ + public String dataCollectionEndpoint() { + return this.dataCollectionEndpoint; + } + + /** + * Set the dataCollectionEndpoint property: Represents the data collection ingestion endpoint in log analytics. + * + * @param dataCollectionEndpoint the dataCollectionEndpoint value to set. + * @return the DcrConfiguration object itself. + */ + public DcrConfiguration withDataCollectionEndpoint(String dataCollectionEndpoint) { + this.dataCollectionEndpoint = dataCollectionEndpoint; + return this; + } + + /** + * Get the dataCollectionRuleImmutableId property: The data collection rule immutable id, the rule defines the + * transformation and data destination. + * + * @return the dataCollectionRuleImmutableId value. + */ + public String dataCollectionRuleImmutableId() { + return this.dataCollectionRuleImmutableId; + } + + /** + * Set the dataCollectionRuleImmutableId property: The data collection rule immutable id, the rule defines the + * transformation and data destination. + * + * @param dataCollectionRuleImmutableId the dataCollectionRuleImmutableId value to set. + * @return the DcrConfiguration object itself. + */ + public DcrConfiguration withDataCollectionRuleImmutableId(String dataCollectionRuleImmutableId) { + this.dataCollectionRuleImmutableId = dataCollectionRuleImmutableId; + return this; + } + + /** + * Get the streamName property: The stream we are sending the data to. + * + * @return the streamName value. + */ + public String streamName() { + return this.streamName; + } + + /** + * Set the streamName property: The stream we are sending the data to. + * + * @param streamName the streamName value to set. + * @return the DcrConfiguration object itself. + */ + public DcrConfiguration withStreamName(String streamName) { + this.streamName = streamName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataCollectionEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataCollectionEndpoint in model DcrConfiguration")); + } + if (dataCollectionRuleImmutableId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataCollectionRuleImmutableId in model DcrConfiguration")); + } + if (streamName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property streamName in model DcrConfiguration")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DcrConfiguration.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataCollectionEndpoint", this.dataCollectionEndpoint); + jsonWriter.writeStringField("dataCollectionRuleImmutableId", this.dataCollectionRuleImmutableId); + jsonWriter.writeStringField("streamName", this.streamName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DcrConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DcrConfiguration if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DcrConfiguration. + */ + public static DcrConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DcrConfiguration deserializedDcrConfiguration = new DcrConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataCollectionEndpoint".equals(fieldName)) { + deserializedDcrConfiguration.dataCollectionEndpoint = reader.getString(); + } else if ("dataCollectionRuleImmutableId".equals(fieldName)) { + deserializedDcrConfiguration.dataCollectionRuleImmutableId = reader.getString(); + } else if ("streamName".equals(fieldName)) { + deserializedDcrConfiguration.streamName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDcrConfiguration; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeleteStatus.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeleteStatus.java new file mode 100644 index 000000000000..48383505cc44 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeleteStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates whether the file was deleted from the storage account. + */ +public final class DeleteStatus extends ExpandableStringEnum { + /** + * Static value Deleted for DeleteStatus. + */ + public static final DeleteStatus DELETED = fromString("Deleted"); + + /** + * Static value NotDeleted for DeleteStatus. + */ + public static final DeleteStatus NOT_DELETED = fromString("NotDeleted"); + + /** + * Static value Unspecified for DeleteStatus. + */ + public static final DeleteStatus UNSPECIFIED = fromString("Unspecified"); + + /** + * Creates a new instance of DeleteStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeleteStatus() { + } + + /** + * Creates or finds a DeleteStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeleteStatus. + */ + public static DeleteStatus fromString(String name) { + return fromString(name, DeleteStatus.class); + } + + /** + * Gets known DeleteStatus values. + * + * @return known DeleteStatus values. + */ + public static Collection values() { + return values(DeleteStatus.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Deployment.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Deployment.java new file mode 100644 index 000000000000..c6cf0b1f2e04 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Deployment.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Description about a deployment. + */ +@Fluent +public final class Deployment implements JsonSerializable { + /* + * Deployment identifier. + */ + private String deploymentId; + + /* + * Current status of the deployment. + */ + private DeploymentState deploymentState; + + /* + * The outcome of the deployment. + */ + private DeploymentResult deploymentResult; + + /* + * The time when the deployment finished. + */ + private OffsetDateTime deploymentTime; + + /* + * Url to access repository action logs. + */ + private String deploymentLogsUrl; + + /** + * Creates an instance of Deployment class. + */ + public Deployment() { + } + + /** + * Get the deploymentId property: Deployment identifier. + * + * @return the deploymentId value. + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Set the deploymentId property: Deployment identifier. + * + * @param deploymentId the deploymentId value to set. + * @return the Deployment object itself. + */ + public Deployment withDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + return this; + } + + /** + * Get the deploymentState property: Current status of the deployment. + * + * @return the deploymentState value. + */ + public DeploymentState deploymentState() { + return this.deploymentState; + } + + /** + * Set the deploymentState property: Current status of the deployment. + * + * @param deploymentState the deploymentState value to set. + * @return the Deployment object itself. + */ + public Deployment withDeploymentState(DeploymentState deploymentState) { + this.deploymentState = deploymentState; + return this; + } + + /** + * Get the deploymentResult property: The outcome of the deployment. + * + * @return the deploymentResult value. + */ + public DeploymentResult deploymentResult() { + return this.deploymentResult; + } + + /** + * Set the deploymentResult property: The outcome of the deployment. + * + * @param deploymentResult the deploymentResult value to set. + * @return the Deployment object itself. + */ + public Deployment withDeploymentResult(DeploymentResult deploymentResult) { + this.deploymentResult = deploymentResult; + return this; + } + + /** + * Get the deploymentTime property: The time when the deployment finished. + * + * @return the deploymentTime value. + */ + public OffsetDateTime deploymentTime() { + return this.deploymentTime; + } + + /** + * Set the deploymentTime property: The time when the deployment finished. + * + * @param deploymentTime the deploymentTime value to set. + * @return the Deployment object itself. + */ + public Deployment withDeploymentTime(OffsetDateTime deploymentTime) { + this.deploymentTime = deploymentTime; + return this; + } + + /** + * Get the deploymentLogsUrl property: Url to access repository action logs. + * + * @return the deploymentLogsUrl value. + */ + public String deploymentLogsUrl() { + return this.deploymentLogsUrl; + } + + /** + * Set the deploymentLogsUrl property: Url to access repository action logs. + * + * @param deploymentLogsUrl the deploymentLogsUrl value to set. + * @return the Deployment object itself. + */ + public Deployment withDeploymentLogsUrl(String deploymentLogsUrl) { + this.deploymentLogsUrl = deploymentLogsUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deploymentId", this.deploymentId); + jsonWriter.writeStringField("deploymentState", + this.deploymentState == null ? null : this.deploymentState.toString()); + jsonWriter.writeStringField("deploymentResult", + this.deploymentResult == null ? null : this.deploymentResult.toString()); + jsonWriter.writeStringField("deploymentTime", + this.deploymentTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.deploymentTime)); + jsonWriter.writeStringField("deploymentLogsUrl", this.deploymentLogsUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Deployment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Deployment if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Deployment. + */ + public static Deployment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Deployment deserializedDeployment = new Deployment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deploymentId".equals(fieldName)) { + deserializedDeployment.deploymentId = reader.getString(); + } else if ("deploymentState".equals(fieldName)) { + deserializedDeployment.deploymentState = DeploymentState.fromString(reader.getString()); + } else if ("deploymentResult".equals(fieldName)) { + deserializedDeployment.deploymentResult = DeploymentResult.fromString(reader.getString()); + } else if ("deploymentTime".equals(fieldName)) { + deserializedDeployment.deploymentTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("deploymentLogsUrl".equals(fieldName)) { + deserializedDeployment.deploymentLogsUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeployment; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentFetchStatus.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentFetchStatus.java new file mode 100644 index 000000000000..9c8fbb6eb0c5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentFetchStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status while trying to fetch the deployment information. + */ +public final class DeploymentFetchStatus extends ExpandableStringEnum { + /** + * Static value Success for DeploymentFetchStatus. + */ + public static final DeploymentFetchStatus SUCCESS = fromString("Success"); + + /** + * Static value Unauthorized for DeploymentFetchStatus. + */ + public static final DeploymentFetchStatus UNAUTHORIZED = fromString("Unauthorized"); + + /** + * Static value NotFound for DeploymentFetchStatus. + */ + public static final DeploymentFetchStatus NOT_FOUND = fromString("NotFound"); + + /** + * Creates a new instance of DeploymentFetchStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeploymentFetchStatus() { + } + + /** + * Creates or finds a DeploymentFetchStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentFetchStatus. + */ + public static DeploymentFetchStatus fromString(String name) { + return fromString(name, DeploymentFetchStatus.class); + } + + /** + * Gets known DeploymentFetchStatus values. + * + * @return known DeploymentFetchStatus values. + */ + public static Collection values() { + return values(DeploymentFetchStatus.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentInfo.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentInfo.java new file mode 100644 index 000000000000..9b2fdd79f82a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentInfo.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information regarding a deployment. + */ +@Fluent +public final class DeploymentInfo implements JsonSerializable { + /* + * Status while fetching the last deployment. + */ + private DeploymentFetchStatus deploymentFetchStatus; + + /* + * Deployment information. + */ + private Deployment deployment; + + /* + * Additional details about the deployment that can be shown to the user. + */ + private String message; + + /** + * Creates an instance of DeploymentInfo class. + */ + public DeploymentInfo() { + } + + /** + * Get the deploymentFetchStatus property: Status while fetching the last deployment. + * + * @return the deploymentFetchStatus value. + */ + public DeploymentFetchStatus deploymentFetchStatus() { + return this.deploymentFetchStatus; + } + + /** + * Set the deploymentFetchStatus property: Status while fetching the last deployment. + * + * @param deploymentFetchStatus the deploymentFetchStatus value to set. + * @return the DeploymentInfo object itself. + */ + public DeploymentInfo withDeploymentFetchStatus(DeploymentFetchStatus deploymentFetchStatus) { + this.deploymentFetchStatus = deploymentFetchStatus; + return this; + } + + /** + * Get the deployment property: Deployment information. + * + * @return the deployment value. + */ + public Deployment deployment() { + return this.deployment; + } + + /** + * Set the deployment property: Deployment information. + * + * @param deployment the deployment value to set. + * @return the DeploymentInfo object itself. + */ + public DeploymentInfo withDeployment(Deployment deployment) { + this.deployment = deployment; + return this; + } + + /** + * Get the message property: Additional details about the deployment that can be shown to the user. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Additional details about the deployment that can be shown to the user. + * + * @param message the message value to set. + * @return the DeploymentInfo object itself. + */ + public DeploymentInfo withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deployment() != null) { + deployment().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deploymentFetchStatus", + this.deploymentFetchStatus == null ? null : this.deploymentFetchStatus.toString()); + jsonWriter.writeJsonField("deployment", this.deployment); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeploymentInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DeploymentInfo. + */ + public static DeploymentInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentInfo deserializedDeploymentInfo = new DeploymentInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deploymentFetchStatus".equals(fieldName)) { + deserializedDeploymentInfo.deploymentFetchStatus + = DeploymentFetchStatus.fromString(reader.getString()); + } else if ("deployment".equals(fieldName)) { + deserializedDeploymentInfo.deployment = Deployment.fromJson(reader); + } else if ("message".equals(fieldName)) { + deserializedDeploymentInfo.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentInfo; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentResult.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentResult.java new file mode 100644 index 000000000000..aa6519e143b6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentResult.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status while trying to fetch the deployment information. + */ +public final class DeploymentResult extends ExpandableStringEnum { + /** + * Static value Success for DeploymentResult. + */ + public static final DeploymentResult SUCCESS = fromString("Success"); + + /** + * Static value Canceled for DeploymentResult. + */ + public static final DeploymentResult CANCELED = fromString("Canceled"); + + /** + * Static value Failed for DeploymentResult. + */ + public static final DeploymentResult FAILED = fromString("Failed"); + + /** + * Creates a new instance of DeploymentResult value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeploymentResult() { + } + + /** + * Creates or finds a DeploymentResult from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentResult. + */ + public static DeploymentResult fromString(String name) { + return fromString(name, DeploymentResult.class); + } + + /** + * Gets known DeploymentResult values. + * + * @return known DeploymentResult values. + */ + public static Collection values() { + return values(DeploymentResult.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentState.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentState.java new file mode 100644 index 000000000000..ba1221cc73c7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeploymentState.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current state of the deployment. + */ +public final class DeploymentState extends ExpandableStringEnum { + /** + * Static value In_Progress for DeploymentState. + */ + public static final DeploymentState IN_PROGRESS = fromString("In_Progress"); + + /** + * Static value Completed for DeploymentState. + */ + public static final DeploymentState COMPLETED = fromString("Completed"); + + /** + * Static value Queued for DeploymentState. + */ + public static final DeploymentState QUEUED = fromString("Queued"); + + /** + * Static value Canceling for DeploymentState. + */ + public static final DeploymentState CANCELING = fromString("Canceling"); + + /** + * Creates a new instance of DeploymentState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeploymentState() { + } + + /** + * Creates or finds a DeploymentState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentState. + */ + public static DeploymentState fromString(String name) { + return fromString(name, DeploymentState.class); + } + + /** + * Gets known DeploymentState values. + * + * @return known DeploymentState values. + */ + public static Collection values() { + return values(DeploymentState.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeviceImportance.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeviceImportance.java new file mode 100644 index 000000000000..26fbe4b0d67e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DeviceImportance.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Device importance, determines if the device classified as 'crown jewel'. + */ +public final class DeviceImportance extends ExpandableStringEnum { + /** + * Static value Unknown for DeviceImportance. + */ + public static final DeviceImportance UNKNOWN = fromString("Unknown"); + + /** + * Static value Low for DeviceImportance. + */ + public static final DeviceImportance LOW = fromString("Low"); + + /** + * Static value Normal for DeviceImportance. + */ + public static final DeviceImportance NORMAL = fromString("Normal"); + + /** + * Static value High for DeviceImportance. + */ + public static final DeviceImportance HIGH = fromString("High"); + + /** + * Creates a new instance of DeviceImportance value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeviceImportance() { + } + + /** + * Creates or finds a DeviceImportance from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeviceImportance. + */ + public static DeviceImportance fromString(String name) { + return fromString(name, DeviceImportance.class); + } + + /** + * Gets known DeviceImportance values. + * + * @return known DeviceImportance values. + */ + public static Collection values() { + return values(DeviceImportance.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DnsEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DnsEntity.java index 18b93fa0c424..eded4a1027f6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DnsEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/DnsEntity.java @@ -10,6 +10,7 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.securityinsights.fluent.models.DnsEntityProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import java.io.IOException; import java.util.List; import java.util.Map; @@ -18,7 +19,7 @@ * Represents a dns entity. */ @Immutable -public final class DnsEntity extends Entity { +public final class DnsEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365CheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365CheckRequirements.java new file mode 100644 index 000000000000..9ab4eceae3da --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365CheckRequirements.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.Dynamics365CheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents Dynamics365 requirements check request. + */ +@Fluent +public final class Dynamics365CheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.DYNAMICS365; + + /* + * Dynamics365 requirements check properties. + */ + private Dynamics365CheckRequirementsProperties innerProperties; + + /** + * Creates an instance of Dynamics365CheckRequirements class. + */ + public Dynamics365CheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Dynamics365 requirements check properties. + * + * @return the innerProperties value. + */ + Dynamics365CheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the Dynamics365CheckRequirements object itself. + */ + public Dynamics365CheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new Dynamics365CheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dynamics365CheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dynamics365CheckRequirements if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the Dynamics365CheckRequirements. + */ + public static Dynamics365CheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dynamics365CheckRequirements deserializedDynamics365CheckRequirements = new Dynamics365CheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedDynamics365CheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedDynamics365CheckRequirements.innerProperties + = Dynamics365CheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDynamics365CheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnector.java new file mode 100644 index 000000000000..8c1e8aaa0a50 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnector.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.Dynamics365DataConnectorProperties; +import java.io.IOException; + +/** + * Represents Dynamics365 data connector. + */ +@Fluent +public final class Dynamics365DataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.DYNAMICS365; + + /* + * Dynamics365 data connector properties. + */ + private Dynamics365DataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of Dynamics365DataConnector class. + */ + public Dynamics365DataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Dynamics365 data connector properties. + * + * @return the innerProperties value. + */ + private Dynamics365DataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public Dynamics365DataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public Dynamics365DataConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the Dynamics365DataConnector object itself. + */ + public Dynamics365DataConnector withDataTypes(Dynamics365DataConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new Dynamics365DataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the Dynamics365DataConnector object itself. + */ + public Dynamics365DataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new Dynamics365DataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dynamics365DataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dynamics365DataConnector if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dynamics365DataConnector. + */ + public static Dynamics365DataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dynamics365DataConnector deserializedDynamics365DataConnector = new Dynamics365DataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDynamics365DataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDynamics365DataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDynamics365DataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedDynamics365DataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedDynamics365DataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedDynamics365DataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedDynamics365DataConnector.innerProperties + = Dynamics365DataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDynamics365DataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnectorDataTypes.java new file mode 100644 index 000000000000..f470d5231ef6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnectorDataTypes.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Dynamics365 data connector. + */ +@Fluent +public final class Dynamics365DataConnectorDataTypes implements JsonSerializable { + /* + * Common Data Service data type connection. + */ + private Dynamics365DataConnectorDataTypesDynamics365CdsActivities dynamics365CdsActivities; + + /** + * Creates an instance of Dynamics365DataConnectorDataTypes class. + */ + public Dynamics365DataConnectorDataTypes() { + } + + /** + * Get the dynamics365CdsActivities property: Common Data Service data type connection. + * + * @return the dynamics365CdsActivities value. + */ + public Dynamics365DataConnectorDataTypesDynamics365CdsActivities dynamics365CdsActivities() { + return this.dynamics365CdsActivities; + } + + /** + * Set the dynamics365CdsActivities property: Common Data Service data type connection. + * + * @param dynamics365CdsActivities the dynamics365CdsActivities value to set. + * @return the Dynamics365DataConnectorDataTypes object itself. + */ + public Dynamics365DataConnectorDataTypes withDynamics365CdsActivities( + Dynamics365DataConnectorDataTypesDynamics365CdsActivities dynamics365CdsActivities) { + this.dynamics365CdsActivities = dynamics365CdsActivities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dynamics365CdsActivities() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dynamics365CdsActivities in model Dynamics365DataConnectorDataTypes")); + } else { + dynamics365CdsActivities().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Dynamics365DataConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("dynamics365CdsActivities", this.dynamics365CdsActivities); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dynamics365DataConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dynamics365DataConnectorDataTypes if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dynamics365DataConnectorDataTypes. + */ + public static Dynamics365DataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dynamics365DataConnectorDataTypes deserializedDynamics365DataConnectorDataTypes + = new Dynamics365DataConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dynamics365CdsActivities".equals(fieldName)) { + deserializedDynamics365DataConnectorDataTypes.dynamics365CdsActivities + = Dynamics365DataConnectorDataTypesDynamics365CdsActivities.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDynamics365DataConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnectorDataTypesDynamics365CdsActivities.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnectorDataTypesDynamics365CdsActivities.java new file mode 100644 index 000000000000..42424fdf9db1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Dynamics365DataConnectorDataTypesDynamics365CdsActivities.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Common Data Service data type connection. + */ +@Fluent +public final class Dynamics365DataConnectorDataTypesDynamics365CdsActivities extends DataConnectorDataTypeCommon { + /** + * Creates an instance of Dynamics365DataConnectorDataTypesDynamics365CdsActivities class. + */ + public Dynamics365DataConnectorDataTypesDynamics365CdsActivities() { + } + + /** + * {@inheritDoc} + */ + @Override + public Dynamics365DataConnectorDataTypesDynamics365CdsActivities withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model Dynamics365DataConnectorDataTypesDynamics365CdsActivities")); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(Dynamics365DataConnectorDataTypesDynamics365CdsActivities.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dynamics365DataConnectorDataTypesDynamics365CdsActivities from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dynamics365DataConnectorDataTypesDynamics365CdsActivities if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the + * Dynamics365DataConnectorDataTypesDynamics365CdsActivities. + */ + public static Dynamics365DataConnectorDataTypesDynamics365CdsActivities fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + Dynamics365DataConnectorDataTypesDynamics365CdsActivities deserializedDynamics365DataConnectorDataTypesDynamics365CdsActivities + = new Dynamics365DataConnectorDataTypesDynamics365CdsActivities(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedDynamics365DataConnectorDataTypesDynamics365CdsActivities + .withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDynamics365DataConnectorDataTypesDynamics365CdsActivities; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainBody.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainBody.java new file mode 100644 index 000000000000..70f9b81b1aa3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainBody.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Domain name to be enriched. + */ +@Fluent +public final class EnrichmentDomainBody implements JsonSerializable { + /* + * The domain name + */ + private String domain; + + /** + * Creates an instance of EnrichmentDomainBody class. + */ + public EnrichmentDomainBody() { + } + + /** + * Get the domain property: The domain name. + * + * @return the domain value. + */ + public String domain() { + return this.domain; + } + + /** + * Set the domain property: The domain name. + * + * @param domain the domain value to set. + * @return the EnrichmentDomainBody object itself. + */ + public EnrichmentDomainBody withDomain(String domain) { + this.domain = domain; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("domain", this.domain); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentDomainBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentDomainBody if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentDomainBody. + */ + public static EnrichmentDomainBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentDomainBody deserializedEnrichmentDomainBody = new EnrichmentDomainBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domain".equals(fieldName)) { + deserializedEnrichmentDomainBody.domain = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentDomainBody; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhois.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhois.java new file mode 100644 index 000000000000..0f2cc1919292 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhois.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentDomainWhoisInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of EnrichmentDomainWhois. + */ +public interface EnrichmentDomainWhois { + /** + * Gets the domain property: The domain for this whois record. + * + * @return the domain value. + */ + String domain(); + + /** + * Gets the server property: The hostname of this registrar's whois server. + * + * @return the server value. + */ + String server(); + + /** + * Gets the created property: The timestamp at which this record was created. + * + * @return the created value. + */ + OffsetDateTime created(); + + /** + * Gets the updated property: The timestamp at which this record was last updated. + * + * @return the updated value. + */ + OffsetDateTime updated(); + + /** + * Gets the expires property: The timestamp at which this record will expire. + * + * @return the expires value. + */ + OffsetDateTime expires(); + + /** + * Gets the parsedWhois property: The whois record for a given domain. + * + * @return the parsedWhois value. + */ + EnrichmentDomainWhoisDetails parsedWhois(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentDomainWhoisInner object. + * + * @return the inner object. + */ + EnrichmentDomainWhoisInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisContact.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisContact.java new file mode 100644 index 000000000000..2cfaf5b07373 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisContact.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * An individual contact associated with this domain. + */ +@Fluent +public final class EnrichmentDomainWhoisContact implements JsonSerializable { + /* + * The name of this contact + */ + private String name; + + /* + * The organization for this contact + */ + private String org; + + /* + * A list describing the street address for this contact + */ + private List street; + + /* + * The city for this contact + */ + private String city; + + /* + * The state for this contact + */ + private String state; + + /* + * The postal code for this contact + */ + private String postal; + + /* + * The country for this contact + */ + private String country; + + /* + * The phone number for this contact + */ + private String phone; + + /* + * The fax number for this contact + */ + private String fax; + + /* + * The email address for this contact + */ + private String email; + + /** + * Creates an instance of EnrichmentDomainWhoisContact class. + */ + public EnrichmentDomainWhoisContact() { + } + + /** + * Get the name property: The name of this contact. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of this contact. + * + * @param name the name value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withName(String name) { + this.name = name; + return this; + } + + /** + * Get the org property: The organization for this contact. + * + * @return the org value. + */ + public String org() { + return this.org; + } + + /** + * Set the org property: The organization for this contact. + * + * @param org the org value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withOrg(String org) { + this.org = org; + return this; + } + + /** + * Get the street property: A list describing the street address for this contact. + * + * @return the street value. + */ + public List street() { + return this.street; + } + + /** + * Set the street property: A list describing the street address for this contact. + * + * @param street the street value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withStreet(List street) { + this.street = street; + return this; + } + + /** + * Get the city property: The city for this contact. + * + * @return the city value. + */ + public String city() { + return this.city; + } + + /** + * Set the city property: The city for this contact. + * + * @param city the city value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withCity(String city) { + this.city = city; + return this; + } + + /** + * Get the state property: The state for this contact. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state for this contact. + * + * @param state the state value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withState(String state) { + this.state = state; + return this; + } + + /** + * Get the postal property: The postal code for this contact. + * + * @return the postal value. + */ + public String postal() { + return this.postal; + } + + /** + * Set the postal property: The postal code for this contact. + * + * @param postal the postal value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withPostal(String postal) { + this.postal = postal; + return this; + } + + /** + * Get the country property: The country for this contact. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: The country for this contact. + * + * @param country the country value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get the phone property: The phone number for this contact. + * + * @return the phone value. + */ + public String phone() { + return this.phone; + } + + /** + * Set the phone property: The phone number for this contact. + * + * @param phone the phone value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withPhone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get the fax property: The fax number for this contact. + * + * @return the fax value. + */ + public String fax() { + return this.fax; + } + + /** + * Set the fax property: The fax number for this contact. + * + * @param fax the fax value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withFax(String fax) { + this.fax = fax; + return this; + } + + /** + * Get the email property: The email address for this contact. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: The email address for this contact. + * + * @param email the email value to set. + * @return the EnrichmentDomainWhoisContact object itself. + */ + public EnrichmentDomainWhoisContact withEmail(String email) { + this.email = email; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("org", this.org); + jsonWriter.writeArrayField("street", this.street, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("city", this.city); + jsonWriter.writeStringField("state", this.state); + jsonWriter.writeStringField("postal", this.postal); + jsonWriter.writeStringField("country", this.country); + jsonWriter.writeStringField("phone", this.phone); + jsonWriter.writeStringField("fax", this.fax); + jsonWriter.writeStringField("email", this.email); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentDomainWhoisContact from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentDomainWhoisContact if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentDomainWhoisContact. + */ + public static EnrichmentDomainWhoisContact fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentDomainWhoisContact deserializedEnrichmentDomainWhoisContact = new EnrichmentDomainWhoisContact(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.name = reader.getString(); + } else if ("org".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.org = reader.getString(); + } else if ("street".equals(fieldName)) { + List street = reader.readArray(reader1 -> reader1.getString()); + deserializedEnrichmentDomainWhoisContact.street = street; + } else if ("city".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.city = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.state = reader.getString(); + } else if ("postal".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.postal = reader.getString(); + } else if ("country".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.country = reader.getString(); + } else if ("phone".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.phone = reader.getString(); + } else if ("fax".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.fax = reader.getString(); + } else if ("email".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContact.email = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentDomainWhoisContact; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisContacts.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisContacts.java new file mode 100644 index 000000000000..1215bd4e79c7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisContacts.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The set of contacts associated with this domain. + */ +@Fluent +public final class EnrichmentDomainWhoisContacts implements JsonSerializable { + /* + * The admin contact for this whois record + */ + private EnrichmentDomainWhoisContact admin; + + /* + * The billing contact for this whois record + */ + private EnrichmentDomainWhoisContact billing; + + /* + * The registrant contact for this whois record + */ + private EnrichmentDomainWhoisContact registrant; + + /* + * The technical contact for this whois record + */ + private EnrichmentDomainWhoisContact tech; + + /** + * Creates an instance of EnrichmentDomainWhoisContacts class. + */ + public EnrichmentDomainWhoisContacts() { + } + + /** + * Get the admin property: The admin contact for this whois record. + * + * @return the admin value. + */ + public EnrichmentDomainWhoisContact admin() { + return this.admin; + } + + /** + * Set the admin property: The admin contact for this whois record. + * + * @param admin the admin value to set. + * @return the EnrichmentDomainWhoisContacts object itself. + */ + public EnrichmentDomainWhoisContacts withAdmin(EnrichmentDomainWhoisContact admin) { + this.admin = admin; + return this; + } + + /** + * Get the billing property: The billing contact for this whois record. + * + * @return the billing value. + */ + public EnrichmentDomainWhoisContact billing() { + return this.billing; + } + + /** + * Set the billing property: The billing contact for this whois record. + * + * @param billing the billing value to set. + * @return the EnrichmentDomainWhoisContacts object itself. + */ + public EnrichmentDomainWhoisContacts withBilling(EnrichmentDomainWhoisContact billing) { + this.billing = billing; + return this; + } + + /** + * Get the registrant property: The registrant contact for this whois record. + * + * @return the registrant value. + */ + public EnrichmentDomainWhoisContact registrant() { + return this.registrant; + } + + /** + * Set the registrant property: The registrant contact for this whois record. + * + * @param registrant the registrant value to set. + * @return the EnrichmentDomainWhoisContacts object itself. + */ + public EnrichmentDomainWhoisContacts withRegistrant(EnrichmentDomainWhoisContact registrant) { + this.registrant = registrant; + return this; + } + + /** + * Get the tech property: The technical contact for this whois record. + * + * @return the tech value. + */ + public EnrichmentDomainWhoisContact tech() { + return this.tech; + } + + /** + * Set the tech property: The technical contact for this whois record. + * + * @param tech the tech value to set. + * @return the EnrichmentDomainWhoisContacts object itself. + */ + public EnrichmentDomainWhoisContacts withTech(EnrichmentDomainWhoisContact tech) { + this.tech = tech; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (admin() != null) { + admin().validate(); + } + if (billing() != null) { + billing().validate(); + } + if (registrant() != null) { + registrant().validate(); + } + if (tech() != null) { + tech().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("admin", this.admin); + jsonWriter.writeJsonField("billing", this.billing); + jsonWriter.writeJsonField("registrant", this.registrant); + jsonWriter.writeJsonField("tech", this.tech); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentDomainWhoisContacts from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentDomainWhoisContacts if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentDomainWhoisContacts. + */ + public static EnrichmentDomainWhoisContacts fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentDomainWhoisContacts deserializedEnrichmentDomainWhoisContacts + = new EnrichmentDomainWhoisContacts(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("admin".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContacts.admin = EnrichmentDomainWhoisContact.fromJson(reader); + } else if ("billing".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContacts.billing = EnrichmentDomainWhoisContact.fromJson(reader); + } else if ("registrant".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContacts.registrant + = EnrichmentDomainWhoisContact.fromJson(reader); + } else if ("tech".equals(fieldName)) { + deserializedEnrichmentDomainWhoisContacts.tech = EnrichmentDomainWhoisContact.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentDomainWhoisContacts; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisDetails.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisDetails.java new file mode 100644 index 000000000000..86908b1278f0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisDetails.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The whois record for a given domain. + */ +@Fluent +public final class EnrichmentDomainWhoisDetails implements JsonSerializable { + /* + * The registrar associated with this domain + */ + private EnrichmentDomainWhoisRegistrarDetails registrar; + + /* + * The set of contacts associated with this domain + */ + private EnrichmentDomainWhoisContacts contacts; + + /* + * A list of name servers associated with this domain + */ + private List nameServers; + + /* + * The set of status flags for this whois record + */ + private List statuses; + + /** + * Creates an instance of EnrichmentDomainWhoisDetails class. + */ + public EnrichmentDomainWhoisDetails() { + } + + /** + * Get the registrar property: The registrar associated with this domain. + * + * @return the registrar value. + */ + public EnrichmentDomainWhoisRegistrarDetails registrar() { + return this.registrar; + } + + /** + * Set the registrar property: The registrar associated with this domain. + * + * @param registrar the registrar value to set. + * @return the EnrichmentDomainWhoisDetails object itself. + */ + public EnrichmentDomainWhoisDetails withRegistrar(EnrichmentDomainWhoisRegistrarDetails registrar) { + this.registrar = registrar; + return this; + } + + /** + * Get the contacts property: The set of contacts associated with this domain. + * + * @return the contacts value. + */ + public EnrichmentDomainWhoisContacts contacts() { + return this.contacts; + } + + /** + * Set the contacts property: The set of contacts associated with this domain. + * + * @param contacts the contacts value to set. + * @return the EnrichmentDomainWhoisDetails object itself. + */ + public EnrichmentDomainWhoisDetails withContacts(EnrichmentDomainWhoisContacts contacts) { + this.contacts = contacts; + return this; + } + + /** + * Get the nameServers property: A list of name servers associated with this domain. + * + * @return the nameServers value. + */ + public List nameServers() { + return this.nameServers; + } + + /** + * Set the nameServers property: A list of name servers associated with this domain. + * + * @param nameServers the nameServers value to set. + * @return the EnrichmentDomainWhoisDetails object itself. + */ + public EnrichmentDomainWhoisDetails withNameServers(List nameServers) { + this.nameServers = nameServers; + return this; + } + + /** + * Get the statuses property: The set of status flags for this whois record. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: The set of status flags for this whois record. + * + * @param statuses the statuses value to set. + * @return the EnrichmentDomainWhoisDetails object itself. + */ + public EnrichmentDomainWhoisDetails withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (registrar() != null) { + registrar().validate(); + } + if (contacts() != null) { + contacts().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("registrar", this.registrar); + jsonWriter.writeJsonField("contacts", this.contacts); + jsonWriter.writeArrayField("nameServers", this.nameServers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("statuses", this.statuses, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentDomainWhoisDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentDomainWhoisDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentDomainWhoisDetails. + */ + public static EnrichmentDomainWhoisDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentDomainWhoisDetails deserializedEnrichmentDomainWhoisDetails = new EnrichmentDomainWhoisDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("registrar".equals(fieldName)) { + deserializedEnrichmentDomainWhoisDetails.registrar + = EnrichmentDomainWhoisRegistrarDetails.fromJson(reader); + } else if ("contacts".equals(fieldName)) { + deserializedEnrichmentDomainWhoisDetails.contacts = EnrichmentDomainWhoisContacts.fromJson(reader); + } else if ("nameServers".equals(fieldName)) { + List nameServers = reader.readArray(reader1 -> reader1.getString()); + deserializedEnrichmentDomainWhoisDetails.nameServers = nameServers; + } else if ("statuses".equals(fieldName)) { + List statuses = reader.readArray(reader1 -> reader1.getString()); + deserializedEnrichmentDomainWhoisDetails.statuses = statuses; + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentDomainWhoisDetails; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisRegistrarDetails.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisRegistrarDetails.java new file mode 100644 index 000000000000..c51a06dd5b2d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentDomainWhoisRegistrarDetails.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The registrar associated with this domain. + */ +@Fluent +public final class EnrichmentDomainWhoisRegistrarDetails + implements JsonSerializable { + /* + * The name of this registrar + */ + private String name; + + /* + * This registrar's abuse contact email + */ + private String abuseContactEmail; + + /* + * This registrar's abuse contact phone number + */ + private String abuseContactPhone; + + /* + * This registrar's Internet Assigned Numbers Authority id + */ + private String ianaId; + + /* + * This registrar's URL + */ + private String url; + + /* + * The hostname of this registrar's whois server + */ + private String whoisServer; + + /** + * Creates an instance of EnrichmentDomainWhoisRegistrarDetails class. + */ + public EnrichmentDomainWhoisRegistrarDetails() { + } + + /** + * Get the name property: The name of this registrar. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of this registrar. + * + * @param name the name value to set. + * @return the EnrichmentDomainWhoisRegistrarDetails object itself. + */ + public EnrichmentDomainWhoisRegistrarDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get the abuseContactEmail property: This registrar's abuse contact email. + * + * @return the abuseContactEmail value. + */ + public String abuseContactEmail() { + return this.abuseContactEmail; + } + + /** + * Set the abuseContactEmail property: This registrar's abuse contact email. + * + * @param abuseContactEmail the abuseContactEmail value to set. + * @return the EnrichmentDomainWhoisRegistrarDetails object itself. + */ + public EnrichmentDomainWhoisRegistrarDetails withAbuseContactEmail(String abuseContactEmail) { + this.abuseContactEmail = abuseContactEmail; + return this; + } + + /** + * Get the abuseContactPhone property: This registrar's abuse contact phone number. + * + * @return the abuseContactPhone value. + */ + public String abuseContactPhone() { + return this.abuseContactPhone; + } + + /** + * Set the abuseContactPhone property: This registrar's abuse contact phone number. + * + * @param abuseContactPhone the abuseContactPhone value to set. + * @return the EnrichmentDomainWhoisRegistrarDetails object itself. + */ + public EnrichmentDomainWhoisRegistrarDetails withAbuseContactPhone(String abuseContactPhone) { + this.abuseContactPhone = abuseContactPhone; + return this; + } + + /** + * Get the ianaId property: This registrar's Internet Assigned Numbers Authority id. + * + * @return the ianaId value. + */ + public String ianaId() { + return this.ianaId; + } + + /** + * Set the ianaId property: This registrar's Internet Assigned Numbers Authority id. + * + * @param ianaId the ianaId value to set. + * @return the EnrichmentDomainWhoisRegistrarDetails object itself. + */ + public EnrichmentDomainWhoisRegistrarDetails withIanaId(String ianaId) { + this.ianaId = ianaId; + return this; + } + + /** + * Get the url property: This registrar's URL. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: This registrar's URL. + * + * @param url the url value to set. + * @return the EnrichmentDomainWhoisRegistrarDetails object itself. + */ + public EnrichmentDomainWhoisRegistrarDetails withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the whoisServer property: The hostname of this registrar's whois server. + * + * @return the whoisServer value. + */ + public String whoisServer() { + return this.whoisServer; + } + + /** + * Set the whoisServer property: The hostname of this registrar's whois server. + * + * @param whoisServer the whoisServer value to set. + * @return the EnrichmentDomainWhoisRegistrarDetails object itself. + */ + public EnrichmentDomainWhoisRegistrarDetails withWhoisServer(String whoisServer) { + this.whoisServer = whoisServer; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("abuseContactEmail", this.abuseContactEmail); + jsonWriter.writeStringField("abuseContactPhone", this.abuseContactPhone); + jsonWriter.writeStringField("ianaId", this.ianaId); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("whoisServer", this.whoisServer); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentDomainWhoisRegistrarDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentDomainWhoisRegistrarDetails if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentDomainWhoisRegistrarDetails. + */ + public static EnrichmentDomainWhoisRegistrarDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentDomainWhoisRegistrarDetails deserializedEnrichmentDomainWhoisRegistrarDetails + = new EnrichmentDomainWhoisRegistrarDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEnrichmentDomainWhoisRegistrarDetails.name = reader.getString(); + } else if ("abuseContactEmail".equals(fieldName)) { + deserializedEnrichmentDomainWhoisRegistrarDetails.abuseContactEmail = reader.getString(); + } else if ("abuseContactPhone".equals(fieldName)) { + deserializedEnrichmentDomainWhoisRegistrarDetails.abuseContactPhone = reader.getString(); + } else if ("ianaId".equals(fieldName)) { + deserializedEnrichmentDomainWhoisRegistrarDetails.ianaId = reader.getString(); + } else if ("url".equals(fieldName)) { + deserializedEnrichmentDomainWhoisRegistrarDetails.url = reader.getString(); + } else if ("whoisServer".equals(fieldName)) { + deserializedEnrichmentDomainWhoisRegistrarDetails.whoisServer = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentDomainWhoisRegistrarDetails; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentIpAddressBody.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentIpAddressBody.java new file mode 100644 index 000000000000..b7f81404ad61 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentIpAddressBody.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * IP address (v4 or v6) to be enriched. + */ +@Fluent +public final class EnrichmentIpAddressBody implements JsonSerializable { + /* + * The dotted-decimal or colon-separated string representation of the IP address + */ + private String ipAddress; + + /** + * Creates an instance of EnrichmentIpAddressBody class. + */ + public EnrichmentIpAddressBody() { + } + + /** + * Get the ipAddress property: The dotted-decimal or colon-separated string representation of the IP address. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: The dotted-decimal or colon-separated string representation of the IP address. + * + * @param ipAddress the ipAddress value to set. + * @return the EnrichmentIpAddressBody object itself. + */ + public EnrichmentIpAddressBody withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipAddress", this.ipAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnrichmentIpAddressBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnrichmentIpAddressBody if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnrichmentIpAddressBody. + */ + public static EnrichmentIpAddressBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnrichmentIpAddressBody deserializedEnrichmentIpAddressBody = new EnrichmentIpAddressBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipAddress".equals(fieldName)) { + deserializedEnrichmentIpAddressBody.ipAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnrichmentIpAddressBody; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentIpGeodata.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentIpGeodata.java new file mode 100644 index 000000000000..47571be08f16 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentIpGeodata.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentIpGeodataInner; + +/** + * An immutable client-side representation of EnrichmentIpGeodata. + */ +public interface EnrichmentIpGeodata { + /** + * Gets the asn property: The autonomous system number associated with this IP address. + * + * @return the asn value. + */ + String asn(); + + /** + * Gets the carrier property: The name of the carrier for this IP address. + * + * @return the carrier value. + */ + String carrier(); + + /** + * Gets the city property: The city this IP address is located in. + * + * @return the city value. + */ + String city(); + + /** + * Gets the cityConfidenceFactor property: A numeric rating of confidence that the value in the 'city' field is + * correct, on a scale of 0-100. + * + * @return the cityConfidenceFactor value. + */ + Integer cityConfidenceFactor(); + + /** + * Gets the continent property: The continent this IP address is located on. + * + * @return the continent value. + */ + String continent(); + + /** + * Gets the country property: The county this IP address is located in. + * + * @return the country value. + */ + String country(); + + /** + * Gets the countryConfidenceFactor property: A numeric rating of confidence that the value in the 'country' field + * is correct on a scale of 0-100. + * + * @return the countryConfidenceFactor value. + */ + Integer countryConfidenceFactor(); + + /** + * Gets the ipAddr property: The dotted-decimal or colon-separated string representation of the IP address. + * + * @return the ipAddr value. + */ + String ipAddr(); + + /** + * Gets the ipRoutingType property: A description of the connection type of this IP address. + * + * @return the ipRoutingType value. + */ + String ipRoutingType(); + + /** + * Gets the latitude property: The latitude of this IP address. + * + * @return the latitude value. + */ + String latitude(); + + /** + * Gets the longitude property: The longitude of this IP address. + * + * @return the longitude value. + */ + String longitude(); + + /** + * Gets the organization property: The name of the organization for this IP address. + * + * @return the organization value. + */ + String organization(); + + /** + * Gets the organizationType property: The type of the organization for this IP address. + * + * @return the organizationType value. + */ + String organizationType(); + + /** + * Gets the region property: The geographic region this IP address is located in. + * + * @return the region value. + */ + String region(); + + /** + * Gets the state property: The state this IP address is located in. + * + * @return the state value. + */ + String state(); + + /** + * Gets the stateConfidenceFactor property: A numeric rating of confidence that the value in the 'state' field is + * correct on a scale of 0-100. + * + * @return the stateConfidenceFactor value. + */ + Integer stateConfidenceFactor(); + + /** + * Gets the stateCode property: The abbreviated name for the state this IP address is located in. + * + * @return the stateCode value. + */ + String stateCode(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EnrichmentIpGeodataInner object. + * + * @return the inner object. + */ + EnrichmentIpGeodataInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentType.java new file mode 100644 index 000000000000..72a8249650ef --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EnrichmentType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for EnrichmentType. + */ +public final class EnrichmentType extends ExpandableStringEnum { + /** + * Static value main for EnrichmentType. + */ + public static final EnrichmentType MAIN = fromString("main"); + + /** + * Creates a new instance of EnrichmentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnrichmentType() { + } + + /** + * Creates or finds a EnrichmentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnrichmentType. + */ + public static EnrichmentType fromString(String name) { + return fromString(name, EnrichmentType.class); + } + + /** + * Gets known EnrichmentType values. + * + * @return known EnrichmentType values. + */ + public static Collection values() { + return values(EnrichmentType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Entities.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Entities.java new file mode 100644 index 000000000000..6749fcce50be --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Entities.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Entities. + */ +public interface Entities { + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @param requestBody Describes the request body for triggering a playbook on an entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, String entityIdentifier, + EntityManualTriggerRequestBody requestBody, Context context); + + /** + * Triggers playbook on a specific entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityIdentifier Entity identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void runPlaybook(String resourceGroupName, String workspaceName, String entityIdentifier); + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all entities. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String entityId, Context context); + + /** + * Gets an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity. + */ + Entity get(String resourceGroupName, String workspaceName, String entityId); + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response along with {@link Response}. + */ + Response expandWithResponse(String resourceGroupName, String workspaceName, String entityId, + EntityExpandParameters parameters, Context context); + + /** + * Expands an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an expand operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity expansion result operation response. + */ + EntityExpandResponse expand(String resourceGroupName, String workspaceName, String entityId, + EntityExpandParameters parameters); + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedIterable}. + */ + PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind); + + /** + * Get Insights and Activities for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param kind The Kind parameter for queries. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insights and Activities for an entity as paginated response with {@link PagedIterable}. + */ + PagedIterable queries(String resourceGroupName, String workspaceName, String entityId, + EntityItemQueryKind kind, Context context); + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response along with {@link Response}. + */ + Response getInsightsWithResponse(String resourceGroupName, String workspaceName, + String entityId, EntityGetInsightsParameters parameters, Context context); + + /** + * Execute Insights for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute insights on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Get Insights result operation response. + */ + EntityGetInsightsResponse getInsights(String resourceGroupName, String workspaceName, String entityId, + EntityGetInsightsParameters parameters); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntitiesGetTimelines.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntitiesGetTimelines.java new file mode 100644 index 000000000000..50b0ceb759d0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntitiesGetTimelines.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of EntitiesGetTimelines. + */ +public interface EntitiesGetTimelines { + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response along with {@link Response}. + */ + Response listWithResponse(String resourceGroupName, String workspaceName, String entityId, + EntityTimelineParameters parameters, Context context); + + /** + * Timeline for an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param parameters The parameters required to execute an timeline operation on the given entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the entity timeline result operation response. + */ + EntityTimelineResponse list(String resourceGroupName, String workspaceName, String entityId, + EntityTimelineParameters parameters); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntitiesRelations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntitiesRelations.java new file mode 100644 index 000000000000..2a79559f39e5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntitiesRelations.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of EntitiesRelations. + */ +public interface EntitiesRelations { + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String entityId); + + /** + * Gets all relations of an entity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all relations of an entity as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String entityId, String filter, + String orderby, Integer top, String skipToken, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Entity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Entity.java index d0f6c8170a56..52e84e34e823 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Entity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Entity.java @@ -4,224 +4,52 @@ package com.azure.resourcemanager.securityinsights.models; -import com.azure.core.annotation.Immutable; -import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; /** - * Specific entity. + * An immutable client-side representation of Entity. */ -@Immutable -public class Entity extends ProxyResource { - /* - * The kind of the entity. - */ - private EntityKindEnum kind = EntityKindEnum.fromString("Entity"); - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of Entity class. - */ - public Entity() { - } - - /** - * Get the kind property: The kind of the entity. - * - * @return the kind value. - */ - public EntityKindEnum kind() { - return this.kind; - } - +public interface Entity { /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * Gets the id property: Fully qualified resource Id for the resource. * - * @return the systemData value. + * @return the id value. */ - public SystemData systemData() { - return this.systemData; - } + String id(); /** - * Set the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * Gets the name property: The name of the resource. * - * @param systemData the systemData value to set. - * @return the Entity object itself. + * @return the name value. */ - Entity withSystemData(SystemData systemData) { - this.systemData = systemData; - return this; - } + String name(); /** - * Get the type property: The type of the resource. + * Gets the type property: The type of the resource. * * @return the type value. */ - @Override - public String type() { - return this.type; - } + String type(); /** - * Get the name property: The name of the resource. + * Gets the kind property: The kind of the entity. * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. + * @return the kind value. */ - @Override - public String id() { - return this.id; - } + EntityKindEnum kind(); /** - * Validates the instance. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} + * @return the systemData value. */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } + SystemData systemData(); /** - * Reads an instance of Entity from the JsonReader. + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EntityInner object. * - * @param jsonReader The JsonReader being read. - * @return An instance of Entity if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Entity. + * @return the inner object. */ - public static Entity fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("SecurityAlert".equals(discriminatorValue)) { - return SecurityAlert.fromJson(readerToUse.reset()); - } else if ("Bookmark".equals(discriminatorValue)) { - return HuntingBookmark.fromJson(readerToUse.reset()); - } else if ("Account".equals(discriminatorValue)) { - return AccountEntity.fromJson(readerToUse.reset()); - } else if ("AzureResource".equals(discriminatorValue)) { - return AzureResourceEntity.fromJson(readerToUse.reset()); - } else if ("CloudApplication".equals(discriminatorValue)) { - return CloudApplicationEntity.fromJson(readerToUse.reset()); - } else if ("DnsResolution".equals(discriminatorValue)) { - return DnsEntity.fromJson(readerToUse.reset()); - } else if ("File".equals(discriminatorValue)) { - return FileEntity.fromJson(readerToUse.reset()); - } else if ("FileHash".equals(discriminatorValue)) { - return FileHashEntity.fromJson(readerToUse.reset()); - } else if ("Host".equals(discriminatorValue)) { - return HostEntity.fromJson(readerToUse.reset()); - } else if ("IoTDevice".equals(discriminatorValue)) { - return IoTDeviceEntity.fromJson(readerToUse.reset()); - } else if ("Ip".equals(discriminatorValue)) { - return IpEntity.fromJson(readerToUse.reset()); - } else if ("Mailbox".equals(discriminatorValue)) { - return MailboxEntity.fromJson(readerToUse.reset()); - } else if ("MailCluster".equals(discriminatorValue)) { - return MailClusterEntity.fromJson(readerToUse.reset()); - } else if ("MailMessage".equals(discriminatorValue)) { - return MailMessageEntity.fromJson(readerToUse.reset()); - } else if ("Malware".equals(discriminatorValue)) { - return MalwareEntity.fromJson(readerToUse.reset()); - } else if ("Process".equals(discriminatorValue)) { - return ProcessEntity.fromJson(readerToUse.reset()); - } else if ("RegistryKey".equals(discriminatorValue)) { - return RegistryKeyEntity.fromJson(readerToUse.reset()); - } else if ("RegistryValue".equals(discriminatorValue)) { - return RegistryValueEntity.fromJson(readerToUse.reset()); - } else if ("SecurityGroup".equals(discriminatorValue)) { - return SecurityGroupEntity.fromJson(readerToUse.reset()); - } else if ("SubmissionMail".equals(discriminatorValue)) { - return SubmissionMailEntity.fromJson(readerToUse.reset()); - } else if ("Url".equals(discriminatorValue)) { - return UrlEntity.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - static Entity fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Entity deserializedEntity = new Entity(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedEntity.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedEntity.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedEntity.type = reader.getString(); - } else if ("kind".equals(fieldName)) { - deserializedEntity.kind = EntityKindEnum.fromString(reader.getString()); - } else if ("systemData".equals(fieldName)) { - deserializedEntity.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedEntity; - }); - } + EntityInner innerModel(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityAnalytics.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityAnalytics.java new file mode 100644 index 000000000000..fe386636a2ed --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityAnalytics.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityAnalyticsProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import java.io.IOException; +import java.util.List; + +/** + * Settings with single toggle. + */ +@Fluent +public final class EntityAnalytics extends SettingsInner { + /* + * The kind of the setting + */ + private SettingKind kind = SettingKind.ENTITY_ANALYTICS; + + /* + * EntityAnalytics properties + */ + private EntityAnalyticsProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EntityAnalytics class. + */ + public EntityAnalytics() { + } + + /** + * Get the kind property: The kind of the setting. + * + * @return the kind value. + */ + @Override + public SettingKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: EntityAnalytics properties. + * + * @return the innerProperties value. + */ + private EntityAnalyticsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public EntityAnalytics withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the entityProviders property: The relevant entity providers that are synced. + * + * @return the entityProviders value. + */ + public List entityProviders() { + return this.innerProperties() == null ? null : this.innerProperties().entityProviders(); + } + + /** + * Set the entityProviders property: The relevant entity providers that are synced. + * + * @param entityProviders the entityProviders value to set. + * @return the EntityAnalytics object itself. + */ + public EntityAnalytics withEntityProviders(List entityProviders) { + if (this.innerProperties() == null) { + this.innerProperties = new EntityAnalyticsProperties(); + } + this.innerProperties().withEntityProviders(entityProviders); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityAnalytics from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityAnalytics if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityAnalytics. + */ + public static EntityAnalytics fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityAnalytics deserializedEntityAnalytics = new EntityAnalytics(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEntityAnalytics.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEntityAnalytics.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEntityAnalytics.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedEntityAnalytics.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedEntityAnalytics.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedEntityAnalytics.kind = SettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedEntityAnalytics.innerProperties = EntityAnalyticsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityAnalytics; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityEdges.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityEdges.java new file mode 100644 index 000000000000..92d19350049f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityEdges.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The edge that connects the entity to the other entity. + */ +@Fluent +public final class EntityEdges implements JsonSerializable { + /* + * The target entity Id. + */ + private String targetEntityId; + + /* + * A bag of custom fields that should be part of the entity and will be presented to the user. + */ + private Map additionalData; + + /** + * Creates an instance of EntityEdges class. + */ + public EntityEdges() { + } + + /** + * Get the targetEntityId property: The target entity Id. + * + * @return the targetEntityId value. + */ + public String targetEntityId() { + return this.targetEntityId; + } + + /** + * Set the targetEntityId property: The target entity Id. + * + * @param targetEntityId the targetEntityId value to set. + * @return the EntityEdges object itself. + */ + public EntityEdges withTargetEntityId(String targetEntityId) { + this.targetEntityId = targetEntityId; + return this; + } + + /** + * Get the additionalData property: A bag of custom fields that should be part of the entity and will be presented + * to the user. + * + * @return the additionalData value. + */ + public Map additionalData() { + return this.additionalData; + } + + /** + * Set the additionalData property: A bag of custom fields that should be part of the entity and will be presented + * to the user. + * + * @param additionalData the additionalData value to set. + * @return the EntityEdges object itself. + */ + public EntityEdges withAdditionalData(Map additionalData) { + this.additionalData = additionalData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetEntityId", this.targetEntityId); + jsonWriter.writeMapField("additionalData", this.additionalData, + (writer, element) -> writer.writeUntyped(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityEdges from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityEdges if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityEdges. + */ + public static EntityEdges fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityEdges deserializedEntityEdges = new EntityEdges(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetEntityId".equals(fieldName)) { + deserializedEntityEdges.targetEntityId = reader.getString(); + } else if ("additionalData".equals(fieldName)) { + Map additionalData = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedEntityEdges.additionalData = additionalData; + } else { + reader.skipChildren(); + } + } + + return deserializedEntityEdges; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandParameters.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandParameters.java new file mode 100644 index 000000000000..07af093ecaff --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandParameters.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; +import java.util.UUID; + +/** + * The parameters required to execute an expand operation on the given entity. + */ +@Fluent +public final class EntityExpandParameters implements JsonSerializable { + /* + * The end date filter, so the only expansion results returned are before this date. + */ + private OffsetDateTime endTime; + + /* + * The Id of the expansion to perform. + */ + private UUID expansionId; + + /* + * The start date filter, so the only expansion results returned are after this date. + */ + private OffsetDateTime startTime; + + /** + * Creates an instance of EntityExpandParameters class. + */ + public EntityExpandParameters() { + } + + /** + * Get the endTime property: The end date filter, so the only expansion results returned are before this date. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end date filter, so the only expansion results returned are before this date. + * + * @param endTime the endTime value to set. + * @return the EntityExpandParameters object itself. + */ + public EntityExpandParameters withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the expansionId property: The Id of the expansion to perform. + * + * @return the expansionId value. + */ + public UUID expansionId() { + return this.expansionId; + } + + /** + * Set the expansionId property: The Id of the expansion to perform. + * + * @param expansionId the expansionId value to set. + * @return the EntityExpandParameters object itself. + */ + public EntityExpandParameters withExpansionId(UUID expansionId) { + this.expansionId = expansionId; + return this; + } + + /** + * Get the startTime property: The start date filter, so the only expansion results returned are after this date. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start date filter, so the only expansion results returned are after this date. + * + * @param startTime the startTime value to set. + * @return the EntityExpandParameters object itself. + */ + public EntityExpandParameters withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("expansionId", Objects.toString(this.expansionId, null)); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityExpandParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityExpandParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityExpandParameters. + */ + public static EntityExpandParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityExpandParameters deserializedEntityExpandParameters = new EntityExpandParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endTime".equals(fieldName)) { + deserializedEntityExpandParameters.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expansionId".equals(fieldName)) { + deserializedEntityExpandParameters.expansionId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("startTime".equals(fieldName)) { + deserializedEntityExpandParameters.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityExpandParameters; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandResponse.java new file mode 100644 index 000000000000..4d0e179b191e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandResponse.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityExpandResponseInner; + +/** + * An immutable client-side representation of EntityExpandResponse. + */ +public interface EntityExpandResponse { + /** + * Gets the metadata property: The metadata from the expansion operation results. + * + * @return the metadata value. + */ + ExpansionResultsMetadata metadata(); + + /** + * Gets the value property: The expansion result values. + * + * @return the value value. + */ + EntityExpandResponseValue value(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EntityExpandResponseInner object. + * + * @return the inner object. + */ + EntityExpandResponseInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandResponseValue.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandResponseValue.java new file mode 100644 index 000000000000..7e274687a64b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityExpandResponseValue.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import java.io.IOException; +import java.util.List; + +/** + * The expansion result values. + */ +@Fluent +public final class EntityExpandResponseValue implements JsonSerializable { + /* + * Array of the expansion result entities. + */ + private List entities; + + /* + * Array of edges that connects the entity to the list of entities. + */ + private List edges; + + /** + * Creates an instance of EntityExpandResponseValue class. + */ + public EntityExpandResponseValue() { + } + + /** + * Get the entities property: Array of the expansion result entities. + * + * @return the entities value. + */ + public List entities() { + return this.entities; + } + + /** + * Set the entities property: Array of the expansion result entities. + * + * @param entities the entities value to set. + * @return the EntityExpandResponseValue object itself. + */ + public EntityExpandResponseValue withEntities(List entities) { + this.entities = entities; + return this; + } + + /** + * Get the edges property: Array of edges that connects the entity to the list of entities. + * + * @return the edges value. + */ + public List edges() { + return this.edges; + } + + /** + * Set the edges property: Array of edges that connects the entity to the list of entities. + * + * @param edges the edges value to set. + * @return the EntityExpandResponseValue object itself. + */ + public EntityExpandResponseValue withEdges(List edges) { + this.edges = edges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (entities() != null) { + entities().forEach(e -> e.validate()); + } + if (edges() != null) { + edges().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("entities", this.entities, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("edges", this.edges, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityExpandResponseValue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityExpandResponseValue if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityExpandResponseValue. + */ + public static EntityExpandResponseValue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityExpandResponseValue deserializedEntityExpandResponseValue = new EntityExpandResponseValue(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("entities".equals(fieldName)) { + List entities = reader.readArray(reader1 -> EntityInner.fromJson(reader1)); + deserializedEntityExpandResponseValue.entities = entities; + } else if ("edges".equals(fieldName)) { + List edges = reader.readArray(reader1 -> EntityEdges.fromJson(reader1)); + deserializedEntityExpandResponseValue.edges = edges; + } else { + reader.skipChildren(); + } + } + + return deserializedEntityExpandResponseValue; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityFieldMapping.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityFieldMapping.java new file mode 100644 index 000000000000..abd0d519ffc6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityFieldMapping.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Map identifiers of a single entity. + */ +@Fluent +public final class EntityFieldMapping implements JsonSerializable { + /* + * Alert V3 identifier + */ + private String identifier; + + /* + * The value of the identifier + */ + private String value; + + /** + * Creates an instance of EntityFieldMapping class. + */ + public EntityFieldMapping() { + } + + /** + * Get the identifier property: Alert V3 identifier. + * + * @return the identifier value. + */ + public String identifier() { + return this.identifier; + } + + /** + * Set the identifier property: Alert V3 identifier. + * + * @param identifier the identifier value to set. + * @return the EntityFieldMapping object itself. + */ + public EntityFieldMapping withIdentifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get the value property: The value of the identifier. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the identifier. + * + * @param value the value value to set. + * @return the EntityFieldMapping object itself. + */ + public EntityFieldMapping withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("identifier", this.identifier); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityFieldMapping from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityFieldMapping if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityFieldMapping. + */ + public static EntityFieldMapping fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityFieldMapping deserializedEntityFieldMapping = new EntityFieldMapping(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identifier".equals(fieldName)) { + deserializedEntityFieldMapping.identifier = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedEntityFieldMapping.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityFieldMapping; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityGetInsightsParameters.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityGetInsightsParameters.java new file mode 100644 index 000000000000..79a4b72cc0c3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityGetInsightsParameters.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * The parameters required to execute insights operation on the given entity. + */ +@Fluent +public final class EntityGetInsightsParameters implements JsonSerializable { + /* + * The start timeline date, so the results returned are after this date. + */ + private OffsetDateTime startTime; + + /* + * The end timeline date, so the results returned are before this date. + */ + private OffsetDateTime endTime; + + /* + * Indicates if query time range should be extended with default time range of the query. Default value is false + */ + private Boolean addDefaultExtendedTimeRange; + + /* + * List of Insights Query Id. If empty, default value is all insights of this entity + */ + private List insightQueryIds; + + /** + * Creates an instance of EntityGetInsightsParameters class. + */ + public EntityGetInsightsParameters() { + } + + /** + * Get the startTime property: The start timeline date, so the results returned are after this date. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start timeline date, so the results returned are after this date. + * + * @param startTime the startTime value to set. + * @return the EntityGetInsightsParameters object itself. + */ + public EntityGetInsightsParameters withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end timeline date, so the results returned are before this date. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end timeline date, so the results returned are before this date. + * + * @param endTime the endTime value to set. + * @return the EntityGetInsightsParameters object itself. + */ + public EntityGetInsightsParameters withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the addDefaultExtendedTimeRange property: Indicates if query time range should be extended with default time + * range of the query. Default value is false. + * + * @return the addDefaultExtendedTimeRange value. + */ + public Boolean addDefaultExtendedTimeRange() { + return this.addDefaultExtendedTimeRange; + } + + /** + * Set the addDefaultExtendedTimeRange property: Indicates if query time range should be extended with default time + * range of the query. Default value is false. + * + * @param addDefaultExtendedTimeRange the addDefaultExtendedTimeRange value to set. + * @return the EntityGetInsightsParameters object itself. + */ + public EntityGetInsightsParameters withAddDefaultExtendedTimeRange(Boolean addDefaultExtendedTimeRange) { + this.addDefaultExtendedTimeRange = addDefaultExtendedTimeRange; + return this; + } + + /** + * Get the insightQueryIds property: List of Insights Query Id. If empty, default value is all insights of this + * entity. + * + * @return the insightQueryIds value. + */ + public List insightQueryIds() { + return this.insightQueryIds; + } + + /** + * Set the insightQueryIds property: List of Insights Query Id. If empty, default value is all insights of this + * entity. + * + * @param insightQueryIds the insightQueryIds value to set. + * @return the EntityGetInsightsParameters object itself. + */ + public EntityGetInsightsParameters withInsightQueryIds(List insightQueryIds) { + this.insightQueryIds = insightQueryIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startTime() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startTime in model EntityGetInsightsParameters")); + } + if (endTime() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endTime in model EntityGetInsightsParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EntityGetInsightsParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeBooleanField("addDefaultExtendedTimeRange", this.addDefaultExtendedTimeRange); + jsonWriter.writeArrayField("insightQueryIds", this.insightQueryIds, + (writer, element) -> writer.writeString(Objects.toString(element, null))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityGetInsightsParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityGetInsightsParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityGetInsightsParameters. + */ + public static EntityGetInsightsParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityGetInsightsParameters deserializedEntityGetInsightsParameters = new EntityGetInsightsParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedEntityGetInsightsParameters.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedEntityGetInsightsParameters.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("addDefaultExtendedTimeRange".equals(fieldName)) { + deserializedEntityGetInsightsParameters.addDefaultExtendedTimeRange + = reader.getNullable(JsonReader::getBoolean); + } else if ("insightQueryIds".equals(fieldName)) { + List insightQueryIds = reader.readArray( + reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()))); + deserializedEntityGetInsightsParameters.insightQueryIds = insightQueryIds; + } else { + reader.skipChildren(); + } + } + + return deserializedEntityGetInsightsParameters; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityGetInsightsResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityGetInsightsResponse.java new file mode 100644 index 000000000000..c5ff4552d4c9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityGetInsightsResponse.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityGetInsightsResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of EntityGetInsightsResponse. + */ +public interface EntityGetInsightsResponse { + /** + * Gets the metadata property: The metadata from the get insights operation results. + * + * @return the metadata value. + */ + GetInsightsResultsMetadata metadata(); + + /** + * Gets the value property: The insights result values. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EntityGetInsightsResponseInner object. + * + * @return the inner object. + */ + EntityGetInsightsResponseInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityInsightItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityInsightItem.java new file mode 100644 index 000000000000..ba1927bba2f5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityInsightItem.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Entity insight Item. + */ +@Fluent +public final class EntityInsightItem implements JsonSerializable { + /* + * The query id of the insight + */ + private String queryId; + + /* + * The Time interval that the query actually executed on. + */ + private EntityInsightItemQueryTimeInterval queryTimeInterval; + + /* + * Query results for table insights query. + */ + private InsightsTableResult tableQueryResults; + + /* + * Query results for table insights query. + */ + private List chartQueryResults; + + /** + * Creates an instance of EntityInsightItem class. + */ + public EntityInsightItem() { + } + + /** + * Get the queryId property: The query id of the insight. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: The query id of the insight. + * + * @param queryId the queryId value to set. + * @return the EntityInsightItem object itself. + */ + public EntityInsightItem withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the queryTimeInterval property: The Time interval that the query actually executed on. + * + * @return the queryTimeInterval value. + */ + public EntityInsightItemQueryTimeInterval queryTimeInterval() { + return this.queryTimeInterval; + } + + /** + * Set the queryTimeInterval property: The Time interval that the query actually executed on. + * + * @param queryTimeInterval the queryTimeInterval value to set. + * @return the EntityInsightItem object itself. + */ + public EntityInsightItem withQueryTimeInterval(EntityInsightItemQueryTimeInterval queryTimeInterval) { + this.queryTimeInterval = queryTimeInterval; + return this; + } + + /** + * Get the tableQueryResults property: Query results for table insights query. + * + * @return the tableQueryResults value. + */ + public InsightsTableResult tableQueryResults() { + return this.tableQueryResults; + } + + /** + * Set the tableQueryResults property: Query results for table insights query. + * + * @param tableQueryResults the tableQueryResults value to set. + * @return the EntityInsightItem object itself. + */ + public EntityInsightItem withTableQueryResults(InsightsTableResult tableQueryResults) { + this.tableQueryResults = tableQueryResults; + return this; + } + + /** + * Get the chartQueryResults property: Query results for table insights query. + * + * @return the chartQueryResults value. + */ + public List chartQueryResults() { + return this.chartQueryResults; + } + + /** + * Set the chartQueryResults property: Query results for table insights query. + * + * @param chartQueryResults the chartQueryResults value to set. + * @return the EntityInsightItem object itself. + */ + public EntityInsightItem withChartQueryResults(List chartQueryResults) { + this.chartQueryResults = chartQueryResults; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queryTimeInterval() != null) { + queryTimeInterval().validate(); + } + if (tableQueryResults() != null) { + tableQueryResults().validate(); + } + if (chartQueryResults() != null) { + chartQueryResults().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("queryId", this.queryId); + jsonWriter.writeJsonField("queryTimeInterval", this.queryTimeInterval); + jsonWriter.writeJsonField("tableQueryResults", this.tableQueryResults); + jsonWriter.writeArrayField("chartQueryResults", this.chartQueryResults, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityInsightItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityInsightItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityInsightItem. + */ + public static EntityInsightItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityInsightItem deserializedEntityInsightItem = new EntityInsightItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("queryId".equals(fieldName)) { + deserializedEntityInsightItem.queryId = reader.getString(); + } else if ("queryTimeInterval".equals(fieldName)) { + deserializedEntityInsightItem.queryTimeInterval + = EntityInsightItemQueryTimeInterval.fromJson(reader); + } else if ("tableQueryResults".equals(fieldName)) { + deserializedEntityInsightItem.tableQueryResults = InsightsTableResult.fromJson(reader); + } else if ("chartQueryResults".equals(fieldName)) { + List chartQueryResults + = reader.readArray(reader1 -> InsightsTableResult.fromJson(reader1)); + deserializedEntityInsightItem.chartQueryResults = chartQueryResults; + } else { + reader.skipChildren(); + } + } + + return deserializedEntityInsightItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityInsightItemQueryTimeInterval.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityInsightItemQueryTimeInterval.java new file mode 100644 index 000000000000..589e08b53611 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityInsightItemQueryTimeInterval.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The Time interval that the query actually executed on. + */ +@Fluent +public final class EntityInsightItemQueryTimeInterval implements JsonSerializable { + /* + * Insight query start time + */ + private OffsetDateTime startTime; + + /* + * Insight query end time + */ + private OffsetDateTime endTime; + + /** + * Creates an instance of EntityInsightItemQueryTimeInterval class. + */ + public EntityInsightItemQueryTimeInterval() { + } + + /** + * Get the startTime property: Insight query start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Insight query start time. + * + * @param startTime the startTime value to set. + * @return the EntityInsightItemQueryTimeInterval object itself. + */ + public EntityInsightItemQueryTimeInterval withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Insight query end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Insight query end time. + * + * @param endTime the endTime value to set. + * @return the EntityInsightItemQueryTimeInterval object itself. + */ + public EntityInsightItemQueryTimeInterval withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityInsightItemQueryTimeInterval from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityInsightItemQueryTimeInterval if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityInsightItemQueryTimeInterval. + */ + public static EntityInsightItemQueryTimeInterval fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityInsightItemQueryTimeInterval deserializedEntityInsightItemQueryTimeInterval + = new EntityInsightItemQueryTimeInterval(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedEntityInsightItemQueryTimeInterval.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedEntityInsightItemQueryTimeInterval.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityInsightItemQueryTimeInterval; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityItemQueryKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityItemQueryKind.java new file mode 100644 index 000000000000..a80838cf45a4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityItemQueryKind.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for EntityItemQueryKind. + */ +public final class EntityItemQueryKind extends ExpandableStringEnum { + /** + * Static value Insight for EntityItemQueryKind. + */ + public static final EntityItemQueryKind INSIGHT = fromString("Insight"); + + /** + * Creates a new instance of EntityItemQueryKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityItemQueryKind() { + } + + /** + * Creates or finds a EntityItemQueryKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityItemQueryKind. + */ + public static EntityItemQueryKind fromString(String name) { + return fromString(name, EntityItemQueryKind.class); + } + + /** + * Gets known EntityItemQueryKind values. + * + * @return known EntityItemQueryKind values. + */ + public static Collection values() { + return values(EntityItemQueryKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityKindEnum.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityKindEnum.java index bbad26b71fba..7b7bdada825c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityKindEnum.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityKindEnum.java @@ -116,6 +116,11 @@ public final class EntityKindEnum extends ExpandableStringEnum { */ public static final EntityKindEnum SUBMISSION_MAIL = fromString("SubmissionMail"); + /** + * Static value Nic for EntityKindEnum. + */ + public static final EntityKindEnum NIC = fromString("Nic"); + /** * Creates a new instance of EntityKindEnum value. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityList.java new file mode 100644 index 000000000000..b69e236661e3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the entities. + */ +@Fluent +public final class EntityList implements JsonSerializable { + /* + * URL to fetch the next set of entities. + */ + private String nextLink; + + /* + * Array of entities. + */ + private List value; + + /** + * Creates an instance of EntityList class. + */ + public EntityList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of entities. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of entities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of entities. + * + * @param value the value value to set. + * @return the EntityList object itself. + */ + public EntityList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model EntityList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EntityList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityList if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityList. + */ + public static EntityList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityList deserializedEntityList = new EntityList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> EntityInner.fromJson(reader1)); + deserializedEntityList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEntityList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityManualTriggerRequestBody.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityManualTriggerRequestBody.java new file mode 100644 index 000000000000..b334bf62c465 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityManualTriggerRequestBody.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; +import java.util.UUID; + +/** + * Describes the request body for triggering a playbook on an entity. + */ +@Fluent +public final class EntityManualTriggerRequestBody implements JsonSerializable { + /* + * Incident ARM id. + */ + private String incidentArmId; + + /* + * The tenant id of the playbook resource. + */ + private UUID tenantId; + + /* + * The resource id of the playbook resource. + */ + private String logicAppsResourceId; + + /** + * Creates an instance of EntityManualTriggerRequestBody class. + */ + public EntityManualTriggerRequestBody() { + } + + /** + * Get the incidentArmId property: Incident ARM id. + * + * @return the incidentArmId value. + */ + public String incidentArmId() { + return this.incidentArmId; + } + + /** + * Set the incidentArmId property: Incident ARM id. + * + * @param incidentArmId the incidentArmId value to set. + * @return the EntityManualTriggerRequestBody object itself. + */ + public EntityManualTriggerRequestBody withIncidentArmId(String incidentArmId) { + this.incidentArmId = incidentArmId; + return this; + } + + /** + * Get the tenantId property: The tenant id of the playbook resource. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenant id of the playbook resource. + * + * @param tenantId the tenantId value to set. + * @return the EntityManualTriggerRequestBody object itself. + */ + public EntityManualTriggerRequestBody withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the logicAppsResourceId property: The resource id of the playbook resource. + * + * @return the logicAppsResourceId value. + */ + public String logicAppsResourceId() { + return this.logicAppsResourceId; + } + + /** + * Set the logicAppsResourceId property: The resource id of the playbook resource. + * + * @param logicAppsResourceId the logicAppsResourceId value to set. + * @return the EntityManualTriggerRequestBody object itself. + */ + public EntityManualTriggerRequestBody withLogicAppsResourceId(String logicAppsResourceId) { + this.logicAppsResourceId = logicAppsResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logicAppsResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logicAppsResourceId in model EntityManualTriggerRequestBody")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EntityManualTriggerRequestBody.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("logicAppsResourceId", this.logicAppsResourceId); + jsonWriter.writeStringField("incidentArmId", this.incidentArmId); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityManualTriggerRequestBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityManualTriggerRequestBody if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityManualTriggerRequestBody. + */ + public static EntityManualTriggerRequestBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityManualTriggerRequestBody deserializedEntityManualTriggerRequestBody + = new EntityManualTriggerRequestBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logicAppsResourceId".equals(fieldName)) { + deserializedEntityManualTriggerRequestBody.logicAppsResourceId = reader.getString(); + } else if ("incidentArmId".equals(fieldName)) { + deserializedEntityManualTriggerRequestBody.incidentArmId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedEntityManualTriggerRequestBody.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityManualTriggerRequestBody; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityProviders.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityProviders.java new file mode 100644 index 000000000000..99c9a5fc8250 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityProviders.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The entity provider that is synced. + */ +public final class EntityProviders extends ExpandableStringEnum { + /** + * Static value ActiveDirectory for EntityProviders. + */ + public static final EntityProviders ACTIVE_DIRECTORY = fromString("ActiveDirectory"); + + /** + * Static value AzureActiveDirectory for EntityProviders. + */ + public static final EntityProviders AZURE_ACTIVE_DIRECTORY = fromString("AzureActiveDirectory"); + + /** + * Creates a new instance of EntityProviders value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityProviders() { + } + + /** + * Creates or finds a EntityProviders from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityProviders. + */ + public static EntityProviders fromString(String name) { + return fromString(name, EntityProviders.class); + } + + /** + * Gets known EntityProviders values. + * + * @return known EntityProviders values. + */ + public static Collection values() { + return values(EntityProviders.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueries.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueries.java new file mode 100644 index 000000000000..808ed361d9af --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueries.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of EntityQueries. + */ +public interface EntityQueries { + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all entity queries. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity queries as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, EntityQueryTemplateKind kind, + Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String entityQueryId, + Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query. + */ + EntityQuery get(String resourceGroupName, String workspaceName, String entityQueryId); + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query along with {@link Response}. + */ + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String entityQueryId, CustomEntityQuery entityQuery, Context context); + + /** + * Creates or updates the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param entityQuery The entity query we want to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific entity query. + */ + EntityQuery createOrUpdate(String resourceGroupName, String workspaceName, String entityQueryId, + CustomEntityQuery entityQuery); + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String entityQueryId, + Context context); + + /** + * Delete the entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryId entity query ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String entityQueryId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQuery.java new file mode 100644 index 000000000000..ab477e271b05 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQuery.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; + +/** + * An immutable client-side representation of EntityQuery. + */ +public interface EntityQuery { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the kind property: the entity query kind. + * + * @return the kind value. + */ + EntityQueryKind kind(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner object. + * + * @return the inner object. + */ + EntityQueryInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItem.java new file mode 100644 index 000000000000..af47a7fb89e8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItem.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner; + +/** + * An immutable client-side representation of EntityQueryItem. + */ +public interface EntityQueryItem { + /** + * Gets the kind property: The kind of the entity query. + * + * @return the kind value. + */ + EntityQueryKind kind(); + + /** + * Gets the id property: Query Template ARM ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Query Template ARM Name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: ARM Type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner object. + * + * @return the inner object. + */ + EntityQueryItemInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItemProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItemProperties.java new file mode 100644 index 000000000000..75ef2e94333b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItemProperties.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * An properties abstract Query item for entity. + */ +@Fluent +public class EntityQueryItemProperties implements JsonSerializable { + /* + * Data types for template + */ + private List dataTypes; + + /* + * The type of the entity + */ + private EntityType inputEntityType; + + /* + * Data types for template + */ + private List> requiredInputFieldsSets; + + /* + * The query applied only to entities matching to all filters + */ + private Object entitiesFilter; + + /** + * Creates an instance of EntityQueryItemProperties class. + */ + public EntityQueryItemProperties() { + } + + /** + * Get the dataTypes property: Data types for template. + * + * @return the dataTypes value. + */ + public List dataTypes() { + return this.dataTypes; + } + + /** + * Set the dataTypes property: Data types for template. + * + * @param dataTypes the dataTypes value to set. + * @return the EntityQueryItemProperties object itself. + */ + public EntityQueryItemProperties withDataTypes(List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + /** + * Get the inputEntityType property: The type of the entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.inputEntityType; + } + + /** + * Set the inputEntityType property: The type of the entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the EntityQueryItemProperties object itself. + */ + public EntityQueryItemProperties withInputEntityType(EntityType inputEntityType) { + this.inputEntityType = inputEntityType; + return this; + } + + /** + * Get the requiredInputFieldsSets property: Data types for template. + * + * @return the requiredInputFieldsSets value. + */ + public List> requiredInputFieldsSets() { + return this.requiredInputFieldsSets; + } + + /** + * Set the requiredInputFieldsSets property: Data types for template. + * + * @param requiredInputFieldsSets the requiredInputFieldsSets value to set. + * @return the EntityQueryItemProperties object itself. + */ + public EntityQueryItemProperties withRequiredInputFieldsSets(List> requiredInputFieldsSets) { + this.requiredInputFieldsSets = requiredInputFieldsSets; + return this; + } + + /** + * Get the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @return the entitiesFilter value. + */ + public Object entitiesFilter() { + return this.entitiesFilter; + } + + /** + * Set the entitiesFilter property: The query applied only to entities matching to all filters. + * + * @param entitiesFilter the entitiesFilter value to set. + * @return the EntityQueryItemProperties object itself. + */ + public EntityQueryItemProperties withEntitiesFilter(Object entitiesFilter) { + this.entitiesFilter = entitiesFilter; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataTypes() != null) { + dataTypes().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dataTypes", this.dataTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("inputEntityType", + this.inputEntityType == null ? null : this.inputEntityType.toString()); + jsonWriter.writeArrayField("requiredInputFieldsSets", this.requiredInputFieldsSets, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeUntypedField("entitiesFilter", this.entitiesFilter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityQueryItemProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityQueryItemProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityQueryItemProperties. + */ + public static EntityQueryItemProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityQueryItemProperties deserializedEntityQueryItemProperties = new EntityQueryItemProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataTypes".equals(fieldName)) { + List dataTypes + = reader.readArray(reader1 -> EntityQueryItemPropertiesDataTypesItem.fromJson(reader1)); + deserializedEntityQueryItemProperties.dataTypes = dataTypes; + } else if ("inputEntityType".equals(fieldName)) { + deserializedEntityQueryItemProperties.inputEntityType = EntityType.fromString(reader.getString()); + } else if ("requiredInputFieldsSets".equals(fieldName)) { + List> requiredInputFieldsSets + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedEntityQueryItemProperties.requiredInputFieldsSets = requiredInputFieldsSets; + } else if ("entitiesFilter".equals(fieldName)) { + deserializedEntityQueryItemProperties.entitiesFilter = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityQueryItemProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItemPropertiesDataTypesItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItemPropertiesDataTypesItem.java new file mode 100644 index 000000000000..84dedeeac0bb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryItemPropertiesDataTypesItem.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The EntityQueryItemPropertiesDataTypesItem model. + */ +@Fluent +public final class EntityQueryItemPropertiesDataTypesItem + implements JsonSerializable { + /* + * Data type name + */ + private String dataType; + + /** + * Creates an instance of EntityQueryItemPropertiesDataTypesItem class. + */ + public EntityQueryItemPropertiesDataTypesItem() { + } + + /** + * Get the dataType property: Data type name. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Set the dataType property: Data type name. + * + * @param dataType the dataType value to set. + * @return the EntityQueryItemPropertiesDataTypesItem object itself. + */ + public EntityQueryItemPropertiesDataTypesItem withDataType(String dataType) { + this.dataType = dataType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataType", this.dataType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityQueryItemPropertiesDataTypesItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityQueryItemPropertiesDataTypesItem if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityQueryItemPropertiesDataTypesItem. + */ + public static EntityQueryItemPropertiesDataTypesItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityQueryItemPropertiesDataTypesItem deserializedEntityQueryItemPropertiesDataTypesItem + = new EntityQueryItemPropertiesDataTypesItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataType".equals(fieldName)) { + deserializedEntityQueryItemPropertiesDataTypesItem.dataType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityQueryItemPropertiesDataTypesItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryKind.java new file mode 100644 index 000000000000..556c40527102 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryKind.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the entity query. + */ +public final class EntityQueryKind extends ExpandableStringEnum { + /** + * Static value Expansion for EntityQueryKind. + */ + public static final EntityQueryKind EXPANSION = fromString("Expansion"); + + /** + * Static value Insight for EntityQueryKind. + */ + public static final EntityQueryKind INSIGHT = fromString("Insight"); + + /** + * Static value Activity for EntityQueryKind. + */ + public static final EntityQueryKind ACTIVITY = fromString("Activity"); + + /** + * Creates a new instance of EntityQueryKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityQueryKind() { + } + + /** + * Creates or finds a EntityQueryKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityQueryKind. + */ + public static EntityQueryKind fromString(String name) { + return fromString(name, EntityQueryKind.class); + } + + /** + * Gets known EntityQueryKind values. + * + * @return known EntityQueryKind values. + */ + public static Collection values() { + return values(EntityQueryKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryList.java new file mode 100644 index 000000000000..f113d004a764 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the entity queries. + */ +@Fluent +public final class EntityQueryList implements JsonSerializable { + /* + * URL to fetch the next set of entity queries. + */ + private String nextLink; + + /* + * Array of entity queries. + */ + private List value; + + /** + * Creates an instance of EntityQueryList class. + */ + public EntityQueryList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of entity queries. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of entity queries. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of entity queries. + * + * @param value the value value to set. + * @return the EntityQueryList object itself. + */ + public EntityQueryList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model EntityQueryList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EntityQueryList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityQueryList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityQueryList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityQueryList. + */ + public static EntityQueryList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityQueryList deserializedEntityQueryList = new EntityQueryList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> EntityQueryInner.fromJson(reader1)); + deserializedEntityQueryList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEntityQueryList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityQueryList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplate.java new file mode 100644 index 000000000000..59b88e225955 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplate.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner; + +/** + * An immutable client-side representation of EntityQueryTemplate. + */ +public interface EntityQueryTemplate { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: the entity query template kind. + * + * @return the kind value. + */ + EntityQueryTemplateKind kind(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner object. + * + * @return the inner object. + */ + EntityQueryTemplateInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplateKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplateKind.java new file mode 100644 index 000000000000..04f3eba2f46f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplateKind.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for EntityQueryTemplateKind. + */ +public final class EntityQueryTemplateKind extends ExpandableStringEnum { + /** + * Static value Activity for EntityQueryTemplateKind. + */ + public static final EntityQueryTemplateKind ACTIVITY = fromString("Activity"); + + /** + * Static value Insight for EntityQueryTemplateKind. + */ + public static final EntityQueryTemplateKind INSIGHT = fromString("Insight"); + + /** + * Static value SecurityAlert for EntityQueryTemplateKind. + */ + public static final EntityQueryTemplateKind SECURITY_ALERT = fromString("SecurityAlert"); + + /** + * Static value Bookmark for EntityQueryTemplateKind. + */ + public static final EntityQueryTemplateKind BOOKMARK = fromString("Bookmark"); + + /** + * Static value Expansion for EntityQueryTemplateKind. + */ + public static final EntityQueryTemplateKind EXPANSION = fromString("Expansion"); + + /** + * Static value GuidedInsight for EntityQueryTemplateKind. + */ + public static final EntityQueryTemplateKind GUIDED_INSIGHT = fromString("GuidedInsight"); + + /** + * Static value Anomaly for EntityQueryTemplateKind. + */ + public static final EntityQueryTemplateKind ANOMALY = fromString("Anomaly"); + + /** + * Creates a new instance of EntityQueryTemplateKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityQueryTemplateKind() { + } + + /** + * Creates or finds a EntityQueryTemplateKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityQueryTemplateKind. + */ + public static EntityQueryTemplateKind fromString(String name) { + return fromString(name, EntityQueryTemplateKind.class); + } + + /** + * Gets known EntityQueryTemplateKind values. + * + * @return known EntityQueryTemplateKind values. + */ + public static Collection values() { + return values(EntityQueryTemplateKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplateList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplateList.java new file mode 100644 index 000000000000..3ae300ffe5fb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplateList.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryTemplateInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the entity query templates. + */ +@Fluent +public final class EntityQueryTemplateList implements JsonSerializable { + /* + * URL to fetch the next set of entity query templates. + */ + private String nextLink; + + /* + * Array of entity query templates. + */ + private List value; + + /** + * Creates an instance of EntityQueryTemplateList class. + */ + public EntityQueryTemplateList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of entity query templates. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of entity query templates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of entity query templates. + * + * @param value the value value to set. + * @return the EntityQueryTemplateList object itself. + */ + public EntityQueryTemplateList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model EntityQueryTemplateList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EntityQueryTemplateList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityQueryTemplateList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityQueryTemplateList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityQueryTemplateList. + */ + public static EntityQueryTemplateList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityQueryTemplateList deserializedEntityQueryTemplateList = new EntityQueryTemplateList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> EntityQueryTemplateInner.fromJson(reader1)); + deserializedEntityQueryTemplateList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEntityQueryTemplateList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityQueryTemplateList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplates.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplates.java new file mode 100644 index 000000000000..467943c794be --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityQueryTemplates.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of EntityQueryTemplates. + */ +public interface EntityQueryTemplates { + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all entity query templates. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param kind The entity template query kind we want to fetch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all entity query templates as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, + EntityQueryTemplateKind kind, Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String entityQueryTemplateId, Context context); + + /** + * Gets an entity query. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityQueryTemplateId entity query template ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity query. + */ + EntityQueryTemplate get(String resourceGroupName, String workspaceName, String entityQueryTemplateId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityRelations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityRelations.java new file mode 100644 index 000000000000..5f693c316568 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityRelations.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of EntityRelations. + */ +public interface EntityRelations { + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation along with {@link Response}. + */ + Response getRelationWithResponse(String resourceGroupName, String workspaceName, String entityId, + String relationName, Context context); + + /** + * Gets an entity relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param entityId entity ID. + * @param relationName Relation Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an entity relation. + */ + Relation getRelation(String resourceGroupName, String workspaceName, String entityId, String relationName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineItem.java new file mode 100644 index 000000000000..d45a61722caf --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineItem.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Entity timeline Item. + */ +@Immutable +public class EntityTimelineItem implements JsonSerializable { + /* + * The entity query kind type. + */ + private EntityTimelineKind kind = EntityTimelineKind.fromString("EntityTimelineItem"); + + /** + * Creates an instance of EntityTimelineItem class. + */ + public EntityTimelineItem() { + } + + /** + * Get the kind property: The entity query kind type. + * + * @return the kind value. + */ + public EntityTimelineKind kind() { + return this.kind; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityTimelineItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityTimelineItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EntityTimelineItem. + */ + public static EntityTimelineItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Activity".equals(discriminatorValue)) { + return ActivityTimelineItem.fromJson(readerToUse.reset()); + } else if ("Bookmark".equals(discriminatorValue)) { + return BookmarkTimelineItem.fromJson(readerToUse.reset()); + } else if ("Anomaly".equals(discriminatorValue)) { + return AnomalyTimelineItem.fromJson(readerToUse.reset()); + } else if ("SecurityAlert".equals(discriminatorValue)) { + return SecurityAlertTimelineItem.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EntityTimelineItem fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityTimelineItem deserializedEntityTimelineItem = new EntityTimelineItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedEntityTimelineItem.kind = EntityTimelineKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityTimelineItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineKind.java new file mode 100644 index 000000000000..53240e7835a3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineKind.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The entity query kind. + */ +public final class EntityTimelineKind extends ExpandableStringEnum { + /** + * Static value Activity for EntityTimelineKind. + */ + public static final EntityTimelineKind ACTIVITY = fromString("Activity"); + + /** + * Static value Bookmark for EntityTimelineKind. + */ + public static final EntityTimelineKind BOOKMARK = fromString("Bookmark"); + + /** + * Static value SecurityAlert for EntityTimelineKind. + */ + public static final EntityTimelineKind SECURITY_ALERT = fromString("SecurityAlert"); + + /** + * Static value Anomaly for EntityTimelineKind. + */ + public static final EntityTimelineKind ANOMALY = fromString("Anomaly"); + + /** + * Creates a new instance of EntityTimelineKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityTimelineKind() { + } + + /** + * Creates or finds a EntityTimelineKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityTimelineKind. + */ + public static EntityTimelineKind fromString(String name) { + return fromString(name, EntityTimelineKind.class); + } + + /** + * Gets known EntityTimelineKind values. + * + * @return known EntityTimelineKind values. + */ + public static Collection values() { + return values(EntityTimelineKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineParameters.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineParameters.java new file mode 100644 index 000000000000..a3c8313ad2d5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineParameters.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The parameters required to execute s timeline operation on the given entity. + */ +@Fluent +public final class EntityTimelineParameters implements JsonSerializable { + /* + * Array of timeline Item kinds. + */ + private List kinds; + + /* + * The start timeline date, so the results returned are after this date. + */ + private OffsetDateTime startTime; + + /* + * The end timeline date, so the results returned are before this date. + */ + private OffsetDateTime endTime; + + /* + * The number of bucket for timeline queries aggregation. + */ + private Integer numberOfBucket; + + /** + * Creates an instance of EntityTimelineParameters class. + */ + public EntityTimelineParameters() { + } + + /** + * Get the kinds property: Array of timeline Item kinds. + * + * @return the kinds value. + */ + public List kinds() { + return this.kinds; + } + + /** + * Set the kinds property: Array of timeline Item kinds. + * + * @param kinds the kinds value to set. + * @return the EntityTimelineParameters object itself. + */ + public EntityTimelineParameters withKinds(List kinds) { + this.kinds = kinds; + return this; + } + + /** + * Get the startTime property: The start timeline date, so the results returned are after this date. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start timeline date, so the results returned are after this date. + * + * @param startTime the startTime value to set. + * @return the EntityTimelineParameters object itself. + */ + public EntityTimelineParameters withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end timeline date, so the results returned are before this date. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end timeline date, so the results returned are before this date. + * + * @param endTime the endTime value to set. + * @return the EntityTimelineParameters object itself. + */ + public EntityTimelineParameters withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the numberOfBucket property: The number of bucket for timeline queries aggregation. + * + * @return the numberOfBucket value. + */ + public Integer numberOfBucket() { + return this.numberOfBucket; + } + + /** + * Set the numberOfBucket property: The number of bucket for timeline queries aggregation. + * + * @param numberOfBucket the numberOfBucket value to set. + * @return the EntityTimelineParameters object itself. + */ + public EntityTimelineParameters withNumberOfBucket(Integer numberOfBucket) { + this.numberOfBucket = numberOfBucket; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startTime() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startTime in model EntityTimelineParameters")); + } + if (endTime() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endTime in model EntityTimelineParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EntityTimelineParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeArrayField("kinds", this.kinds, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeNumberField("numberOfBucket", this.numberOfBucket); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntityTimelineParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntityTimelineParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EntityTimelineParameters. + */ + public static EntityTimelineParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntityTimelineParameters deserializedEntityTimelineParameters = new EntityTimelineParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedEntityTimelineParameters.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedEntityTimelineParameters.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("kinds".equals(fieldName)) { + List kinds + = reader.readArray(reader1 -> EntityTimelineKind.fromString(reader1.getString())); + deserializedEntityTimelineParameters.kinds = kinds; + } else if ("numberOfBucket".equals(fieldName)) { + deserializedEntityTimelineParameters.numberOfBucket = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedEntityTimelineParameters; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineResponse.java new file mode 100644 index 000000000000..302c9aa2d7f1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityTimelineResponse.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.EntityTimelineResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of EntityTimelineResponse. + */ +public interface EntityTimelineResponse { + /** + * Gets the metadata property: The metadata from the timeline operation results. + * + * @return the metadata value. + */ + TimelineResultsMetadata metadata(); + + /** + * Gets the value property: The timeline result values. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.EntityTimelineResponseInner object. + * + * @return the inner object. + */ + EntityTimelineResponseInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityType.java new file mode 100644 index 000000000000..95e77e7c4a21 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EntityType.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the entity. + */ +public final class EntityType extends ExpandableStringEnum { + /** + * Static value Account for EntityType. + */ + public static final EntityType ACCOUNT = fromString("Account"); + + /** + * Static value Host for EntityType. + */ + public static final EntityType HOST = fromString("Host"); + + /** + * Static value File for EntityType. + */ + public static final EntityType FILE = fromString("File"); + + /** + * Static value AzureResource for EntityType. + */ + public static final EntityType AZURE_RESOURCE = fromString("AzureResource"); + + /** + * Static value CloudApplication for EntityType. + */ + public static final EntityType CLOUD_APPLICATION = fromString("CloudApplication"); + + /** + * Static value DNS for EntityType. + */ + public static final EntityType DNS = fromString("DNS"); + + /** + * Static value FileHash for EntityType. + */ + public static final EntityType FILE_HASH = fromString("FileHash"); + + /** + * Static value IP for EntityType. + */ + public static final EntityType IP = fromString("IP"); + + /** + * Static value Malware for EntityType. + */ + public static final EntityType MALWARE = fromString("Malware"); + + /** + * Static value Process for EntityType. + */ + public static final EntityType PROCESS = fromString("Process"); + + /** + * Static value RegistryKey for EntityType. + */ + public static final EntityType REGISTRY_KEY = fromString("RegistryKey"); + + /** + * Static value RegistryValue for EntityType. + */ + public static final EntityType REGISTRY_VALUE = fromString("RegistryValue"); + + /** + * Static value SecurityGroup for EntityType. + */ + public static final EntityType SECURITY_GROUP = fromString("SecurityGroup"); + + /** + * Static value URL for EntityType. + */ + public static final EntityType URL = fromString("URL"); + + /** + * Static value IoTDevice for EntityType. + */ + public static final EntityType IO_TDEVICE = fromString("IoTDevice"); + + /** + * Static value SecurityAlert for EntityType. + */ + public static final EntityType SECURITY_ALERT = fromString("SecurityAlert"); + + /** + * Static value HuntingBookmark for EntityType. + */ + public static final EntityType HUNTING_BOOKMARK = fromString("HuntingBookmark"); + + /** + * Static value MailCluster for EntityType. + */ + public static final EntityType MAIL_CLUSTER = fromString("MailCluster"); + + /** + * Static value MailMessage for EntityType. + */ + public static final EntityType MAIL_MESSAGE = fromString("MailMessage"); + + /** + * Static value Mailbox for EntityType. + */ + public static final EntityType MAILBOX = fromString("Mailbox"); + + /** + * Static value SubmissionMail for EntityType. + */ + public static final EntityType SUBMISSION_MAIL = fromString("SubmissionMail"); + + /** + * Static value Nic for EntityType. + */ + public static final EntityType NIC = fromString("Nic"); + + /** + * Creates a new instance of EntityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EntityType() { + } + + /** + * Creates or finds a EntityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EntityType. + */ + public static EntityType fromString(String name) { + return fromString(name, EntityType.class); + } + + /** + * Gets known EntityType values. + * + * @return known EntityType values. + */ + public static Collection values() { + return values(EntityType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Error.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Error.java new file mode 100644 index 000000000000..41b7f6e25274 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Error.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The error description for why a publication failed. + */ +@Fluent +public final class Error implements JsonSerializable { + /* + * The member resource name for which the publication error occured + */ + private String memberResourceName; + + /* + * The error message + */ + private String errorMessage; + + /** + * Creates an instance of Error class. + */ + public Error() { + } + + /** + * Get the memberResourceName property: The member resource name for which the publication error occured. + * + * @return the memberResourceName value. + */ + public String memberResourceName() { + return this.memberResourceName; + } + + /** + * Set the memberResourceName property: The member resource name for which the publication error occured. + * + * @param memberResourceName the memberResourceName value to set. + * @return the Error object itself. + */ + public Error withMemberResourceName(String memberResourceName) { + this.memberResourceName = memberResourceName; + return this; + } + + /** + * Get the errorMessage property: The error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set the errorMessage property: The error message. + * + * @param errorMessage the errorMessage value to set. + * @return the Error object itself. + */ + public Error withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (memberResourceName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property memberResourceName in model Error")); + } + if (errorMessage() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property errorMessage in model Error")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Error.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("memberResourceName", this.memberResourceName); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Error from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Error if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Error. + */ + public static Error fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Error deserializedError = new Error(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("memberResourceName".equals(fieldName)) { + deserializedError.memberResourceName = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedError.errorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedError; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionEntityQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionEntityQuery.java new file mode 100644 index 000000000000..76274e87346e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionEntityQuery.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryInner; +import com.azure.resourcemanager.securityinsights.fluent.models.ExpansionEntityQueriesProperties; +import java.io.IOException; +import java.util.List; + +/** + * Represents Expansion entity query. + */ +@Fluent +public final class ExpansionEntityQuery extends EntityQueryInner { + /* + * the entity query kind + */ + private EntityQueryKind kind = EntityQueryKind.EXPANSION; + + /* + * Expansion entity query properties + */ + private ExpansionEntityQueriesProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ExpansionEntityQuery class. + */ + public ExpansionEntityQuery() { + } + + /** + * Get the kind property: the entity query kind. + * + * @return the kind value. + */ + @Override + public EntityQueryKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Expansion entity query properties. + * + * @return the innerProperties value. + */ + private ExpansionEntityQueriesProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ExpansionEntityQuery withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataSources property: List of the data sources that are required to run the query. + * + * @return the dataSources value. + */ + public List dataSources() { + return this.innerProperties() == null ? null : this.innerProperties().dataSources(); + } + + /** + * Set the dataSources property: List of the data sources that are required to run the query. + * + * @param dataSources the dataSources value to set. + * @return the ExpansionEntityQuery object itself. + */ + public ExpansionEntityQuery withDataSources(List dataSources) { + if (this.innerProperties() == null) { + this.innerProperties = new ExpansionEntityQueriesProperties(); + } + this.innerProperties().withDataSources(dataSources); + return this; + } + + /** + * Get the displayName property: The query display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The query display name. + * + * @param displayName the displayName value to set. + * @return the ExpansionEntityQuery object itself. + */ + public ExpansionEntityQuery withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ExpansionEntityQueriesProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the inputEntityType property: The type of the query's source entity. + * + * @return the inputEntityType value. + */ + public EntityType inputEntityType() { + return this.innerProperties() == null ? null : this.innerProperties().inputEntityType(); + } + + /** + * Set the inputEntityType property: The type of the query's source entity. + * + * @param inputEntityType the inputEntityType value to set. + * @return the ExpansionEntityQuery object itself. + */ + public ExpansionEntityQuery withInputEntityType(EntityType inputEntityType) { + if (this.innerProperties() == null) { + this.innerProperties = new ExpansionEntityQueriesProperties(); + } + this.innerProperties().withInputEntityType(inputEntityType); + return this; + } + + /** + * Get the inputFields property: List of the fields of the source entity that are required to run the query. + * + * @return the inputFields value. + */ + public List inputFields() { + return this.innerProperties() == null ? null : this.innerProperties().inputFields(); + } + + /** + * Set the inputFields property: List of the fields of the source entity that are required to run the query. + * + * @param inputFields the inputFields value to set. + * @return the ExpansionEntityQuery object itself. + */ + public ExpansionEntityQuery withInputFields(List inputFields) { + if (this.innerProperties() == null) { + this.innerProperties = new ExpansionEntityQueriesProperties(); + } + this.innerProperties().withInputFields(inputFields); + return this; + } + + /** + * Get the outputEntityTypes property: List of the desired output types to be constructed from the result. + * + * @return the outputEntityTypes value. + */ + public List outputEntityTypes() { + return this.innerProperties() == null ? null : this.innerProperties().outputEntityTypes(); + } + + /** + * Set the outputEntityTypes property: List of the desired output types to be constructed from the result. + * + * @param outputEntityTypes the outputEntityTypes value to set. + * @return the ExpansionEntityQuery object itself. + */ + public ExpansionEntityQuery withOutputEntityTypes(List outputEntityTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new ExpansionEntityQueriesProperties(); + } + this.innerProperties().withOutputEntityTypes(outputEntityTypes); + return this; + } + + /** + * Get the queryTemplate property: The template query string to be parsed and formatted. + * + * @return the queryTemplate value. + */ + public String queryTemplate() { + return this.innerProperties() == null ? null : this.innerProperties().queryTemplate(); + } + + /** + * Set the queryTemplate property: The template query string to be parsed and formatted. + * + * @param queryTemplate the queryTemplate value to set. + * @return the ExpansionEntityQuery object itself. + */ + public ExpansionEntityQuery withQueryTemplate(String queryTemplate) { + if (this.innerProperties() == null) { + this.innerProperties = new ExpansionEntityQueriesProperties(); + } + this.innerProperties().withQueryTemplate(queryTemplate); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExpansionEntityQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExpansionEntityQuery if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExpansionEntityQuery. + */ + public static ExpansionEntityQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExpansionEntityQuery deserializedExpansionEntityQuery = new ExpansionEntityQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedExpansionEntityQuery.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExpansionEntityQuery.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExpansionEntityQuery.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedExpansionEntityQuery.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedExpansionEntityQuery.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedExpansionEntityQuery.kind = EntityQueryKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedExpansionEntityQuery.innerProperties + = ExpansionEntityQueriesProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExpansionEntityQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionResultAggregation.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionResultAggregation.java new file mode 100644 index 000000000000..297a042e3235 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionResultAggregation.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information of a specific aggregation in the expansion result. + */ +@Fluent +public final class ExpansionResultAggregation implements JsonSerializable { + /* + * The common type of the aggregation. (for e.g. entity field name) + */ + private String aggregationType; + + /* + * Total number of aggregations of the given kind (and aggregationType if given) in the expansion result. + */ + private int count; + + /* + * The display name of the aggregation by type. + */ + private String displayName; + + /* + * The kind of the aggregated entity. + */ + private EntityKindEnum entityKind; + + /** + * Creates an instance of ExpansionResultAggregation class. + */ + public ExpansionResultAggregation() { + } + + /** + * Get the aggregationType property: The common type of the aggregation. (for e.g. entity field name). + * + * @return the aggregationType value. + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set the aggregationType property: The common type of the aggregation. (for e.g. entity field name). + * + * @param aggregationType the aggregationType value to set. + * @return the ExpansionResultAggregation object itself. + */ + public ExpansionResultAggregation withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the count property: Total number of aggregations of the given kind (and aggregationType if given) in the + * expansion result. + * + * @return the count value. + */ + public int count() { + return this.count; + } + + /** + * Set the count property: Total number of aggregations of the given kind (and aggregationType if given) in the + * expansion result. + * + * @param count the count value to set. + * @return the ExpansionResultAggregation object itself. + */ + public ExpansionResultAggregation withCount(int count) { + this.count = count; + return this; + } + + /** + * Get the displayName property: The display name of the aggregation by type. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the aggregation by type. + * + * @param displayName the displayName value to set. + * @return the ExpansionResultAggregation object itself. + */ + public ExpansionResultAggregation withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the entityKind property: The kind of the aggregated entity. + * + * @return the entityKind value. + */ + public EntityKindEnum entityKind() { + return this.entityKind; + } + + /** + * Set the entityKind property: The kind of the aggregated entity. + * + * @param entityKind the entityKind value to set. + * @return the ExpansionResultAggregation object itself. + */ + public ExpansionResultAggregation withEntityKind(EntityKindEnum entityKind) { + this.entityKind = entityKind; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (entityKind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property entityKind in model ExpansionResultAggregation")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExpansionResultAggregation.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("count", this.count); + jsonWriter.writeStringField("entityKind", this.entityKind == null ? null : this.entityKind.toString()); + jsonWriter.writeStringField("aggregationType", this.aggregationType); + jsonWriter.writeStringField("displayName", this.displayName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExpansionResultAggregation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExpansionResultAggregation if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExpansionResultAggregation. + */ + public static ExpansionResultAggregation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExpansionResultAggregation deserializedExpansionResultAggregation = new ExpansionResultAggregation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedExpansionResultAggregation.count = reader.getInt(); + } else if ("entityKind".equals(fieldName)) { + deserializedExpansionResultAggregation.entityKind = EntityKindEnum.fromString(reader.getString()); + } else if ("aggregationType".equals(fieldName)) { + deserializedExpansionResultAggregation.aggregationType = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedExpansionResultAggregation.displayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExpansionResultAggregation; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionResultsMetadata.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionResultsMetadata.java new file mode 100644 index 000000000000..d93522b61e87 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ExpansionResultsMetadata.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Expansion result metadata. + */ +@Fluent +public final class ExpansionResultsMetadata implements JsonSerializable { + /* + * Information of the aggregated nodes in the expansion result. + */ + private List aggregations; + + /** + * Creates an instance of ExpansionResultsMetadata class. + */ + public ExpansionResultsMetadata() { + } + + /** + * Get the aggregations property: Information of the aggregated nodes in the expansion result. + * + * @return the aggregations value. + */ + public List aggregations() { + return this.aggregations; + } + + /** + * Set the aggregations property: Information of the aggregated nodes in the expansion result. + * + * @param aggregations the aggregations value to set. + * @return the ExpansionResultsMetadata object itself. + */ + public ExpansionResultsMetadata withAggregations(List aggregations) { + this.aggregations = aggregations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aggregations() != null) { + aggregations().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("aggregations", this.aggregations, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExpansionResultsMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExpansionResultsMetadata if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExpansionResultsMetadata. + */ + public static ExpansionResultsMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExpansionResultsMetadata deserializedExpansionResultsMetadata = new ExpansionResultsMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("aggregations".equals(fieldName)) { + List aggregations + = reader.readArray(reader1 -> ExpansionResultAggregation.fromJson(reader1)); + deserializedExpansionResultsMetadata.aggregations = aggregations; + } else { + reader.skipChildren(); + } + } + + return deserializedExpansionResultsMetadata; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EyesOn.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EyesOn.java new file mode 100644 index 000000000000..a8c045d68b00 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/EyesOn.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EyesOnSettingsProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import java.io.IOException; + +/** + * Settings with single toggle. + */ +@Fluent +public final class EyesOn extends SettingsInner { + /* + * The kind of the setting + */ + private SettingKind kind = SettingKind.EYES_ON; + + /* + * EyesOn properties + */ + private EyesOnSettingsProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EyesOn class. + */ + public EyesOn() { + } + + /** + * Get the kind property: The kind of the setting. + * + * @return the kind value. + */ + @Override + public SettingKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: EyesOn properties. + * + * @return the innerProperties value. + */ + private EyesOnSettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public EyesOn withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the isEnabled property: Determines whether the setting is enable or disabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EyesOn from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EyesOn if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EyesOn. + */ + public static EyesOn fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EyesOn deserializedEyesOn = new EyesOn(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEyesOn.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEyesOn.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEyesOn.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedEyesOn.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedEyesOn.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedEyesOn.kind = SettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedEyesOn.innerProperties = EyesOnSettingsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEyesOn; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileEntity.java index 00549d660863..1d69fbbb9ad5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.FileEntityProperties; import java.io.IOException; import java.util.List; @@ -18,7 +19,7 @@ * Represents a file entity. */ @Immutable -public final class FileEntity extends Entity { +public final class FileEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileFormat.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileFormat.java new file mode 100644 index 000000000000..fc6d6e984424 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileFormat.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The format of the file. + */ +public final class FileFormat extends ExpandableStringEnum { + /** + * Static value CSV for FileFormat. + */ + public static final FileFormat CSV = fromString("CSV"); + + /** + * Static value JSON for FileFormat. + */ + public static final FileFormat JSON = fromString("JSON"); + + /** + * Static value Unspecified for FileFormat. + */ + public static final FileFormat UNSPECIFIED = fromString("Unspecified"); + + /** + * Creates a new instance of FileFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FileFormat() { + } + + /** + * Creates or finds a FileFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileFormat. + */ + public static FileFormat fromString(String name) { + return fromString(name, FileFormat.class); + } + + /** + * Gets known FileFormat values. + * + * @return known FileFormat values. + */ + public static Collection values() { + return values(FileFormat.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileHashEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileHashEntity.java index 745e2251e40f..9261fdb8075f 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileHashEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileHashEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.FileHashEntityProperties; import java.io.IOException; import java.util.Map; @@ -17,7 +18,7 @@ * Represents a file hash entity. */ @Immutable -public final class FileHashEntity extends Entity { +public final class FileHashEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImport.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImport.java new file mode 100644 index 000000000000..942644b81c78 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImport.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.FileImportInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * An immutable client-side representation of FileImport. + */ +public interface FileImport { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the ingestionMode property: Describes how to ingest the records in the file. + * + * @return the ingestionMode value. + */ + IngestionMode ingestionMode(); + + /** + * Gets the contentType property: The content type of this file. + * + * @return the contentType value. + */ + FileImportContentType contentType(); + + /** + * Gets the createdTimeUtc property: The time the file was imported. + * + * @return the createdTimeUtc value. + */ + OffsetDateTime createdTimeUtc(); + + /** + * Gets the errorFile property: Represents the error file (if the import was ingested with errors or failed the + * validation). + * + * @return the errorFile value. + */ + FileMetadata errorFile(); + + /** + * Gets the errorsPreview property: An ordered list of some of the errors that were encountered during validation. + * + * @return the errorsPreview value. + */ + List errorsPreview(); + + /** + * Gets the importFile property: Represents the imported file. + * + * @return the importFile value. + */ + FileMetadata importFile(); + + /** + * Gets the ingestedRecordCount property: The number of records that have been successfully ingested. + * + * @return the ingestedRecordCount value. + */ + Integer ingestedRecordCount(); + + /** + * Gets the source property: The source for the data in the file. + * + * @return the source value. + */ + String source(); + + /** + * Gets the state property: The state of the file import. + * + * @return the state value. + */ + FileImportState state(); + + /** + * Gets the totalRecordCount property: The number of records in the file. + * + * @return the totalRecordCount value. + */ + Integer totalRecordCount(); + + /** + * Gets the validRecordCount property: The number of records that have passed validation. + * + * @return the validRecordCount value. + */ + Integer validRecordCount(); + + /** + * Gets the filesValidUntilTimeUtc property: The time the files associated with this import are deleted from the + * storage account. + * + * @return the filesValidUntilTimeUtc value. + */ + OffsetDateTime filesValidUntilTimeUtc(); + + /** + * Gets the importValidUntilTimeUtc property: The time the file import record is soft deleted from the database and + * history. + * + * @return the importValidUntilTimeUtc value. + */ + OffsetDateTime importValidUntilTimeUtc(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.FileImportInner object. + * + * @return the inner object. + */ + FileImportInner innerModel(); + + /** + * The entirety of the FileImport definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The FileImport definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FileImport definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the FileImport definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the FileImport definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithIngestionMode, DefinitionStages.WithContentType, + DefinitionStages.WithImportFile, DefinitionStages.WithSource { + /** + * Executes the create request. + * + * @return the created resource. + */ + FileImport create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FileImport create(Context context); + } + + /** + * The stage of the FileImport definition allowing to specify ingestionMode. + */ + interface WithIngestionMode { + /** + * Specifies the ingestionMode property: Describes how to ingest the records in the file.. + * + * @param ingestionMode Describes how to ingest the records in the file. + * @return the next definition stage. + */ + WithCreate withIngestionMode(IngestionMode ingestionMode); + } + + /** + * The stage of the FileImport definition allowing to specify contentType. + */ + interface WithContentType { + /** + * Specifies the contentType property: The content type of this file.. + * + * @param contentType The content type of this file. + * @return the next definition stage. + */ + WithCreate withContentType(FileImportContentType contentType); + } + + /** + * The stage of the FileImport definition allowing to specify importFile. + */ + interface WithImportFile { + /** + * Specifies the importFile property: Represents the imported file.. + * + * @param importFile Represents the imported file. + * @return the next definition stage. + */ + WithCreate withImportFile(FileMetadata importFile); + } + + /** + * The stage of the FileImport definition allowing to specify source. + */ + interface WithSource { + /** + * Specifies the source property: The source for the data in the file.. + * + * @param source The source for the data in the file. + * @return the next definition stage. + */ + WithCreate withSource(String source); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FileImport refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FileImport refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportContentType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportContentType.java new file mode 100644 index 000000000000..d2b903f8aeb4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportContentType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The content type of this file. + */ +public final class FileImportContentType extends ExpandableStringEnum { + /** + * Static value BasicIndicator for FileImportContentType. + */ + public static final FileImportContentType BASIC_INDICATOR = fromString("BasicIndicator"); + + /** + * Static value StixIndicator for FileImportContentType. + */ + public static final FileImportContentType STIX_INDICATOR = fromString("StixIndicator"); + + /** + * Static value Unspecified for FileImportContentType. + */ + public static final FileImportContentType UNSPECIFIED = fromString("Unspecified"); + + /** + * Creates a new instance of FileImportContentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FileImportContentType() { + } + + /** + * Creates or finds a FileImportContentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileImportContentType. + */ + public static FileImportContentType fromString(String name) { + return fromString(name, FileImportContentType.class); + } + + /** + * Gets known FileImportContentType values. + * + * @return known FileImportContentType values. + */ + public static Collection values() { + return values(FileImportContentType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportList.java new file mode 100644 index 000000000000..5ed0457ad39c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.FileImportInner; +import java.io.IOException; +import java.util.List; + +/** + * List all the file imports. + */ +@Fluent +public final class FileImportList implements JsonSerializable { + /* + * URL to fetch the next set of file imports. + */ + private String nextLink; + + /* + * Array of file imports. + */ + private List value; + + /** + * Creates an instance of FileImportList class. + */ + public FileImportList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of file imports. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of file imports. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of file imports. + * + * @param value the value value to set. + * @return the FileImportList object itself. + */ + public FileImportList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FileImportList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FileImportList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileImportList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileImportList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileImportList. + */ + public static FileImportList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileImportList deserializedFileImportList = new FileImportList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FileImportInner.fromJson(reader1)); + deserializedFileImportList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFileImportList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFileImportList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportState.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportState.java new file mode 100644 index 000000000000..33baa3cee901 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImportState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the file import. + */ +public final class FileImportState extends ExpandableStringEnum { + /** + * Static value FatalError for FileImportState. + */ + public static final FileImportState FATAL_ERROR = fromString("FatalError"); + + /** + * Static value Ingested for FileImportState. + */ + public static final FileImportState INGESTED = fromString("Ingested"); + + /** + * Static value IngestedWithErrors for FileImportState. + */ + public static final FileImportState INGESTED_WITH_ERRORS = fromString("IngestedWithErrors"); + + /** + * Static value InProgress for FileImportState. + */ + public static final FileImportState IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Invalid for FileImportState. + */ + public static final FileImportState INVALID = fromString("Invalid"); + + /** + * Static value WaitingForUpload for FileImportState. + */ + public static final FileImportState WAITING_FOR_UPLOAD = fromString("WaitingForUpload"); + + /** + * Static value Unspecified for FileImportState. + */ + public static final FileImportState UNSPECIFIED = fromString("Unspecified"); + + /** + * Creates a new instance of FileImportState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FileImportState() { + } + + /** + * Creates or finds a FileImportState from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileImportState. + */ + public static FileImportState fromString(String name) { + return fromString(name, FileImportState.class); + } + + /** + * Gets known FileImportState values. + * + * @return known FileImportState values. + */ + public static Collection values() { + return values(FileImportState.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImports.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImports.java new file mode 100644 index 000000000000..d9c8a66435f7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileImports.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of FileImports. + */ +public interface FileImports { + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all file imports. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all file imports as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String fileImportId, + Context context); + + /** + * Gets a file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import. + */ + FileImport get(String resourceGroupName, String workspaceName, String fileImportId); + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + FileImport delete(String resourceGroupName, String workspaceName, String fileImportId); + + /** + * Delete the file import. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param fileImportId File import ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + FileImport delete(String resourceGroupName, String workspaceName, String fileImportId, Context context); + + /** + * Gets a file import. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import along with {@link Response}. + */ + FileImport getById(String id); + + /** + * Gets a file import. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a file import along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete the file import. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + FileImport deleteById(String id); + + /** + * Delete the file import. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a file import in Azure Security Insights. + */ + FileImport deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FileImport resource. + * + * @param name resource name. + * @return the first stage of the new FileImport definition. + */ + FileImport.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileMetadata.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileMetadata.java new file mode 100644 index 000000000000..c7895c0de0f1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FileMetadata.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a file. + */ +@Fluent +public final class FileMetadata implements JsonSerializable { + /* + * The format of the file + */ + private FileFormat fileFormat; + + /* + * The name of the file. + */ + private String fileName; + + /* + * The size of the file. + */ + private Integer fileSize; + + /* + * A URI with a valid SAS token to allow uploading / downloading the file. + */ + private String fileContentUri; + + /* + * Indicates whether the file was deleted from the storage account. + */ + private DeleteStatus deleteStatus; + + /** + * Creates an instance of FileMetadata class. + */ + public FileMetadata() { + } + + /** + * Get the fileFormat property: The format of the file. + * + * @return the fileFormat value. + */ + public FileFormat fileFormat() { + return this.fileFormat; + } + + /** + * Set the fileFormat property: The format of the file. + * + * @param fileFormat the fileFormat value to set. + * @return the FileMetadata object itself. + */ + public FileMetadata withFileFormat(FileFormat fileFormat) { + this.fileFormat = fileFormat; + return this; + } + + /** + * Get the fileName property: The name of the file. + * + * @return the fileName value. + */ + public String fileName() { + return this.fileName; + } + + /** + * Set the fileName property: The name of the file. + * + * @param fileName the fileName value to set. + * @return the FileMetadata object itself. + */ + public FileMetadata withFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get the fileSize property: The size of the file. + * + * @return the fileSize value. + */ + public Integer fileSize() { + return this.fileSize; + } + + /** + * Set the fileSize property: The size of the file. + * + * @param fileSize the fileSize value to set. + * @return the FileMetadata object itself. + */ + public FileMetadata withFileSize(Integer fileSize) { + this.fileSize = fileSize; + return this; + } + + /** + * Get the fileContentUri property: A URI with a valid SAS token to allow uploading / downloading the file. + * + * @return the fileContentUri value. + */ + public String fileContentUri() { + return this.fileContentUri; + } + + /** + * Get the deleteStatus property: Indicates whether the file was deleted from the storage account. + * + * @return the deleteStatus value. + */ + public DeleteStatus deleteStatus() { + return this.deleteStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fileFormat", this.fileFormat == null ? null : this.fileFormat.toString()); + jsonWriter.writeStringField("fileName", this.fileName); + jsonWriter.writeNumberField("fileSize", this.fileSize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileMetadata if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the FileMetadata. + */ + public static FileMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileMetadata deserializedFileMetadata = new FileMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fileFormat".equals(fieldName)) { + deserializedFileMetadata.fileFormat = FileFormat.fromString(reader.getString()); + } else if ("fileName".equals(fieldName)) { + deserializedFileMetadata.fileName = reader.getString(); + } else if ("fileSize".equals(fieldName)) { + deserializedFileMetadata.fileSize = reader.getNullable(JsonReader::getInt); + } else if ("fileContentUri".equals(fieldName)) { + deserializedFileMetadata.fileContentUri = reader.getString(); + } else if ("deleteStatus".equals(fieldName)) { + deserializedFileMetadata.deleteStatus = DeleteStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFileMetadata; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Flag.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Flag.java new file mode 100644 index 000000000000..333a8a46ade5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Flag.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The boolean value the metadata is for. + */ +public final class Flag extends ExpandableStringEnum { + /** + * Static value true for Flag. + */ + public static final Flag TRUE = fromString("true"); + + /** + * Static value false for Flag. + */ + public static final Flag FALSE = fromString("false"); + + /** + * Creates a new instance of Flag value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Flag() { + } + + /** + * Creates or finds a Flag from its string representation. + * + * @param name a name to look for. + * @return the corresponding Flag. + */ + public static Flag fromString(String name) { + return fromString(name, Flag.class); + } + + /** + * Gets known Flag values. + * + * @return known Flag values. + */ + public static Collection values() { + return values(Flag.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRule.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRule.java index 49fe5604b26b..03017b48df3b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRule.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRule.java @@ -21,7 +21,7 @@ @Fluent public final class FusionAlertRule extends AlertRuleInner { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.FUSION; @@ -57,7 +57,7 @@ public FusionAlertRule() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ @@ -188,6 +188,53 @@ public FusionAlertRule withEnabled(Boolean enabled) { return this; } + /** + * Get the sourceSettings property: Configuration for all supported source signals in fusion detection. + * + * @return the sourceSettings value. + */ + public List sourceSettings() { + return this.innerProperties() == null ? null : this.innerProperties().sourceSettings(); + } + + /** + * Set the sourceSettings property: Configuration for all supported source signals in fusion detection. + * + * @param sourceSettings the sourceSettings value to set. + * @return the FusionAlertRule object itself. + */ + public FusionAlertRule withSourceSettings(List sourceSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new FusionAlertRuleProperties(); + } + this.innerProperties().withSourceSettings(sourceSettings); + return this; + } + + /** + * Get the scenarioExclusionPatterns property: Configuration to exclude scenarios in fusion detection. + * + * @return the scenarioExclusionPatterns value. + */ + public List scenarioExclusionPatterns() { + return this.innerProperties() == null ? null : this.innerProperties().scenarioExclusionPatterns(); + } + + /** + * Set the scenarioExclusionPatterns property: Configuration to exclude scenarios in fusion detection. + * + * @param scenarioExclusionPatterns the scenarioExclusionPatterns value to set. + * @return the FusionAlertRule object itself. + */ + public FusionAlertRule + withScenarioExclusionPatterns(List scenarioExclusionPatterns) { + if (this.innerProperties() == null) { + this.innerProperties = new FusionAlertRuleProperties(); + } + this.innerProperties().withScenarioExclusionPatterns(scenarioExclusionPatterns); + return this; + } + /** * Get the lastModifiedUtc property: The last time that this alert has been modified. * @@ -224,6 +271,15 @@ public List techniques() { return this.innerProperties() == null ? null : this.innerProperties().techniques(); } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().subTechniques(); + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRuleTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRuleTemplate.java index 220655c8962f..f64a1808d0e3 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRuleTemplate.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionAlertRuleTemplate.java @@ -21,7 +21,7 @@ @Fluent public final class FusionAlertRuleTemplate extends AlertRuleTemplateInner { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.FUSION; @@ -57,7 +57,7 @@ public FusionAlertRuleTemplate() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ @@ -296,7 +296,7 @@ public FusionAlertRuleTemplate withTactics(List tactics) { } /** - * Get the techniques property: The techniques of the alert rule template. + * Get the techniques property: The techniques of the alert rule. * * @return the techniques value. */ @@ -305,7 +305,7 @@ public List techniques() { } /** - * Set the techniques property: The techniques of the alert rule template. + * Set the techniques property: The techniques of the alert rule. * * @param techniques the techniques value to set. * @return the FusionAlertRuleTemplate object itself. @@ -318,6 +318,52 @@ public FusionAlertRuleTemplate withTechniques(List techniques) { return this; } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().subTechniques(); + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the FusionAlertRuleTemplate object itself. + */ + public FusionAlertRuleTemplate withSubTechniques(List subTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new FusionAlertRuleTemplateProperties(); + } + this.innerProperties().withSubTechniques(subTechniques); + return this; + } + + /** + * Get the sourceSettings property: All supported source signal configurations consumed in fusion detection. + * + * @return the sourceSettings value. + */ + public List sourceSettings() { + return this.innerProperties() == null ? null : this.innerProperties().sourceSettings(); + } + + /** + * Set the sourceSettings property: All supported source signal configurations consumed in fusion detection. + * + * @param sourceSettings the sourceSettings value to set. + * @return the FusionAlertRuleTemplate object itself. + */ + public FusionAlertRuleTemplate withSourceSettings(List sourceSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new FusionAlertRuleTemplateProperties(); + } + this.innerProperties().withSourceSettings(sourceSettings); + return this; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionScenarioExclusionPattern.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionScenarioExclusionPattern.java new file mode 100644 index 000000000000..54813da62e65 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionScenarioExclusionPattern.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a Fusion scenario exclusion patterns in Fusion detection. + */ +@Fluent +public final class FusionScenarioExclusionPattern implements JsonSerializable { + /* + * Scenario exclusion pattern. + */ + private String exclusionPattern; + + /* + * DateTime when scenario exclusion pattern is added in UTC. + */ + private String dateAddedInUtc; + + /** + * Creates an instance of FusionScenarioExclusionPattern class. + */ + public FusionScenarioExclusionPattern() { + } + + /** + * Get the exclusionPattern property: Scenario exclusion pattern. + * + * @return the exclusionPattern value. + */ + public String exclusionPattern() { + return this.exclusionPattern; + } + + /** + * Set the exclusionPattern property: Scenario exclusion pattern. + * + * @param exclusionPattern the exclusionPattern value to set. + * @return the FusionScenarioExclusionPattern object itself. + */ + public FusionScenarioExclusionPattern withExclusionPattern(String exclusionPattern) { + this.exclusionPattern = exclusionPattern; + return this; + } + + /** + * Get the dateAddedInUtc property: DateTime when scenario exclusion pattern is added in UTC. + * + * @return the dateAddedInUtc value. + */ + public String dateAddedInUtc() { + return this.dateAddedInUtc; + } + + /** + * Set the dateAddedInUtc property: DateTime when scenario exclusion pattern is added in UTC. + * + * @param dateAddedInUtc the dateAddedInUtc value to set. + * @return the FusionScenarioExclusionPattern object itself. + */ + public FusionScenarioExclusionPattern withDateAddedInUtc(String dateAddedInUtc) { + this.dateAddedInUtc = dateAddedInUtc; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (exclusionPattern() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property exclusionPattern in model FusionScenarioExclusionPattern")); + } + if (dateAddedInUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dateAddedInUtc in model FusionScenarioExclusionPattern")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FusionScenarioExclusionPattern.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("exclusionPattern", this.exclusionPattern); + jsonWriter.writeStringField("dateAddedInUTC", this.dateAddedInUtc); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionScenarioExclusionPattern from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionScenarioExclusionPattern if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FusionScenarioExclusionPattern. + */ + public static FusionScenarioExclusionPattern fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionScenarioExclusionPattern deserializedFusionScenarioExclusionPattern + = new FusionScenarioExclusionPattern(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("exclusionPattern".equals(fieldName)) { + deserializedFusionScenarioExclusionPattern.exclusionPattern = reader.getString(); + } else if ("dateAddedInUTC".equals(fieldName)) { + deserializedFusionScenarioExclusionPattern.dateAddedInUtc = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFusionScenarioExclusionPattern; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSourceSettings.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSourceSettings.java new file mode 100644 index 000000000000..a0cd67b7ed3b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSourceSettings.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a supported source signal configuration in Fusion detection. + */ +@Fluent +public final class FusionSourceSettings implements JsonSerializable { + /* + * Determines whether this source signal is enabled or disabled in Fusion detection. + */ + private boolean enabled; + + /* + * Name of the Fusion source signal. Refer to Fusion alert rule template for supported values. + */ + private String sourceName; + + /* + * Configuration for all source subtypes under this source signal consumed in fusion detection. + */ + private List sourceSubTypes; + + /** + * Creates an instance of FusionSourceSettings class. + */ + public FusionSourceSettings() { + } + + /** + * Get the enabled property: Determines whether this source signal is enabled or disabled in Fusion detection. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether this source signal is enabled or disabled in Fusion detection. + * + * @param enabled the enabled value to set. + * @return the FusionSourceSettings object itself. + */ + public FusionSourceSettings withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the sourceName property: Name of the Fusion source signal. Refer to Fusion alert rule template for supported + * values. + * + * @return the sourceName value. + */ + public String sourceName() { + return this.sourceName; + } + + /** + * Set the sourceName property: Name of the Fusion source signal. Refer to Fusion alert rule template for supported + * values. + * + * @param sourceName the sourceName value to set. + * @return the FusionSourceSettings object itself. + */ + public FusionSourceSettings withSourceName(String sourceName) { + this.sourceName = sourceName; + return this; + } + + /** + * Get the sourceSubTypes property: Configuration for all source subtypes under this source signal consumed in + * fusion detection. + * + * @return the sourceSubTypes value. + */ + public List sourceSubTypes() { + return this.sourceSubTypes; + } + + /** + * Set the sourceSubTypes property: Configuration for all source subtypes under this source signal consumed in + * fusion detection. + * + * @param sourceSubTypes the sourceSubTypes value to set. + * @return the FusionSourceSettings object itself. + */ + public FusionSourceSettings withSourceSubTypes(List sourceSubTypes) { + this.sourceSubTypes = sourceSubTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceName() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property sourceName in model FusionSourceSettings")); + } + if (sourceSubTypes() != null) { + sourceSubTypes().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FusionSourceSettings.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("sourceName", this.sourceName); + jsonWriter.writeArrayField("sourceSubTypes", this.sourceSubTypes, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionSourceSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionSourceSettings if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FusionSourceSettings. + */ + public static FusionSourceSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionSourceSettings deserializedFusionSourceSettings = new FusionSourceSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedFusionSourceSettings.enabled = reader.getBoolean(); + } else if ("sourceName".equals(fieldName)) { + deserializedFusionSourceSettings.sourceName = reader.getString(); + } else if ("sourceSubTypes".equals(fieldName)) { + List sourceSubTypes + = reader.readArray(reader1 -> FusionSourceSubTypeSetting.fromJson(reader1)); + deserializedFusionSourceSettings.sourceSubTypes = sourceSubTypes; + } else { + reader.skipChildren(); + } + } + + return deserializedFusionSourceSettings; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSourceSubTypeSetting.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSourceSubTypeSetting.java new file mode 100644 index 000000000000..ed1cbdd19315 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSourceSubTypeSetting.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a supported source subtype configuration under a source signal in Fusion detection. + */ +@Fluent +public final class FusionSourceSubTypeSetting implements JsonSerializable { + /* + * Determines whether this source subtype under source signal is enabled or disabled in Fusion detection. + */ + private boolean enabled; + + /* + * The Name of the source subtype under a given source signal in Fusion detection. Refer to Fusion alert rule + * template for supported values. + */ + private String sourceSubTypeName; + + /* + * The display name of source subtype under a source signal consumed in Fusion detection. + */ + private String sourceSubTypeDisplayName; + + /* + * Severity configuration for a source subtype consumed in fusion detection. + */ + private FusionSubTypeSeverityFilter severityFilters; + + /** + * Creates an instance of FusionSourceSubTypeSetting class. + */ + public FusionSourceSubTypeSetting() { + } + + /** + * Get the enabled property: Determines whether this source subtype under source signal is enabled or disabled in + * Fusion detection. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether this source subtype under source signal is enabled or disabled in + * Fusion detection. + * + * @param enabled the enabled value to set. + * @return the FusionSourceSubTypeSetting object itself. + */ + public FusionSourceSubTypeSetting withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the sourceSubTypeName property: The Name of the source subtype under a given source signal in Fusion + * detection. Refer to Fusion alert rule template for supported values. + * + * @return the sourceSubTypeName value. + */ + public String sourceSubTypeName() { + return this.sourceSubTypeName; + } + + /** + * Set the sourceSubTypeName property: The Name of the source subtype under a given source signal in Fusion + * detection. Refer to Fusion alert rule template for supported values. + * + * @param sourceSubTypeName the sourceSubTypeName value to set. + * @return the FusionSourceSubTypeSetting object itself. + */ + public FusionSourceSubTypeSetting withSourceSubTypeName(String sourceSubTypeName) { + this.sourceSubTypeName = sourceSubTypeName; + return this; + } + + /** + * Get the sourceSubTypeDisplayName property: The display name of source subtype under a source signal consumed in + * Fusion detection. + * + * @return the sourceSubTypeDisplayName value. + */ + public String sourceSubTypeDisplayName() { + return this.sourceSubTypeDisplayName; + } + + /** + * Get the severityFilters property: Severity configuration for a source subtype consumed in fusion detection. + * + * @return the severityFilters value. + */ + public FusionSubTypeSeverityFilter severityFilters() { + return this.severityFilters; + } + + /** + * Set the severityFilters property: Severity configuration for a source subtype consumed in fusion detection. + * + * @param severityFilters the severityFilters value to set. + * @return the FusionSourceSubTypeSetting object itself. + */ + public FusionSourceSubTypeSetting withSeverityFilters(FusionSubTypeSeverityFilter severityFilters) { + this.severityFilters = severityFilters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceSubTypeName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceSubTypeName in model FusionSourceSubTypeSetting")); + } + if (severityFilters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property severityFilters in model FusionSourceSubTypeSetting")); + } else { + severityFilters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FusionSourceSubTypeSetting.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("sourceSubTypeName", this.sourceSubTypeName); + jsonWriter.writeJsonField("severityFilters", this.severityFilters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionSourceSubTypeSetting from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionSourceSubTypeSetting if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FusionSourceSubTypeSetting. + */ + public static FusionSourceSubTypeSetting fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionSourceSubTypeSetting deserializedFusionSourceSubTypeSetting = new FusionSourceSubTypeSetting(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedFusionSourceSubTypeSetting.enabled = reader.getBoolean(); + } else if ("sourceSubTypeName".equals(fieldName)) { + deserializedFusionSourceSubTypeSetting.sourceSubTypeName = reader.getString(); + } else if ("severityFilters".equals(fieldName)) { + deserializedFusionSourceSubTypeSetting.severityFilters + = FusionSubTypeSeverityFilter.fromJson(reader); + } else if ("sourceSubTypeDisplayName".equals(fieldName)) { + deserializedFusionSourceSubTypeSetting.sourceSubTypeDisplayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFusionSourceSubTypeSetting; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSubTypeSeverityFilter.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSubTypeSeverityFilter.java new file mode 100644 index 000000000000..addf4c5a91dc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSubTypeSeverityFilter.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents severity configuration for a source subtype consumed in Fusion detection. + */ +@Fluent +public final class FusionSubTypeSeverityFilter implements JsonSerializable { + /* + * Determines whether this source subtype supports severity configuration or not. + */ + private Boolean isSupported; + + /* + * Individual Severity configuration settings for a given source subtype consumed in Fusion detection. + */ + private List filters; + + /** + * Creates an instance of FusionSubTypeSeverityFilter class. + */ + public FusionSubTypeSeverityFilter() { + } + + /** + * Get the isSupported property: Determines whether this source subtype supports severity configuration or not. + * + * @return the isSupported value. + */ + public Boolean isSupported() { + return this.isSupported; + } + + /** + * Get the filters property: Individual Severity configuration settings for a given source subtype consumed in + * Fusion detection. + * + * @return the filters value. + */ + public List filters() { + return this.filters; + } + + /** + * Set the filters property: Individual Severity configuration settings for a given source subtype consumed in + * Fusion detection. + * + * @param filters the filters value to set. + * @return the FusionSubTypeSeverityFilter object itself. + */ + public FusionSubTypeSeverityFilter withFilters(List filters) { + this.filters = filters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filters() != null) { + filters().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("filters", this.filters, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionSubTypeSeverityFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionSubTypeSeverityFilter if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FusionSubTypeSeverityFilter. + */ + public static FusionSubTypeSeverityFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionSubTypeSeverityFilter deserializedFusionSubTypeSeverityFilter = new FusionSubTypeSeverityFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isSupported".equals(fieldName)) { + deserializedFusionSubTypeSeverityFilter.isSupported = reader.getNullable(JsonReader::getBoolean); + } else if ("filters".equals(fieldName)) { + List filters + = reader.readArray(reader1 -> FusionSubTypeSeverityFiltersItem.fromJson(reader1)); + deserializedFusionSubTypeSeverityFilter.filters = filters; + } else { + reader.skipChildren(); + } + } + + return deserializedFusionSubTypeSeverityFilter; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSubTypeSeverityFiltersItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSubTypeSeverityFiltersItem.java new file mode 100644 index 000000000000..87b5221553d6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionSubTypeSeverityFiltersItem.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a Severity filter setting for a given source subtype consumed in Fusion detection. + */ +@Fluent +public final class FusionSubTypeSeverityFiltersItem implements JsonSerializable { + /* + * The Severity for a given source subtype consumed in Fusion detection. + */ + private AlertSeverity severity; + + /* + * Determines whether this severity is enabled or disabled for this source subtype consumed in Fusion detection. + */ + private boolean enabled; + + /** + * Creates an instance of FusionSubTypeSeverityFiltersItem class. + */ + public FusionSubTypeSeverityFiltersItem() { + } + + /** + * Get the severity property: The Severity for a given source subtype consumed in Fusion detection. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The Severity for a given source subtype consumed in Fusion detection. + * + * @param severity the severity value to set. + * @return the FusionSubTypeSeverityFiltersItem object itself. + */ + public FusionSubTypeSeverityFiltersItem withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the enabled property: Determines whether this severity is enabled or disabled for this source subtype + * consumed in Fusion detection. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether this severity is enabled or disabled for this source subtype + * consumed in Fusion detection. + * + * @param enabled the enabled value to set. + * @return the FusionSubTypeSeverityFiltersItem object itself. + */ + public FusionSubTypeSeverityFiltersItem withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (severity() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property severity in model FusionSubTypeSeverityFiltersItem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FusionSubTypeSeverityFiltersItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionSubTypeSeverityFiltersItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionSubTypeSeverityFiltersItem if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FusionSubTypeSeverityFiltersItem. + */ + public static FusionSubTypeSeverityFiltersItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionSubTypeSeverityFiltersItem deserializedFusionSubTypeSeverityFiltersItem + = new FusionSubTypeSeverityFiltersItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("severity".equals(fieldName)) { + deserializedFusionSubTypeSeverityFiltersItem.severity + = AlertSeverity.fromString(reader.getString()); + } else if ("enabled".equals(fieldName)) { + deserializedFusionSubTypeSeverityFiltersItem.enabled = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + + return deserializedFusionSubTypeSeverityFiltersItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSourceSetting.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSourceSetting.java new file mode 100644 index 000000000000..a0b5f08e7512 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSourceSetting.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a source signal consumed in Fusion detection. + */ +@Fluent +public final class FusionTemplateSourceSetting implements JsonSerializable { + /* + * The name of a source signal consumed in Fusion detection. + */ + private String sourceName; + + /* + * All supported source subtypes under this source signal consumed in fusion detection. + */ + private List sourceSubTypes; + + /** + * Creates an instance of FusionTemplateSourceSetting class. + */ + public FusionTemplateSourceSetting() { + } + + /** + * Get the sourceName property: The name of a source signal consumed in Fusion detection. + * + * @return the sourceName value. + */ + public String sourceName() { + return this.sourceName; + } + + /** + * Set the sourceName property: The name of a source signal consumed in Fusion detection. + * + * @param sourceName the sourceName value to set. + * @return the FusionTemplateSourceSetting object itself. + */ + public FusionTemplateSourceSetting withSourceName(String sourceName) { + this.sourceName = sourceName; + return this; + } + + /** + * Get the sourceSubTypes property: All supported source subtypes under this source signal consumed in fusion + * detection. + * + * @return the sourceSubTypes value. + */ + public List sourceSubTypes() { + return this.sourceSubTypes; + } + + /** + * Set the sourceSubTypes property: All supported source subtypes under this source signal consumed in fusion + * detection. + * + * @param sourceSubTypes the sourceSubTypes value to set. + * @return the FusionTemplateSourceSetting object itself. + */ + public FusionTemplateSourceSetting withSourceSubTypes(List sourceSubTypes) { + this.sourceSubTypes = sourceSubTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceName in model FusionTemplateSourceSetting")); + } + if (sourceSubTypes() != null) { + sourceSubTypes().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FusionTemplateSourceSetting.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceName", this.sourceName); + jsonWriter.writeArrayField("sourceSubTypes", this.sourceSubTypes, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionTemplateSourceSetting from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionTemplateSourceSetting if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FusionTemplateSourceSetting. + */ + public static FusionTemplateSourceSetting fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionTemplateSourceSetting deserializedFusionTemplateSourceSetting = new FusionTemplateSourceSetting(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceName".equals(fieldName)) { + deserializedFusionTemplateSourceSetting.sourceName = reader.getString(); + } else if ("sourceSubTypes".equals(fieldName)) { + List sourceSubTypes + = reader.readArray(reader1 -> FusionTemplateSourceSubType.fromJson(reader1)); + deserializedFusionTemplateSourceSetting.sourceSubTypes = sourceSubTypes; + } else { + reader.skipChildren(); + } + } + + return deserializedFusionTemplateSourceSetting; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSourceSubType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSourceSubType.java new file mode 100644 index 000000000000..1a1a44123857 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSourceSubType.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a source subtype under a source signal consumed in Fusion detection. + */ +@Fluent +public final class FusionTemplateSourceSubType implements JsonSerializable { + /* + * The name of source subtype under a source signal consumed in Fusion detection. + */ + private String sourceSubTypeName; + + /* + * The display name of source subtype under a source signal consumed in Fusion detection. + */ + private String sourceSubTypeDisplayName; + + /* + * Severity configuration available for a source subtype consumed in fusion detection. + */ + private FusionTemplateSubTypeSeverityFilter severityFilter; + + /** + * Creates an instance of FusionTemplateSourceSubType class. + */ + public FusionTemplateSourceSubType() { + } + + /** + * Get the sourceSubTypeName property: The name of source subtype under a source signal consumed in Fusion + * detection. + * + * @return the sourceSubTypeName value. + */ + public String sourceSubTypeName() { + return this.sourceSubTypeName; + } + + /** + * Set the sourceSubTypeName property: The name of source subtype under a source signal consumed in Fusion + * detection. + * + * @param sourceSubTypeName the sourceSubTypeName value to set. + * @return the FusionTemplateSourceSubType object itself. + */ + public FusionTemplateSourceSubType withSourceSubTypeName(String sourceSubTypeName) { + this.sourceSubTypeName = sourceSubTypeName; + return this; + } + + /** + * Get the sourceSubTypeDisplayName property: The display name of source subtype under a source signal consumed in + * Fusion detection. + * + * @return the sourceSubTypeDisplayName value. + */ + public String sourceSubTypeDisplayName() { + return this.sourceSubTypeDisplayName; + } + + /** + * Get the severityFilter property: Severity configuration available for a source subtype consumed in fusion + * detection. + * + * @return the severityFilter value. + */ + public FusionTemplateSubTypeSeverityFilter severityFilter() { + return this.severityFilter; + } + + /** + * Set the severityFilter property: Severity configuration available for a source subtype consumed in fusion + * detection. + * + * @param severityFilter the severityFilter value to set. + * @return the FusionTemplateSourceSubType object itself. + */ + public FusionTemplateSourceSubType withSeverityFilter(FusionTemplateSubTypeSeverityFilter severityFilter) { + this.severityFilter = severityFilter; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceSubTypeName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceSubTypeName in model FusionTemplateSourceSubType")); + } + if (severityFilter() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property severityFilter in model FusionTemplateSourceSubType")); + } else { + severityFilter().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FusionTemplateSourceSubType.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceSubTypeName", this.sourceSubTypeName); + jsonWriter.writeJsonField("severityFilter", this.severityFilter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionTemplateSourceSubType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionTemplateSourceSubType if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FusionTemplateSourceSubType. + */ + public static FusionTemplateSourceSubType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionTemplateSourceSubType deserializedFusionTemplateSourceSubType = new FusionTemplateSourceSubType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceSubTypeName".equals(fieldName)) { + deserializedFusionTemplateSourceSubType.sourceSubTypeName = reader.getString(); + } else if ("severityFilter".equals(fieldName)) { + deserializedFusionTemplateSourceSubType.severityFilter + = FusionTemplateSubTypeSeverityFilter.fromJson(reader); + } else if ("sourceSubTypeDisplayName".equals(fieldName)) { + deserializedFusionTemplateSourceSubType.sourceSubTypeDisplayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFusionTemplateSourceSubType; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSubTypeSeverityFilter.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSubTypeSeverityFilter.java new file mode 100644 index 000000000000..502032d159bd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/FusionTemplateSubTypeSeverityFilter.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents severity configurations available for a source subtype consumed in Fusion detection. + */ +@Fluent +public final class FusionTemplateSubTypeSeverityFilter + implements JsonSerializable { + /* + * Determines whether severity configuration is supported for this source subtype consumed in Fusion detection. + */ + private boolean isSupported; + + /* + * List of all supported severities for this source subtype consumed in Fusion detection. + */ + private List severityFilters; + + /** + * Creates an instance of FusionTemplateSubTypeSeverityFilter class. + */ + public FusionTemplateSubTypeSeverityFilter() { + } + + /** + * Get the isSupported property: Determines whether severity configuration is supported for this source subtype + * consumed in Fusion detection. + * + * @return the isSupported value. + */ + public boolean isSupported() { + return this.isSupported; + } + + /** + * Set the isSupported property: Determines whether severity configuration is supported for this source subtype + * consumed in Fusion detection. + * + * @param isSupported the isSupported value to set. + * @return the FusionTemplateSubTypeSeverityFilter object itself. + */ + public FusionTemplateSubTypeSeverityFilter withIsSupported(boolean isSupported) { + this.isSupported = isSupported; + return this; + } + + /** + * Get the severityFilters property: List of all supported severities for this source subtype consumed in Fusion + * detection. + * + * @return the severityFilters value. + */ + public List severityFilters() { + return this.severityFilters; + } + + /** + * Set the severityFilters property: List of all supported severities for this source subtype consumed in Fusion + * detection. + * + * @param severityFilters the severityFilters value to set. + * @return the FusionTemplateSubTypeSeverityFilter object itself. + */ + public FusionTemplateSubTypeSeverityFilter withSeverityFilters(List severityFilters) { + this.severityFilters = severityFilters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isSupported", this.isSupported); + jsonWriter.writeArrayField("severityFilters", this.severityFilters, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FusionTemplateSubTypeSeverityFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FusionTemplateSubTypeSeverityFilter if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FusionTemplateSubTypeSeverityFilter. + */ + public static FusionTemplateSubTypeSeverityFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FusionTemplateSubTypeSeverityFilter deserializedFusionTemplateSubTypeSeverityFilter + = new FusionTemplateSubTypeSeverityFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isSupported".equals(fieldName)) { + deserializedFusionTemplateSubTypeSeverityFilter.isSupported = reader.getBoolean(); + } else if ("severityFilters".equals(fieldName)) { + List severityFilters + = reader.readArray(reader1 -> AlertSeverity.fromString(reader1.getString())); + deserializedFusionTemplateSubTypeSeverityFilter.severityFilters = severityFilters; + } else { + reader.skipChildren(); + } + } + + return deserializedFusionTemplateSubTypeSeverityFilter; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpAuthModel.java new file mode 100644 index 000000000000..0a77c177b5c1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpAuthModel.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for API authentication for all GCP kind connectors. + */ +@Fluent +public final class GcpAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.GCP; + + /* + * GCP Service Account Email + */ + private String serviceAccountEmail; + + /* + * GCP Project Number + */ + private String projectNumber; + + /* + * GCP Workload Identity Provider ID + */ + private String workloadIdentityProviderId; + + /** + * Creates an instance of GcpAuthModel class. + */ + public GcpAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the serviceAccountEmail property: GCP Service Account Email. + * + * @return the serviceAccountEmail value. + */ + public String serviceAccountEmail() { + return this.serviceAccountEmail; + } + + /** + * Set the serviceAccountEmail property: GCP Service Account Email. + * + * @param serviceAccountEmail the serviceAccountEmail value to set. + * @return the GcpAuthModel object itself. + */ + public GcpAuthModel withServiceAccountEmail(String serviceAccountEmail) { + this.serviceAccountEmail = serviceAccountEmail; + return this; + } + + /** + * Get the projectNumber property: GCP Project Number. + * + * @return the projectNumber value. + */ + public String projectNumber() { + return this.projectNumber; + } + + /** + * Set the projectNumber property: GCP Project Number. + * + * @param projectNumber the projectNumber value to set. + * @return the GcpAuthModel object itself. + */ + public GcpAuthModel withProjectNumber(String projectNumber) { + this.projectNumber = projectNumber; + return this; + } + + /** + * Get the workloadIdentityProviderId property: GCP Workload Identity Provider ID. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: GCP Workload Identity Provider ID. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the GcpAuthModel object itself. + */ + public GcpAuthModel withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (serviceAccountEmail() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property serviceAccountEmail in model GcpAuthModel")); + } + if (projectNumber() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property projectNumber in model GcpAuthModel")); + } + if (workloadIdentityProviderId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property workloadIdentityProviderId in model GcpAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GcpAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceAccountEmail", this.serviceAccountEmail); + jsonWriter.writeStringField("projectNumber", this.projectNumber); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GcpAuthModel. + */ + public static GcpAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpAuthModel deserializedGcpAuthModel = new GcpAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceAccountEmail".equals(fieldName)) { + deserializedGcpAuthModel.serviceAccountEmail = reader.getString(); + } else if ("projectNumber".equals(fieldName)) { + deserializedGcpAuthModel.projectNumber = reader.getString(); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedGcpAuthModel.workloadIdentityProviderId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGcpAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpAuthProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpAuthProperties.java new file mode 100644 index 000000000000..76b7aa76b8c0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpAuthProperties.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Google Cloud Platform auth section properties. + */ +@Fluent +public final class GcpAuthProperties implements JsonSerializable { + /* + * The service account that is used to access the GCP project. + */ + private String serviceAccountEmail; + + /* + * The GCP project number. + */ + private String projectNumber; + + /* + * The workload identity provider id that is used to gain access to the GCP project. + */ + private String workloadIdentityProviderId; + + /** + * Creates an instance of GcpAuthProperties class. + */ + public GcpAuthProperties() { + } + + /** + * Get the serviceAccountEmail property: The service account that is used to access the GCP project. + * + * @return the serviceAccountEmail value. + */ + public String serviceAccountEmail() { + return this.serviceAccountEmail; + } + + /** + * Set the serviceAccountEmail property: The service account that is used to access the GCP project. + * + * @param serviceAccountEmail the serviceAccountEmail value to set. + * @return the GcpAuthProperties object itself. + */ + public GcpAuthProperties withServiceAccountEmail(String serviceAccountEmail) { + this.serviceAccountEmail = serviceAccountEmail; + return this; + } + + /** + * Get the projectNumber property: The GCP project number. + * + * @return the projectNumber value. + */ + public String projectNumber() { + return this.projectNumber; + } + + /** + * Set the projectNumber property: The GCP project number. + * + * @param projectNumber the projectNumber value to set. + * @return the GcpAuthProperties object itself. + */ + public GcpAuthProperties withProjectNumber(String projectNumber) { + this.projectNumber = projectNumber; + return this; + } + + /** + * Get the workloadIdentityProviderId property: The workload identity provider id that is used to gain access to the + * GCP project. + * + * @return the workloadIdentityProviderId value. + */ + public String workloadIdentityProviderId() { + return this.workloadIdentityProviderId; + } + + /** + * Set the workloadIdentityProviderId property: The workload identity provider id that is used to gain access to the + * GCP project. + * + * @param workloadIdentityProviderId the workloadIdentityProviderId value to set. + * @return the GcpAuthProperties object itself. + */ + public GcpAuthProperties withWorkloadIdentityProviderId(String workloadIdentityProviderId) { + this.workloadIdentityProviderId = workloadIdentityProviderId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceAccountEmail() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property serviceAccountEmail in model GcpAuthProperties")); + } + if (projectNumber() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property projectNumber in model GcpAuthProperties")); + } + if (workloadIdentityProviderId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property workloadIdentityProviderId in model GcpAuthProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GcpAuthProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceAccountEmail", this.serviceAccountEmail); + jsonWriter.writeStringField("projectNumber", this.projectNumber); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpAuthProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpAuthProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GcpAuthProperties. + */ + public static GcpAuthProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpAuthProperties deserializedGcpAuthProperties = new GcpAuthProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceAccountEmail".equals(fieldName)) { + deserializedGcpAuthProperties.serviceAccountEmail = reader.getString(); + } else if ("projectNumber".equals(fieldName)) { + deserializedGcpAuthProperties.projectNumber = reader.getString(); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedGcpAuthProperties.workloadIdentityProviderId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpAuthProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpDataConnector.java new file mode 100644 index 000000000000..4cf383196b0b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpDataConnector.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.GcpDataConnectorProperties; +import java.io.IOException; + +/** + * Represents Google Cloud Platform data connector. + */ +@Fluent +public final class GcpDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.GCP; + + /* + * Google Cloud Platform data connector properties. + */ + private GcpDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GcpDataConnector class. + */ + public GcpDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Google Cloud Platform data connector properties. + * + * @return the innerProperties value. + */ + private GcpDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public GcpDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the connectorDefinitionName property: The name of the connector definition that represents the UI config. + * + * @return the connectorDefinitionName value. + */ + public String connectorDefinitionName() { + return this.innerProperties() == null ? null : this.innerProperties().connectorDefinitionName(); + } + + /** + * Set the connectorDefinitionName property: The name of the connector definition that represents the UI config. + * + * @param connectorDefinitionName the connectorDefinitionName value to set. + * @return the GcpDataConnector object itself. + */ + public GcpDataConnector withConnectorDefinitionName(String connectorDefinitionName) { + if (this.innerProperties() == null) { + this.innerProperties = new GcpDataConnectorProperties(); + } + this.innerProperties().withConnectorDefinitionName(connectorDefinitionName); + return this; + } + + /** + * Get the auth property: The auth section of the connector. + * + * @return the auth value. + */ + public GcpAuthProperties auth() { + return this.innerProperties() == null ? null : this.innerProperties().auth(); + } + + /** + * Set the auth property: The auth section of the connector. + * + * @param auth the auth value to set. + * @return the GcpDataConnector object itself. + */ + public GcpDataConnector withAuth(GcpAuthProperties auth) { + if (this.innerProperties() == null) { + this.innerProperties = new GcpDataConnectorProperties(); + } + this.innerProperties().withAuth(auth); + return this; + } + + /** + * Get the request property: The request section of the connector. + * + * @return the request value. + */ + public GcpRequestProperties request() { + return this.innerProperties() == null ? null : this.innerProperties().request(); + } + + /** + * Set the request property: The request section of the connector. + * + * @param request the request value to set. + * @return the GcpDataConnector object itself. + */ + public GcpDataConnector withRequest(GcpRequestProperties request) { + if (this.innerProperties() == null) { + this.innerProperties = new GcpDataConnectorProperties(); + } + this.innerProperties().withRequest(request); + return this; + } + + /** + * Get the dcrConfig property: The configuration of the destination of the data. + * + * @return the dcrConfig value. + */ + public DcrConfiguration dcrConfig() { + return this.innerProperties() == null ? null : this.innerProperties().dcrConfig(); + } + + /** + * Set the dcrConfig property: The configuration of the destination of the data. + * + * @param dcrConfig the dcrConfig value to set. + * @return the GcpDataConnector object itself. + */ + public GcpDataConnector withDcrConfig(DcrConfiguration dcrConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new GcpDataConnectorProperties(); + } + this.innerProperties().withDcrConfig(dcrConfig); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpDataConnector if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GcpDataConnector. + */ + public static GcpDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpDataConnector deserializedGcpDataConnector = new GcpDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGcpDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGcpDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGcpDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedGcpDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedGcpDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedGcpDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedGcpDataConnector.innerProperties = GcpDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpRequestProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpRequestProperties.java new file mode 100644 index 000000000000..1df5457afa89 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GcpRequestProperties.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Google Cloud Platform request section properties. + */ +@Fluent +public final class GcpRequestProperties implements JsonSerializable { + /* + * The GCP project id. + */ + private String projectId; + + /* + * The GCP pub/sub subscription names. + */ + private List subscriptionNames; + + /** + * Creates an instance of GcpRequestProperties class. + */ + public GcpRequestProperties() { + } + + /** + * Get the projectId property: The GCP project id. + * + * @return the projectId value. + */ + public String projectId() { + return this.projectId; + } + + /** + * Set the projectId property: The GCP project id. + * + * @param projectId the projectId value to set. + * @return the GcpRequestProperties object itself. + */ + public GcpRequestProperties withProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Get the subscriptionNames property: The GCP pub/sub subscription names. + * + * @return the subscriptionNames value. + */ + public List subscriptionNames() { + return this.subscriptionNames; + } + + /** + * Set the subscriptionNames property: The GCP pub/sub subscription names. + * + * @param subscriptionNames the subscriptionNames value to set. + * @return the GcpRequestProperties object itself. + */ + public GcpRequestProperties withSubscriptionNames(List subscriptionNames) { + this.subscriptionNames = subscriptionNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (projectId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property projectId in model GcpRequestProperties")); + } + if (subscriptionNames() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property subscriptionNames in model GcpRequestProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GcpRequestProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("projectId", this.projectId); + jsonWriter.writeArrayField("subscriptionNames", this.subscriptionNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpRequestProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GcpRequestProperties. + */ + public static GcpRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpRequestProperties deserializedGcpRequestProperties = new GcpRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("projectId".equals(fieldName)) { + deserializedGcpRequestProperties.projectId = reader.getString(); + } else if ("subscriptionNames".equals(fieldName)) { + List subscriptionNames = reader.readArray(reader1 -> reader1.getString()); + deserializedGcpRequestProperties.subscriptionNames = subscriptionNames; + } else { + reader.skipChildren(); + } + } + + return deserializedGcpRequestProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GenericBlobSbsAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GenericBlobSbsAuthModel.java new file mode 100644 index 000000000000..81f2df90ce7f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GenericBlobSbsAuthModel.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Model for API authentication for working with service bus or storage account. + */ +@Fluent +public final class GenericBlobSbsAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.SERVICE_BUS; + + /* + * Credentials for service bus namespace, keyvault uri for access key + */ + private Map credentialsConfig; + + /* + * Credentials for storage account, keyvault uri for access key + */ + private Map storageAccountCredentialsConfig; + + /** + * Creates an instance of GenericBlobSbsAuthModel class. + */ + public GenericBlobSbsAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the credentialsConfig property: Credentials for service bus namespace, keyvault uri for access key. + * + * @return the credentialsConfig value. + */ + public Map credentialsConfig() { + return this.credentialsConfig; + } + + /** + * Set the credentialsConfig property: Credentials for service bus namespace, keyvault uri for access key. + * + * @param credentialsConfig the credentialsConfig value to set. + * @return the GenericBlobSbsAuthModel object itself. + */ + public GenericBlobSbsAuthModel withCredentialsConfig(Map credentialsConfig) { + this.credentialsConfig = credentialsConfig; + return this; + } + + /** + * Get the storageAccountCredentialsConfig property: Credentials for storage account, keyvault uri for access key. + * + * @return the storageAccountCredentialsConfig value. + */ + public Map storageAccountCredentialsConfig() { + return this.storageAccountCredentialsConfig; + } + + /** + * Set the storageAccountCredentialsConfig property: Credentials for storage account, keyvault uri for access key. + * + * @param storageAccountCredentialsConfig the storageAccountCredentialsConfig value to set. + * @return the GenericBlobSbsAuthModel object itself. + */ + public GenericBlobSbsAuthModel + withStorageAccountCredentialsConfig(Map storageAccountCredentialsConfig) { + this.storageAccountCredentialsConfig = storageAccountCredentialsConfig; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("credentialsConfig", this.credentialsConfig, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("storageAccountCredentialsConfig", this.storageAccountCredentialsConfig, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenericBlobSbsAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenericBlobSbsAuthModel if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the GenericBlobSbsAuthModel. + */ + public static GenericBlobSbsAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GenericBlobSbsAuthModel deserializedGenericBlobSbsAuthModel = new GenericBlobSbsAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedGenericBlobSbsAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else if ("credentialsConfig".equals(fieldName)) { + Map credentialsConfig = reader.readMap(reader1 -> reader1.getString()); + deserializedGenericBlobSbsAuthModel.credentialsConfig = credentialsConfig; + } else if ("storageAccountCredentialsConfig".equals(fieldName)) { + Map storageAccountCredentialsConfig + = reader.readMap(reader1 -> reader1.getString()); + deserializedGenericBlobSbsAuthModel.storageAccountCredentialsConfig + = storageAccountCredentialsConfig; + } else { + reader.skipChildren(); + } + } + + return deserializedGenericBlobSbsAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GeoLocation.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GeoLocation.java index 77e7bf4a7d00..84584886146a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GeoLocation.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GeoLocation.java @@ -37,16 +37,14 @@ public final class GeoLocation implements JsonSerializable { private String countryName; /* - * The longitude of the identified location, expressed as a floating point number with range of -180 to 180, with - * positive numbers representing East and negative numbers representing West. Latitude and longitude are derived - * from the city or postal code. + * The latitude of the identified location, expressed as a floating point number with range of - 90 to 90. Latitude + * and longitude are derived from the city or postal code. */ private Double latitude; /* - * The latitude of the identified location, expressed as a floating point number with range of - 90 to 90, with - * positive numbers representing North and negative numbers representing South. Latitude and longitude are derived - * from the city or postal code. + * The longitude of the identified location, expressed as a floating point number with range of -180 to 180. + * Latitude and longitude are derived from the city or postal code. */ private Double longitude; @@ -99,9 +97,8 @@ public String countryName() { } /** - * Get the latitude property: The longitude of the identified location, expressed as a floating point number with - * range of -180 to 180, with positive numbers representing East and negative numbers representing West. Latitude - * and longitude are derived from the city or postal code. + * Get the latitude property: The latitude of the identified location, expressed as a floating point number with + * range of - 90 to 90. Latitude and longitude are derived from the city or postal code. * * @return the latitude value. */ @@ -110,9 +107,8 @@ public Double latitude() { } /** - * Get the longitude property: The latitude of the identified location, expressed as a floating point number with - * range of - 90 to 90, with positive numbers representing North and negative numbers representing South. Latitude - * and longitude are derived from the city or postal code. + * Get the longitude property: The longitude of the identified location, expressed as a floating point number with + * range of -180 to 180. Latitude and longitude are derived from the city or postal code. * * @return the longitude value. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsError.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsError.java new file mode 100644 index 000000000000..f08e777c4183 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsError.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * the query kind. + */ +public final class GetInsightsError extends ExpandableStringEnum { + /** + * Static value Insight for GetInsightsError. + */ + public static final GetInsightsError INSIGHT = fromString("Insight"); + + /** + * Creates a new instance of GetInsightsError value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GetInsightsError() { + } + + /** + * Creates or finds a GetInsightsError from its string representation. + * + * @param name a name to look for. + * @return the corresponding GetInsightsError. + */ + public static GetInsightsError fromString(String name) { + return fromString(name, GetInsightsError.class); + } + + /** + * Gets known GetInsightsError values. + * + * @return known GetInsightsError values. + */ + public static Collection values() { + return values(GetInsightsError.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsErrorKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsErrorKind.java new file mode 100644 index 000000000000..3d3f9b30c839 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsErrorKind.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * GetInsights Query Errors. + */ +@Fluent +public final class GetInsightsErrorKind implements JsonSerializable { + /* + * the query kind + */ + private GetInsightsError kind; + + /* + * the query id + */ + private String queryId; + + /* + * the error message + */ + private String errorMessage; + + /** + * Creates an instance of GetInsightsErrorKind class. + */ + public GetInsightsErrorKind() { + } + + /** + * Get the kind property: the query kind. + * + * @return the kind value. + */ + public GetInsightsError kind() { + return this.kind; + } + + /** + * Set the kind property: the query kind. + * + * @param kind the kind value to set. + * @return the GetInsightsErrorKind object itself. + */ + public GetInsightsErrorKind withKind(GetInsightsError kind) { + this.kind = kind; + return this; + } + + /** + * Get the queryId property: the query id. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: the query id. + * + * @param queryId the queryId value to set. + * @return the GetInsightsErrorKind object itself. + */ + public GetInsightsErrorKind withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the errorMessage property: the error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set the errorMessage property: the error message. + * + * @param errorMessage the errorMessage value to set. + * @return the GetInsightsErrorKind object itself. + */ + public GetInsightsErrorKind withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (kind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property kind in model GetInsightsErrorKind")); + } + if (errorMessage() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property errorMessage in model GetInsightsErrorKind")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GetInsightsErrorKind.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeStringField("queryId", this.queryId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetInsightsErrorKind from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetInsightsErrorKind if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetInsightsErrorKind. + */ + public static GetInsightsErrorKind fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetInsightsErrorKind deserializedGetInsightsErrorKind = new GetInsightsErrorKind(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedGetInsightsErrorKind.kind = GetInsightsError.fromString(reader.getString()); + } else if ("errorMessage".equals(fieldName)) { + deserializedGetInsightsErrorKind.errorMessage = reader.getString(); + } else if ("queryId".equals(fieldName)) { + deserializedGetInsightsErrorKind.queryId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGetInsightsErrorKind; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsResultsMetadata.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsResultsMetadata.java new file mode 100644 index 000000000000..e155ac48fe29 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetInsightsResultsMetadata.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Get Insights result metadata. + */ +@Fluent +public final class GetInsightsResultsMetadata implements JsonSerializable { + /* + * the total items found for the insights request + */ + private int totalCount; + + /* + * information about the failed queries + */ + private List errors; + + /** + * Creates an instance of GetInsightsResultsMetadata class. + */ + public GetInsightsResultsMetadata() { + } + + /** + * Get the totalCount property: the total items found for the insights request. + * + * @return the totalCount value. + */ + public int totalCount() { + return this.totalCount; + } + + /** + * Set the totalCount property: the total items found for the insights request. + * + * @param totalCount the totalCount value to set. + * @return the GetInsightsResultsMetadata object itself. + */ + public GetInsightsResultsMetadata withTotalCount(int totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Get the errors property: information about the failed queries. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Set the errors property: information about the failed queries. + * + * @param errors the errors value to set. + * @return the GetInsightsResultsMetadata object itself. + */ + public GetInsightsResultsMetadata withErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("totalCount", this.totalCount); + jsonWriter.writeArrayField("errors", this.errors, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetInsightsResultsMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetInsightsResultsMetadata if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetInsightsResultsMetadata. + */ + public static GetInsightsResultsMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetInsightsResultsMetadata deserializedGetInsightsResultsMetadata = new GetInsightsResultsMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalCount".equals(fieldName)) { + deserializedGetInsightsResultsMetadata.totalCount = reader.getInt(); + } else if ("errors".equals(fieldName)) { + List errors + = reader.readArray(reader1 -> GetInsightsErrorKind.fromJson(reader1)); + deserializedGetInsightsResultsMetadata.errors = errors; + } else { + reader.skipChildren(); + } + } + + return deserializedGetInsightsResultsMetadata; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetQueriesResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetQueriesResponse.java new file mode 100644 index 000000000000..53c63668a342 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetQueriesResponse.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner; +import java.io.IOException; +import java.util.List; + +/** + * Retrieve queries for entity result operation response. + */ +@Fluent +public final class GetQueriesResponse implements JsonSerializable { + /* + * The query result values. + */ + private List value; + + /** + * Creates an instance of GetQueriesResponse class. + */ + public GetQueriesResponse() { + } + + /** + * Get the value property: The query result values. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The query result values. + * + * @param value the value value to set. + * @return the GetQueriesResponse object itself. + */ + public GetQueriesResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetQueriesResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetQueriesResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GetQueriesResponse. + */ + public static GetQueriesResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetQueriesResponse deserializedGetQueriesResponse = new GetQueriesResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> EntityQueryItemInner.fromJson(reader1)); + deserializedGetQueriesResponse.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedGetQueriesResponse; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetRecommendations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetRecommendations.java new file mode 100644 index 000000000000..f5a1b6694454 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetRecommendations.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of GetRecommendations. + */ +public interface GetRecommendations { + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets a list of all recommendations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all recommendations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetTriggeredAnalyticsRuleRuns.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetTriggeredAnalyticsRuleRuns.java new file mode 100644 index 000000000000..db24a2119227 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GetTriggeredAnalyticsRuleRuns.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of GetTriggeredAnalyticsRuleRuns. + */ +public interface GetTriggeredAnalyticsRuleRuns { + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets the triggered analytics rule runs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule runs as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Gets.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Gets.java new file mode 100644 index 000000000000..e7875a857b83 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Gets.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of Gets. + */ +public interface Gets { + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id along with {@link Response}. + */ + Response singleRecommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, Context context); + + /** + * Gets a recommendation by its id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation by its id. + */ + Recommendation singleRecommendation(String resourceGroupName, String workspaceName, UUID recommendationId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GitHubAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GitHubAuthModel.java new file mode 100644 index 000000000000..ab8f0453006f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GitHubAuthModel.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for API authentication for GitHub. For this authentication first we need to approve the Router app (Microsoft + * Security DevOps) to access the GitHub account, Then we only need the InstallationId to get the access token from + * https://api.github.com/app/installations/{installId}/access_tokens. + */ +@Fluent +public final class GitHubAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.GIT_HUB; + + /* + * The GitHubApp auth installation id. + */ + private String installationId; + + /** + * Creates an instance of GitHubAuthModel class. + */ + public GitHubAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the installationId property: The GitHubApp auth installation id. + * + * @return the installationId value. + */ + public String installationId() { + return this.installationId; + } + + /** + * Set the installationId property: The GitHubApp auth installation id. + * + * @param installationId the installationId value to set. + * @return the GitHubAuthModel object itself. + */ + public GitHubAuthModel withInstallationId(String installationId) { + this.installationId = installationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("installationId", this.installationId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitHubAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GitHubAuthModel. + */ + public static GitHubAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubAuthModel deserializedGitHubAuthModel = new GitHubAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedGitHubAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else if ("installationId".equals(fieldName)) { + deserializedGitHubAuthModel.installationId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GitHubResourceInfo.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GitHubResourceInfo.java new file mode 100644 index 000000000000..fedee0e34c9f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GitHubResourceInfo.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resources created in GitHub repository. + */ +@Fluent +public final class GitHubResourceInfo implements JsonSerializable { + /* + * GitHub application installation id. + */ + private String appInstallationId; + + /** + * Creates an instance of GitHubResourceInfo class. + */ + public GitHubResourceInfo() { + } + + /** + * Get the appInstallationId property: GitHub application installation id. + * + * @return the appInstallationId value. + */ + public String appInstallationId() { + return this.appInstallationId; + } + + /** + * Set the appInstallationId property: GitHub application installation id. + * + * @param appInstallationId the appInstallationId value to set. + * @return the GitHubResourceInfo object itself. + */ + public GitHubResourceInfo withAppInstallationId(String appInstallationId) { + this.appInstallationId = appInstallationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("appInstallationId", this.appInstallationId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitHubResourceInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubResourceInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GitHubResourceInfo. + */ + public static GitHubResourceInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubResourceInfo deserializedGitHubResourceInfo = new GitHubResourceInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("appInstallationId".equals(fieldName)) { + deserializedGitHubResourceInfo.appInstallationId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubResourceInfo; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GraphQueries.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GraphQueries.java new file mode 100644 index 000000000000..0b88ce8c3569 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GraphQueries.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The graph query to show the current data status. + */ +@Fluent +public class GraphQueries implements JsonSerializable { + /* + * the metric that the query is checking + */ + private String metricName; + + /* + * The legend for the graph + */ + private String legend; + + /* + * The base query for the graph + */ + private String baseQuery; + + /** + * Creates an instance of GraphQueries class. + */ + public GraphQueries() { + } + + /** + * Get the metricName property: the metric that the query is checking. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: the metric that the query is checking. + * + * @param metricName the metricName value to set. + * @return the GraphQueries object itself. + */ + public GraphQueries withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the legend property: The legend for the graph. + * + * @return the legend value. + */ + public String legend() { + return this.legend; + } + + /** + * Set the legend property: The legend for the graph. + * + * @param legend the legend value to set. + * @return the GraphQueries object itself. + */ + public GraphQueries withLegend(String legend) { + this.legend = legend; + return this; + } + + /** + * Get the baseQuery property: The base query for the graph. + * + * @return the baseQuery value. + */ + public String baseQuery() { + return this.baseQuery; + } + + /** + * Set the baseQuery property: The base query for the graph. + * + * @param baseQuery the baseQuery value to set. + * @return the GraphQueries object itself. + */ + public GraphQueries withBaseQuery(String baseQuery) { + this.baseQuery = baseQuery; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("metricName", this.metricName); + jsonWriter.writeStringField("legend", this.legend); + jsonWriter.writeStringField("baseQuery", this.baseQuery); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GraphQueries from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GraphQueries if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GraphQueries. + */ + public static GraphQueries fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GraphQueries deserializedGraphQueries = new GraphQueries(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metricName".equals(fieldName)) { + deserializedGraphQueries.metricName = reader.getString(); + } else if ("legend".equals(fieldName)) { + deserializedGraphQueries.legend = reader.getString(); + } else if ("baseQuery".equals(fieldName)) { + deserializedGraphQueries.baseQuery = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGraphQueries; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GraphQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GraphQuery.java new file mode 100644 index 000000000000..019899a4d753 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/GraphQuery.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The graph query to show the volume of data arriving into the workspace over time. + */ +@Fluent +public final class GraphQuery implements JsonSerializable { + /* + * Gets or sets the metric name that the query is checking. For example: 'Total data receive'. + */ + private String metricName; + + /* + * Gets or sets the legend for the graph. + */ + private String legend; + + /* + * Gets or sets the base query for the graph. + * The base query is wrapped by Sentinel UI infra with a KQL query, that measures the volume over time. + */ + private String baseQuery; + + /** + * Creates an instance of GraphQuery class. + */ + public GraphQuery() { + } + + /** + * Get the metricName property: Gets or sets the metric name that the query is checking. For example: 'Total data + * receive'. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: Gets or sets the metric name that the query is checking. For example: 'Total data + * receive'. + * + * @param metricName the metricName value to set. + * @return the GraphQuery object itself. + */ + public GraphQuery withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the legend property: Gets or sets the legend for the graph. + * + * @return the legend value. + */ + public String legend() { + return this.legend; + } + + /** + * Set the legend property: Gets or sets the legend for the graph. + * + * @param legend the legend value to set. + * @return the GraphQuery object itself. + */ + public GraphQuery withLegend(String legend) { + this.legend = legend; + return this; + } + + /** + * Get the baseQuery property: Gets or sets the base query for the graph. + * The base query is wrapped by Sentinel UI infra with a KQL query, that measures the volume over time. + * + * @return the baseQuery value. + */ + public String baseQuery() { + return this.baseQuery; + } + + /** + * Set the baseQuery property: Gets or sets the base query for the graph. + * The base query is wrapped by Sentinel UI infra with a KQL query, that measures the volume over time. + * + * @param baseQuery the baseQuery value to set. + * @return the GraphQuery object itself. + */ + public GraphQuery withBaseQuery(String baseQuery) { + this.baseQuery = baseQuery; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metricName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property metricName in model GraphQuery")); + } + if (legend() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property legend in model GraphQuery")); + } + if (baseQuery() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property baseQuery in model GraphQuery")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GraphQuery.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("metricName", this.metricName); + jsonWriter.writeStringField("legend", this.legend); + jsonWriter.writeStringField("baseQuery", this.baseQuery); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GraphQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GraphQuery if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GraphQuery. + */ + public static GraphQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GraphQuery deserializedGraphQuery = new GraphQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metricName".equals(fieldName)) { + deserializedGraphQuery.metricName = reader.getString(); + } else if ("legend".equals(fieldName)) { + deserializedGraphQuery.legend = reader.getString(); + } else if ("baseQuery".equals(fieldName)) { + deserializedGraphQuery.baseQuery = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGraphQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HostEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HostEntity.java index e472ae3c7496..5197a40d7b71 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HostEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HostEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.HostEntityProperties; import java.io.IOException; import java.util.Map; @@ -17,7 +18,7 @@ * Represents a host entity. */ @Fluent -public final class HostEntity extends Entity { +public final class HostEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HttpMethodVerb.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HttpMethodVerb.java new file mode 100644 index 000000000000..93be13473040 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HttpMethodVerb.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The HTTP method, default value GET. + */ +public final class HttpMethodVerb extends ExpandableStringEnum { + /** + * Static value GET for HttpMethodVerb. + */ + public static final HttpMethodVerb GET = fromString("GET"); + + /** + * Static value POST for HttpMethodVerb. + */ + public static final HttpMethodVerb POST = fromString("POST"); + + /** + * Static value PUT for HttpMethodVerb. + */ + public static final HttpMethodVerb PUT = fromString("PUT"); + + /** + * Static value DELETE for HttpMethodVerb. + */ + public static final HttpMethodVerb DELETE = fromString("DELETE"); + + /** + * Creates a new instance of HttpMethodVerb value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HttpMethodVerb() { + } + + /** + * Creates or finds a HttpMethodVerb from its string representation. + * + * @param name a name to look for. + * @return the corresponding HttpMethodVerb. + */ + public static HttpMethodVerb fromString(String name) { + return fromString(name, HttpMethodVerb.class); + } + + /** + * Gets known HttpMethodVerb values. + * + * @return known HttpMethodVerb values. + */ + public static Collection values() { + return values(HttpMethodVerb.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HttpsConfigurationType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HttpsConfigurationType.java new file mode 100644 index 000000000000..4be9bff36dd1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HttpsConfigurationType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents the types of HTTPS configuration to connect to the SapControl service. + */ +public final class HttpsConfigurationType extends ExpandableStringEnum { + /** + * Static value HttpOnly for HttpsConfigurationType. + */ + public static final HttpsConfigurationType HTTP_ONLY = fromString("HttpOnly"); + + /** + * Static value HttpsWithSslVerification for HttpsConfigurationType. + */ + public static final HttpsConfigurationType HTTPS_WITH_SSL_VERIFICATION = fromString("HttpsWithSslVerification"); + + /** + * Static value HttpsWithoutSslVerification for HttpsConfigurationType. + */ + public static final HttpsConfigurationType HTTPS_WITHOUT_SSL_VERIFICATION + = fromString("HttpsWithoutSslVerification"); + + /** + * Creates a new instance of HttpsConfigurationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HttpsConfigurationType() { + } + + /** + * Creates or finds a HttpsConfigurationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HttpsConfigurationType. + */ + public static HttpsConfigurationType fromString(String name) { + return fromString(name, HttpsConfigurationType.class); + } + + /** + * Gets known HttpsConfigurationType values. + * + * @return known HttpsConfigurationType values. + */ + public static Collection values() { + return values(HttpsConfigurationType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Hunt.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Hunt.java new file mode 100644 index 000000000000..16e7ad2fc19d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Hunt.java @@ -0,0 +1,459 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntInner; +import java.util.List; + +/** + * An immutable client-side representation of Hunt. + */ +public interface Hunt { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the displayName property: The display name of the hunt. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: The description of the hunt. + * + * @return the description value. + */ + String description(); + + /** + * Gets the status property: The status of the hunt. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the hypothesisStatus property: The hypothesis status of the hunt. + * + * @return the hypothesisStatus value. + */ + HypothesisStatus hypothesisStatus(); + + /** + * Gets the attackTactics property: A list of mitre attack tactics the hunt is associated with. + * + * @return the attackTactics value. + */ + List attackTactics(); + + /** + * Gets the attackTechniques property: A list of a mitre attack techniques the hunt is associated with. + * + * @return the attackTechniques value. + */ + List attackTechniques(); + + /** + * Gets the labels property: List of labels relevant to this hunt. + * + * @return the labels value. + */ + List labels(); + + /** + * Gets the owner property: Describes a user that the hunt is assigned to. + * + * @return the owner value. + */ + HuntOwner owner(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.HuntInner object. + * + * @return the inner object. + */ + HuntInner innerModel(); + + /** + * The entirety of the Hunt definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Hunt definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Hunt definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Hunt definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the Hunt definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithEtag, DefinitionStages.WithDisplayName, DefinitionStages.WithDescription, + DefinitionStages.WithStatus, DefinitionStages.WithHypothesisStatus, DefinitionStages.WithAttackTactics, + DefinitionStages.WithAttackTechniques, DefinitionStages.WithLabels, DefinitionStages.WithOwner { + /** + * Executes the create request. + * + * @return the created resource. + */ + Hunt create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Hunt create(Context context); + } + + /** + * The stage of the Hunt definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the Hunt definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the hunt. + * + * @param displayName The display name of the hunt. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the Hunt definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the hunt. + * + * @param description The description of the hunt. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the Hunt definition allowing to specify status. + */ + interface WithStatus { + /** + * Specifies the status property: The status of the hunt.. + * + * @param status The status of the hunt. + * @return the next definition stage. + */ + WithCreate withStatus(Status status); + } + + /** + * The stage of the Hunt definition allowing to specify hypothesisStatus. + */ + interface WithHypothesisStatus { + /** + * Specifies the hypothesisStatus property: The hypothesis status of the hunt.. + * + * @param hypothesisStatus The hypothesis status of the hunt. + * @return the next definition stage. + */ + WithCreate withHypothesisStatus(HypothesisStatus hypothesisStatus); + } + + /** + * The stage of the Hunt definition allowing to specify attackTactics. + */ + interface WithAttackTactics { + /** + * Specifies the attackTactics property: A list of mitre attack tactics the hunt is associated with. + * + * @param attackTactics A list of mitre attack tactics the hunt is associated with. + * @return the next definition stage. + */ + WithCreate withAttackTactics(List attackTactics); + } + + /** + * The stage of the Hunt definition allowing to specify attackTechniques. + */ + interface WithAttackTechniques { + /** + * Specifies the attackTechniques property: A list of a mitre attack techniques the hunt is associated with. + * + * @param attackTechniques A list of a mitre attack techniques the hunt is associated with. + * @return the next definition stage. + */ + WithCreate withAttackTechniques(List attackTechniques); + } + + /** + * The stage of the Hunt definition allowing to specify labels. + */ + interface WithLabels { + /** + * Specifies the labels property: List of labels relevant to this hunt . + * + * @param labels List of labels relevant to this hunt. + * @return the next definition stage. + */ + WithCreate withLabels(List labels); + } + + /** + * The stage of the Hunt definition allowing to specify owner. + */ + interface WithOwner { + /** + * Specifies the owner property: Describes a user that the hunt is assigned to. + * + * @param owner Describes a user that the hunt is assigned to. + * @return the next definition stage. + */ + WithCreate withOwner(HuntOwner owner); + } + } + + /** + * Begins update for the Hunt resource. + * + * @return the stage of resource update. + */ + Hunt.Update update(); + + /** + * The template for Hunt update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithDisplayName, UpdateStages.WithDescription, + UpdateStages.WithStatus, UpdateStages.WithHypothesisStatus, UpdateStages.WithAttackTactics, + UpdateStages.WithAttackTechniques, UpdateStages.WithLabels, UpdateStages.WithOwner { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Hunt apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Hunt apply(Context context); + } + + /** + * The Hunt update stages. + */ + interface UpdateStages { + /** + * The stage of the Hunt update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the Hunt update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the hunt. + * + * @param displayName The display name of the hunt. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the Hunt update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the hunt. + * + * @param description The description of the hunt. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the Hunt update allowing to specify status. + */ + interface WithStatus { + /** + * Specifies the status property: The status of the hunt.. + * + * @param status The status of the hunt. + * @return the next definition stage. + */ + Update withStatus(Status status); + } + + /** + * The stage of the Hunt update allowing to specify hypothesisStatus. + */ + interface WithHypothesisStatus { + /** + * Specifies the hypothesisStatus property: The hypothesis status of the hunt.. + * + * @param hypothesisStatus The hypothesis status of the hunt. + * @return the next definition stage. + */ + Update withHypothesisStatus(HypothesisStatus hypothesisStatus); + } + + /** + * The stage of the Hunt update allowing to specify attackTactics. + */ + interface WithAttackTactics { + /** + * Specifies the attackTactics property: A list of mitre attack tactics the hunt is associated with. + * + * @param attackTactics A list of mitre attack tactics the hunt is associated with. + * @return the next definition stage. + */ + Update withAttackTactics(List attackTactics); + } + + /** + * The stage of the Hunt update allowing to specify attackTechniques. + */ + interface WithAttackTechniques { + /** + * Specifies the attackTechniques property: A list of a mitre attack techniques the hunt is associated with. + * + * @param attackTechniques A list of a mitre attack techniques the hunt is associated with. + * @return the next definition stage. + */ + Update withAttackTechniques(List attackTechniques); + } + + /** + * The stage of the Hunt update allowing to specify labels. + */ + interface WithLabels { + /** + * Specifies the labels property: List of labels relevant to this hunt . + * + * @param labels List of labels relevant to this hunt. + * @return the next definition stage. + */ + Update withLabels(List labels); + } + + /** + * The stage of the Hunt update allowing to specify owner. + */ + interface WithOwner { + /** + * Specifies the owner property: Describes a user that the hunt is assigned to. + * + * @param owner Describes a user that the hunt is assigned to. + * @return the next definition stage. + */ + Update withOwner(HuntOwner owner); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Hunt refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Hunt refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntComment.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntComment.java new file mode 100644 index 000000000000..d37c134b2302 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntComment.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntCommentInner; + +/** + * An immutable client-side representation of HuntComment. + */ +public interface HuntComment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the message property: The message for the comment. + * + * @return the message value. + */ + String message(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.HuntCommentInner object. + * + * @return the inner object. + */ + HuntCommentInner innerModel(); + + /** + * The entirety of the HuntComment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The HuntComment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the HuntComment definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the HuntComment definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName, huntId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @return the next definition stage. + */ + WithCreate withExistingHunt(String resourceGroupName, String workspaceName, String huntId); + } + + /** + * The stage of the HuntComment definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithMessage { + /** + * Executes the create request. + * + * @return the created resource. + */ + HuntComment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + HuntComment create(Context context); + } + + /** + * The stage of the HuntComment definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the HuntComment definition allowing to specify message. + */ + interface WithMessage { + /** + * Specifies the message property: The message for the comment. + * + * @param message The message for the comment. + * @return the next definition stage. + */ + WithCreate withMessage(String message); + } + } + + /** + * Begins update for the HuntComment resource. + * + * @return the stage of resource update. + */ + HuntComment.Update update(); + + /** + * The template for HuntComment update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithMessage { + /** + * Executes the update request. + * + * @return the updated resource. + */ + HuntComment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + HuntComment apply(Context context); + } + + /** + * The HuntComment update stages. + */ + interface UpdateStages { + /** + * The stage of the HuntComment update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the HuntComment update allowing to specify message. + */ + interface WithMessage { + /** + * Specifies the message property: The message for the comment. + * + * @param message The message for the comment. + * @return the next definition stage. + */ + Update withMessage(String message); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + HuntComment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + HuntComment refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntCommentList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntCommentList.java new file mode 100644 index 000000000000..bdf9be2ba0c7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntCommentList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntCommentInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all hunt comments. + */ +@Fluent +public final class HuntCommentList implements JsonSerializable { + /* + * URL to fetch the next set of hunt comments. + */ + private String nextLink; + + /* + * Array of hunt comments + */ + private List value; + + /** + * Creates an instance of HuntCommentList class. + */ + public HuntCommentList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of hunt comments. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of hunt comments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of hunt comments. + * + * @param value the value value to set. + * @return the HuntCommentList object itself. + */ + public HuntCommentList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model HuntCommentList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HuntCommentList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntCommentList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntCommentList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntCommentList. + */ + public static HuntCommentList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntCommentList deserializedHuntCommentList = new HuntCommentList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> HuntCommentInner.fromJson(reader1)); + deserializedHuntCommentList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedHuntCommentList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntCommentList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntComments.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntComments.java new file mode 100644 index 000000000000..248b93c5d3a8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntComments.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of HuntComments. + */ +public interface HuntComments { + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String huntId); + + /** + * Gets all hunt comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt comments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String huntId, String filter, + String orderby, Integer top, String skipToken, Context context); + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context); + + /** + * Gets a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment. + */ + HuntComment get(String resourceGroupName, String workspaceName, String huntId, String huntCommentId); + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntCommentId, Context context); + + /** + * Delete a hunt comment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntCommentId The hunt comment id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String huntId, String huntCommentId); + + /** + * Gets a hunt comment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment along with {@link Response}. + */ + HuntComment getById(String id); + + /** + * Gets a hunt comment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt comment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a hunt comment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a hunt comment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new HuntComment resource. + * + * @param name resource name. + * @return the first stage of the new HuntComment definition. + */ + HuntComment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntList.java new file mode 100644 index 000000000000..199581a41bf9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntInner; +import java.io.IOException; +import java.util.List; + +/** + * List all the hunts. + */ +@Fluent +public final class HuntList implements JsonSerializable { + /* + * URL to fetch the next set of hunts. + */ + private String nextLink; + + /* + * Array of hunts. + */ + private List value; + + /** + * Creates an instance of HuntList class. + */ + public HuntList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of hunts. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of hunts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of hunts. + * + * @param value the value value to set. + * @return the HuntList object itself. + */ + public HuntList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model HuntList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HuntList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntList if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntList. + */ + public static HuntList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntList deserializedHuntList = new HuntList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> HuntInner.fromJson(reader1)); + deserializedHuntList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedHuntList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntOwner.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntOwner.java new file mode 100644 index 000000000000..41dca0e0b6de --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntOwner.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; +import java.util.UUID; + +/** + * Describes a user that the hunt is assigned to. + */ +@Fluent +public final class HuntOwner implements JsonSerializable { + /* + * The email of the user the hunt is assigned to. + */ + private String email; + + /* + * The name of the user the hunt is assigned to. + */ + private String assignedTo; + + /* + * The object id of the user the hunt is assigned to. + */ + private UUID objectId; + + /* + * The user principal name of the user the hunt is assigned to. + */ + private String userPrincipalName; + + /* + * The type of the owner the hunt is assigned to. + */ + private OwnerType ownerType; + + /** + * Creates an instance of HuntOwner class. + */ + public HuntOwner() { + } + + /** + * Get the email property: The email of the user the hunt is assigned to. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: The email of the user the hunt is assigned to. + * + * @param email the email value to set. + * @return the HuntOwner object itself. + */ + public HuntOwner withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the assignedTo property: The name of the user the hunt is assigned to. + * + * @return the assignedTo value. + */ + public String assignedTo() { + return this.assignedTo; + } + + /** + * Set the assignedTo property: The name of the user the hunt is assigned to. + * + * @param assignedTo the assignedTo value to set. + * @return the HuntOwner object itself. + */ + public HuntOwner withAssignedTo(String assignedTo) { + this.assignedTo = assignedTo; + return this; + } + + /** + * Get the objectId property: The object id of the user the hunt is assigned to. + * + * @return the objectId value. + */ + public UUID objectId() { + return this.objectId; + } + + /** + * Set the objectId property: The object id of the user the hunt is assigned to. + * + * @param objectId the objectId value to set. + * @return the HuntOwner object itself. + */ + public HuntOwner withObjectId(UUID objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the userPrincipalName property: The user principal name of the user the hunt is assigned to. + * + * @return the userPrincipalName value. + */ + public String userPrincipalName() { + return this.userPrincipalName; + } + + /** + * Set the userPrincipalName property: The user principal name of the user the hunt is assigned to. + * + * @param userPrincipalName the userPrincipalName value to set. + * @return the HuntOwner object itself. + */ + public HuntOwner withUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + return this; + } + + /** + * Get the ownerType property: The type of the owner the hunt is assigned to. + * + * @return the ownerType value. + */ + public OwnerType ownerType() { + return this.ownerType; + } + + /** + * Set the ownerType property: The type of the owner the hunt is assigned to. + * + * @param ownerType the ownerType value to set. + * @return the HuntOwner object itself. + */ + public HuntOwner withOwnerType(OwnerType ownerType) { + this.ownerType = ownerType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("email", this.email); + jsonWriter.writeStringField("assignedTo", this.assignedTo); + jsonWriter.writeStringField("objectId", Objects.toString(this.objectId, null)); + jsonWriter.writeStringField("userPrincipalName", this.userPrincipalName); + jsonWriter.writeStringField("ownerType", this.ownerType == null ? null : this.ownerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntOwner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntOwner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the HuntOwner. + */ + public static HuntOwner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntOwner deserializedHuntOwner = new HuntOwner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("email".equals(fieldName)) { + deserializedHuntOwner.email = reader.getString(); + } else if ("assignedTo".equals(fieldName)) { + deserializedHuntOwner.assignedTo = reader.getString(); + } else if ("objectId".equals(fieldName)) { + deserializedHuntOwner.objectId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userPrincipalName".equals(fieldName)) { + deserializedHuntOwner.userPrincipalName = reader.getString(); + } else if ("ownerType".equals(fieldName)) { + deserializedHuntOwner.ownerType = OwnerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntOwner; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelation.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelation.java new file mode 100644 index 000000000000..3f684e33bcb8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelation.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntRelationInner; +import java.util.List; + +/** + * An immutable client-side representation of HuntRelation. + */ +public interface HuntRelation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the relatedResourceId property: The id of the related resource. + * + * @return the relatedResourceId value. + */ + String relatedResourceId(); + + /** + * Gets the relatedResourceName property: The name of the related resource. + * + * @return the relatedResourceName value. + */ + String relatedResourceName(); + + /** + * Gets the relationType property: The type of the hunt relation. + * + * @return the relationType value. + */ + String relationType(); + + /** + * Gets the relatedResourceKind property: The resource that the relation is related to. + * + * @return the relatedResourceKind value. + */ + String relatedResourceKind(); + + /** + * Gets the labels property: List of labels relevant to this hunt. + * + * @return the labels value. + */ + List labels(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.HuntRelationInner object. + * + * @return the inner object. + */ + HuntRelationInner innerModel(); + + /** + * The entirety of the HuntRelation definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The HuntRelation definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the HuntRelation definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the HuntRelation definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName, huntId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @return the next definition stage. + */ + WithCreate withExistingHunt(String resourceGroupName, String workspaceName, String huntId); + } + + /** + * The stage of the HuntRelation definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithEtag, DefinitionStages.WithRelatedResourceId, DefinitionStages.WithLabels { + /** + * Executes the create request. + * + * @return the created resource. + */ + HuntRelation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + HuntRelation create(Context context); + } + + /** + * The stage of the HuntRelation definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the HuntRelation definition allowing to specify relatedResourceId. + */ + interface WithRelatedResourceId { + /** + * Specifies the relatedResourceId property: The id of the related resource. + * + * @param relatedResourceId The id of the related resource. + * @return the next definition stage. + */ + WithCreate withRelatedResourceId(String relatedResourceId); + } + + /** + * The stage of the HuntRelation definition allowing to specify labels. + */ + interface WithLabels { + /** + * Specifies the labels property: List of labels relevant to this hunt. + * + * @param labels List of labels relevant to this hunt. + * @return the next definition stage. + */ + WithCreate withLabels(List labels); + } + } + + /** + * Begins update for the HuntRelation resource. + * + * @return the stage of resource update. + */ + HuntRelation.Update update(); + + /** + * The template for HuntRelation update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithRelatedResourceId, UpdateStages.WithLabels { + /** + * Executes the update request. + * + * @return the updated resource. + */ + HuntRelation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + HuntRelation apply(Context context); + } + + /** + * The HuntRelation update stages. + */ + interface UpdateStages { + /** + * The stage of the HuntRelation update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the HuntRelation update allowing to specify relatedResourceId. + */ + interface WithRelatedResourceId { + /** + * Specifies the relatedResourceId property: The id of the related resource. + * + * @param relatedResourceId The id of the related resource. + * @return the next definition stage. + */ + Update withRelatedResourceId(String relatedResourceId); + } + + /** + * The stage of the HuntRelation update allowing to specify labels. + */ + interface WithLabels { + /** + * Specifies the labels property: List of labels relevant to this hunt. + * + * @param labels List of labels relevant to this hunt. + * @return the next definition stage. + */ + Update withLabels(List labels); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + HuntRelation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + HuntRelation refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelationList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelationList.java new file mode 100644 index 000000000000..845dd7f32892 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelationList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.HuntRelationInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the hunt relations. + */ +@Fluent +public final class HuntRelationList implements JsonSerializable { + /* + * URL to fetch the next set of hunt relations. + */ + private String nextLink; + + /* + * Array of hunt relations + */ + private List value; + + /** + * Creates an instance of HuntRelationList class. + */ + public HuntRelationList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of hunt relations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of hunt relations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of hunt relations. + * + * @param value the value value to set. + * @return the HuntRelationList object itself. + */ + public HuntRelationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model HuntRelationList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HuntRelationList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HuntRelationList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HuntRelationList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HuntRelationList. + */ + public static HuntRelationList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HuntRelationList deserializedHuntRelationList = new HuntRelationList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> HuntRelationInner.fromJson(reader1)); + deserializedHuntRelationList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedHuntRelationList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHuntRelationList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelations.java new file mode 100644 index 000000000000..bcbd2e7f4375 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntRelations.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of HuntRelations. + */ +public interface HuntRelations { + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String huntId); + + /** + * Gets all hunt relations. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunt relations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String huntId, String filter, + String orderby, Integer top, String skipToken, Context context); + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context); + + /** + * Gets a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation. + */ + HuntRelation get(String resourceGroupName, String workspaceName, String huntId, String huntRelationId); + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, + String huntRelationId, Context context); + + /** + * Delete a hunt relation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param huntRelationId The hunt relation id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String huntId, String huntRelationId); + + /** + * Gets a hunt relation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation along with {@link Response}. + */ + HuntRelation getById(String id); + + /** + * Gets a hunt relation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt relation along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a hunt relation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a hunt relation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new HuntRelation resource. + * + * @param name resource name. + * @return the first stage of the new HuntRelation definition. + */ + HuntRelation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntingBookmark.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntingBookmark.java index 34b7f678cec6..228c5ac86071 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntingBookmark.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HuntingBookmark.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.HuntingBookmarkProperties; import java.io.IOException; import java.time.OffsetDateTime; @@ -19,7 +20,7 @@ * Represents a Hunting bookmark entity. */ @Fluent -public final class HuntingBookmark extends Entity { +public final class HuntingBookmark extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Hunts.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Hunts.java new file mode 100644 index 000000000000..116f9c338106 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Hunts.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Hunts. + */ +public interface Hunts { + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all hunts, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all hunts, without relations and comments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, Integer top, + String skipToken, Context context); + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String huntId, Context context); + + /** + * Gets a hunt, without relations and comments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments. + */ + Hunt get(String resourceGroupName, String workspaceName, String huntId); + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String huntId, Context context); + + /** + * Delete a hunt. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param huntId The hunt id (GUID). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String huntId); + + /** + * Gets a hunt, without relations and comments. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments along with {@link Response}. + */ + Hunt getById(String id); + + /** + * Gets a hunt, without relations and comments. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a hunt, without relations and comments along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a hunt. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a hunt. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Hunt resource. + * + * @param name resource name. + * @return the first stage of the new Hunt definition. + */ + Hunt.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HypothesisStatus.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HypothesisStatus.java new file mode 100644 index 000000000000..5b7c023bb87f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/HypothesisStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The hypothesis status of the hunt. + */ +public final class HypothesisStatus extends ExpandableStringEnum { + /** + * Static value Unknown for HypothesisStatus. + */ + public static final HypothesisStatus UNKNOWN = fromString("Unknown"); + + /** + * Static value Invalidated for HypothesisStatus. + */ + public static final HypothesisStatus INVALIDATED = fromString("Invalidated"); + + /** + * Static value Validated for HypothesisStatus. + */ + public static final HypothesisStatus VALIDATED = fromString("Validated"); + + /** + * Creates a new instance of HypothesisStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HypothesisStatus() { + } + + /** + * Creates or finds a HypothesisStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding HypothesisStatus. + */ + public static HypothesisStatus fromString(String name) { + return fromString(name, HypothesisStatus.class); + } + + /** + * Gets known HypothesisStatus values. + * + * @return known HypothesisStatus values. + */ + public static Collection values() { + return values(HypothesisStatus.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Identity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Identity.java new file mode 100644 index 000000000000..47146aca22b7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Identity.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectCommonProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Represents an identity in Azure Security Insights. + */ +@Immutable +public final class Identity extends TIObjectInner { + /* + * The kind of the TI object + */ + private TIObjectKind kind = TIObjectKind.IDENTITY; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The properties of the TI object + */ + private TIObjectCommonProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of Identity class. + */ + public Identity() { + } + + /** + * Get the kind property: The kind of the TI object. + * + * @return the kind value. + */ + @Override + public TIObjectKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of the TI object. + * + * @return the innerProperties value. + */ + private TIObjectCommonProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + public Map data() { + return this.innerProperties() == null ? null : this.innerProperties().data(); + } + + /** + * Get the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the source property: The source name for this TI object. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Get the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + public OffsetDateTime firstIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().firstIngestedTimeUtc(); + } + + /** + * Get the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + public OffsetDateTime lastIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastIngestedTimeUtc(); + } + + /** + * Get the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + public UUID ingestionRulesVersion() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionRulesVersion(); + } + + /** + * Get the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + public String lastUpdateMethod() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateMethod(); + } + + /** + * Get the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + public UserInfo lastModifiedBy() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy(); + } + + /** + * Get the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateTimeUtc(); + } + + /** + * Get the relationshipHints property: A dictionary used to help follow relationships from this object to other STIX + * objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of sources + * that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + public List relationshipHints() { + return this.innerProperties() == null ? null : this.innerProperties().relationshipHints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Identity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Identity if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Identity. + */ + public static Identity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Identity deserializedIdentity = new Identity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIdentity.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIdentity.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIdentity.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIdentity.innerProperties = TIObjectCommonProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedIdentity.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedIdentity.kind = TIObjectKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIdentity; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incident.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incident.java index d57eb8a39872..33f9007d7e72 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incident.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incident.java @@ -51,74 +51,74 @@ public interface Incident { SystemData systemData(); /** - * Gets the additionalData property: Additional data on the incident. + * Gets the title property: The title of the incident. * - * @return the additionalData value. + * @return the title value. */ - IncidentAdditionalData additionalData(); + String title(); /** - * Gets the classification property: The reason the incident was closed. + * Gets the description property: The description of the incident. * - * @return the classification value. + * @return the description value. */ - IncidentClassification classification(); + String description(); /** - * Gets the classificationComment property: Describes the reason the incident was closed. + * Gets the severity property: The severity of the incident. * - * @return the classificationComment value. + * @return the severity value. */ - String classificationComment(); + IncidentSeverity severity(); /** - * Gets the classificationReason property: The classification reason the incident was closed with. + * Gets the status property: The status of the incident. * - * @return the classificationReason value. + * @return the status value. */ - IncidentClassificationReason classificationReason(); + IncidentStatus status(); /** - * Gets the createdTimeUtc property: The time the incident was created. + * Gets the classification property: The reason the incident was closed. * - * @return the createdTimeUtc value. + * @return the classification value. */ - OffsetDateTime createdTimeUtc(); + IncidentClassification classification(); /** - * Gets the description property: The description of the incident. + * Gets the classificationReason property: The classification reason the incident was closed with. * - * @return the description value. + * @return the classificationReason value. */ - String description(); + IncidentClassificationReason classificationReason(); /** - * Gets the firstActivityTimeUtc property: The time of the first activity in the incident. + * Gets the classificationComment property: Describes the reason the incident was closed. * - * @return the firstActivityTimeUtc value. + * @return the classificationComment value. */ - OffsetDateTime firstActivityTimeUtc(); + String classificationComment(); /** - * Gets the incidentUrl property: The deep-link url to the incident in Azure portal. + * Gets the owner property: Describes a user that the incident is assigned to. * - * @return the incidentUrl value. + * @return the owner value. */ - String incidentUrl(); + IncidentOwnerInfo owner(); /** - * Gets the incidentNumber property: A sequential number. + * Gets the labels property: List of labels relevant to this incident. * - * @return the incidentNumber value. + * @return the labels value. */ - Integer incidentNumber(); + List labels(); /** - * Gets the labels property: List of labels relevant to this incident. + * Gets the firstActivityTimeUtc property: The time of the first activity in the incident. * - * @return the labels value. + * @return the firstActivityTimeUtc value. */ - List labels(); + OffsetDateTime firstActivityTimeUtc(); /** * Gets the lastActivityTimeUtc property: The time of the last activity in the incident. @@ -135,11 +135,25 @@ public interface Incident { OffsetDateTime lastModifiedTimeUtc(); /** - * Gets the owner property: Describes a user that the incident is assigned to. + * Gets the createdTimeUtc property: The time the incident was created. * - * @return the owner value. + * @return the createdTimeUtc value. */ - IncidentOwnerInfo owner(); + OffsetDateTime createdTimeUtc(); + + /** + * Gets the incidentNumber property: A sequential number. + * + * @return the incidentNumber value. + */ + Integer incidentNumber(); + + /** + * Gets the additionalData property: Additional data on the incident. + * + * @return the additionalData value. + */ + IncidentAdditionalData additionalData(); /** * Gets the relatedAnalyticRuleIds property: List of resource ids of Analytic rules related to the incident. @@ -149,25 +163,32 @@ public interface Incident { List relatedAnalyticRuleIds(); /** - * Gets the severity property: The severity of the incident. + * Gets the incidentUrl property: The deep-link url to the incident in Azure portal. * - * @return the severity value. + * @return the incidentUrl value. */ - IncidentSeverity severity(); + String incidentUrl(); /** - * Gets the status property: The status of the incident. + * Gets the providerName property: The name of the source provider that generated the incident. * - * @return the status value. + * @return the providerName value. */ - IncidentStatus status(); + String providerName(); /** - * Gets the title property: The title of the incident. + * Gets the providerIncidentId property: The incident ID assigned by the incident provider. * - * @return the title value. + * @return the providerIncidentId value. */ - String title(); + String providerIncidentId(); + + /** + * Gets the teamInformation property: Describes a team for the incident. + * + * @return the teamInformation value. + */ + TeamInformation teamInformation(); /** * Gets the name of the resource group. @@ -218,11 +239,12 @@ interface WithParentResource { * The stage of the Incident definition which contains all the minimum required properties for the resource to * be created, but also allows for any other optional properties to be specified. */ - interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithClassification, - DefinitionStages.WithClassificationComment, DefinitionStages.WithClassificationReason, - DefinitionStages.WithDescription, DefinitionStages.WithFirstActivityTimeUtc, DefinitionStages.WithLabels, - DefinitionStages.WithLastActivityTimeUtc, DefinitionStages.WithOwner, DefinitionStages.WithSeverity, - DefinitionStages.WithStatus, DefinitionStages.WithTitle { + interface WithCreate + extends DefinitionStages.WithEtag, DefinitionStages.WithTitle, DefinitionStages.WithDescription, + DefinitionStages.WithSeverity, DefinitionStages.WithStatus, DefinitionStages.WithClassification, + DefinitionStages.WithClassificationReason, DefinitionStages.WithClassificationComment, + DefinitionStages.WithOwner, DefinitionStages.WithLabels, DefinitionStages.WithFirstActivityTimeUtc, + DefinitionStages.WithLastActivityTimeUtc, DefinitionStages.WithTeamInformation { /** * Executes the create request. * @@ -253,94 +275,94 @@ interface WithEtag { } /** - * The stage of the Incident definition allowing to specify classification. + * The stage of the Incident definition allowing to specify title. */ - interface WithClassification { + interface WithTitle { /** - * Specifies the classification property: The reason the incident was closed. + * Specifies the title property: The title of the incident. * - * @param classification The reason the incident was closed. + * @param title The title of the incident. * @return the next definition stage. */ - WithCreate withClassification(IncidentClassification classification); + WithCreate withTitle(String title); } /** - * The stage of the Incident definition allowing to specify classificationComment. + * The stage of the Incident definition allowing to specify description. */ - interface WithClassificationComment { + interface WithDescription { /** - * Specifies the classificationComment property: Describes the reason the incident was closed. + * Specifies the description property: The description of the incident. * - * @param classificationComment Describes the reason the incident was closed. + * @param description The description of the incident. * @return the next definition stage. */ - WithCreate withClassificationComment(String classificationComment); + WithCreate withDescription(String description); } /** - * The stage of the Incident definition allowing to specify classificationReason. + * The stage of the Incident definition allowing to specify severity. */ - interface WithClassificationReason { + interface WithSeverity { /** - * Specifies the classificationReason property: The classification reason the incident was closed with. + * Specifies the severity property: The severity of the incident. * - * @param classificationReason The classification reason the incident was closed with. + * @param severity The severity of the incident. * @return the next definition stage. */ - WithCreate withClassificationReason(IncidentClassificationReason classificationReason); + WithCreate withSeverity(IncidentSeverity severity); } /** - * The stage of the Incident definition allowing to specify description. + * The stage of the Incident definition allowing to specify status. */ - interface WithDescription { + interface WithStatus { /** - * Specifies the description property: The description of the incident. + * Specifies the status property: The status of the incident. * - * @param description The description of the incident. + * @param status The status of the incident. * @return the next definition stage. */ - WithCreate withDescription(String description); + WithCreate withStatus(IncidentStatus status); } /** - * The stage of the Incident definition allowing to specify firstActivityTimeUtc. + * The stage of the Incident definition allowing to specify classification. */ - interface WithFirstActivityTimeUtc { + interface WithClassification { /** - * Specifies the firstActivityTimeUtc property: The time of the first activity in the incident. + * Specifies the classification property: The reason the incident was closed. * - * @param firstActivityTimeUtc The time of the first activity in the incident. + * @param classification The reason the incident was closed. * @return the next definition stage. */ - WithCreate withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc); + WithCreate withClassification(IncidentClassification classification); } /** - * The stage of the Incident definition allowing to specify labels. + * The stage of the Incident definition allowing to specify classificationReason. */ - interface WithLabels { + interface WithClassificationReason { /** - * Specifies the labels property: List of labels relevant to this incident. + * Specifies the classificationReason property: The classification reason the incident was closed with. * - * @param labels List of labels relevant to this incident. + * @param classificationReason The classification reason the incident was closed with. * @return the next definition stage. */ - WithCreate withLabels(List labels); + WithCreate withClassificationReason(IncidentClassificationReason classificationReason); } /** - * The stage of the Incident definition allowing to specify lastActivityTimeUtc. + * The stage of the Incident definition allowing to specify classificationComment. */ - interface WithLastActivityTimeUtc { + interface WithClassificationComment { /** - * Specifies the lastActivityTimeUtc property: The time of the last activity in the incident. + * Specifies the classificationComment property: Describes the reason the incident was closed. * - * @param lastActivityTimeUtc The time of the last activity in the incident. + * @param classificationComment Describes the reason the incident was closed. * @return the next definition stage. */ - WithCreate withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc); + WithCreate withClassificationComment(String classificationComment); } /** @@ -357,42 +379,55 @@ interface WithOwner { } /** - * The stage of the Incident definition allowing to specify severity. + * The stage of the Incident definition allowing to specify labels. */ - interface WithSeverity { + interface WithLabels { /** - * Specifies the severity property: The severity of the incident. + * Specifies the labels property: List of labels relevant to this incident. * - * @param severity The severity of the incident. + * @param labels List of labels relevant to this incident. * @return the next definition stage. */ - WithCreate withSeverity(IncidentSeverity severity); + WithCreate withLabels(List labels); } /** - * The stage of the Incident definition allowing to specify status. + * The stage of the Incident definition allowing to specify firstActivityTimeUtc. */ - interface WithStatus { + interface WithFirstActivityTimeUtc { /** - * Specifies the status property: The status of the incident. + * Specifies the firstActivityTimeUtc property: The time of the first activity in the incident. * - * @param status The status of the incident. + * @param firstActivityTimeUtc The time of the first activity in the incident. * @return the next definition stage. */ - WithCreate withStatus(IncidentStatus status); + WithCreate withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc); } /** - * The stage of the Incident definition allowing to specify title. + * The stage of the Incident definition allowing to specify lastActivityTimeUtc. */ - interface WithTitle { + interface WithLastActivityTimeUtc { /** - * Specifies the title property: The title of the incident. + * Specifies the lastActivityTimeUtc property: The time of the last activity in the incident. * - * @param title The title of the incident. + * @param lastActivityTimeUtc The time of the last activity in the incident. * @return the next definition stage. */ - WithCreate withTitle(String title); + WithCreate withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc); + } + + /** + * The stage of the Incident definition allowing to specify teamInformation. + */ + interface WithTeamInformation { + /** + * Specifies the teamInformation property: Describes a team for the incident. + * + * @param teamInformation Describes a team for the incident. + * @return the next definition stage. + */ + WithCreate withTeamInformation(TeamInformation teamInformation); } } @@ -406,10 +441,11 @@ interface WithTitle { /** * The template for Incident update. */ - interface Update extends UpdateStages.WithEtag, UpdateStages.WithClassification, - UpdateStages.WithClassificationComment, UpdateStages.WithClassificationReason, UpdateStages.WithDescription, - UpdateStages.WithFirstActivityTimeUtc, UpdateStages.WithLabels, UpdateStages.WithLastActivityTimeUtc, - UpdateStages.WithOwner, UpdateStages.WithSeverity, UpdateStages.WithStatus, UpdateStages.WithTitle { + interface Update + extends UpdateStages.WithEtag, UpdateStages.WithTitle, UpdateStages.WithDescription, UpdateStages.WithSeverity, + UpdateStages.WithStatus, UpdateStages.WithClassification, UpdateStages.WithClassificationReason, + UpdateStages.WithClassificationComment, UpdateStages.WithOwner, UpdateStages.WithLabels, + UpdateStages.WithFirstActivityTimeUtc, UpdateStages.WithLastActivityTimeUtc, UpdateStages.WithTeamInformation { /** * Executes the update request. * @@ -444,94 +480,94 @@ interface WithEtag { } /** - * The stage of the Incident update allowing to specify classification. + * The stage of the Incident update allowing to specify title. */ - interface WithClassification { + interface WithTitle { /** - * Specifies the classification property: The reason the incident was closed. + * Specifies the title property: The title of the incident. * - * @param classification The reason the incident was closed. + * @param title The title of the incident. * @return the next definition stage. */ - Update withClassification(IncidentClassification classification); + Update withTitle(String title); } /** - * The stage of the Incident update allowing to specify classificationComment. + * The stage of the Incident update allowing to specify description. */ - interface WithClassificationComment { + interface WithDescription { /** - * Specifies the classificationComment property: Describes the reason the incident was closed. + * Specifies the description property: The description of the incident. * - * @param classificationComment Describes the reason the incident was closed. + * @param description The description of the incident. * @return the next definition stage. */ - Update withClassificationComment(String classificationComment); + Update withDescription(String description); } /** - * The stage of the Incident update allowing to specify classificationReason. + * The stage of the Incident update allowing to specify severity. */ - interface WithClassificationReason { + interface WithSeverity { /** - * Specifies the classificationReason property: The classification reason the incident was closed with. + * Specifies the severity property: The severity of the incident. * - * @param classificationReason The classification reason the incident was closed with. + * @param severity The severity of the incident. * @return the next definition stage. */ - Update withClassificationReason(IncidentClassificationReason classificationReason); + Update withSeverity(IncidentSeverity severity); } /** - * The stage of the Incident update allowing to specify description. + * The stage of the Incident update allowing to specify status. */ - interface WithDescription { + interface WithStatus { /** - * Specifies the description property: The description of the incident. + * Specifies the status property: The status of the incident. * - * @param description The description of the incident. + * @param status The status of the incident. * @return the next definition stage. */ - Update withDescription(String description); + Update withStatus(IncidentStatus status); } /** - * The stage of the Incident update allowing to specify firstActivityTimeUtc. + * The stage of the Incident update allowing to specify classification. */ - interface WithFirstActivityTimeUtc { + interface WithClassification { /** - * Specifies the firstActivityTimeUtc property: The time of the first activity in the incident. + * Specifies the classification property: The reason the incident was closed. * - * @param firstActivityTimeUtc The time of the first activity in the incident. + * @param classification The reason the incident was closed. * @return the next definition stage. */ - Update withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc); + Update withClassification(IncidentClassification classification); } /** - * The stage of the Incident update allowing to specify labels. + * The stage of the Incident update allowing to specify classificationReason. */ - interface WithLabels { + interface WithClassificationReason { /** - * Specifies the labels property: List of labels relevant to this incident. + * Specifies the classificationReason property: The classification reason the incident was closed with. * - * @param labels List of labels relevant to this incident. + * @param classificationReason The classification reason the incident was closed with. * @return the next definition stage. */ - Update withLabels(List labels); + Update withClassificationReason(IncidentClassificationReason classificationReason); } /** - * The stage of the Incident update allowing to specify lastActivityTimeUtc. + * The stage of the Incident update allowing to specify classificationComment. */ - interface WithLastActivityTimeUtc { + interface WithClassificationComment { /** - * Specifies the lastActivityTimeUtc property: The time of the last activity in the incident. + * Specifies the classificationComment property: Describes the reason the incident was closed. * - * @param lastActivityTimeUtc The time of the last activity in the incident. + * @param classificationComment Describes the reason the incident was closed. * @return the next definition stage. */ - Update withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc); + Update withClassificationComment(String classificationComment); } /** @@ -548,42 +584,55 @@ interface WithOwner { } /** - * The stage of the Incident update allowing to specify severity. + * The stage of the Incident update allowing to specify labels. */ - interface WithSeverity { + interface WithLabels { /** - * Specifies the severity property: The severity of the incident. + * Specifies the labels property: List of labels relevant to this incident. * - * @param severity The severity of the incident. + * @param labels List of labels relevant to this incident. * @return the next definition stage. */ - Update withSeverity(IncidentSeverity severity); + Update withLabels(List labels); } /** - * The stage of the Incident update allowing to specify status. + * The stage of the Incident update allowing to specify firstActivityTimeUtc. */ - interface WithStatus { + interface WithFirstActivityTimeUtc { /** - * Specifies the status property: The status of the incident. + * Specifies the firstActivityTimeUtc property: The time of the first activity in the incident. * - * @param status The status of the incident. + * @param firstActivityTimeUtc The time of the first activity in the incident. * @return the next definition stage. */ - Update withStatus(IncidentStatus status); + Update withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc); } /** - * The stage of the Incident update allowing to specify title. + * The stage of the Incident update allowing to specify lastActivityTimeUtc. */ - interface WithTitle { + interface WithLastActivityTimeUtc { /** - * Specifies the title property: The title of the incident. + * Specifies the lastActivityTimeUtc property: The time of the last activity in the incident. * - * @param title The title of the incident. + * @param lastActivityTimeUtc The time of the last activity in the incident. * @return the next definition stage. */ - Update withTitle(String title); + Update withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc); + } + + /** + * The stage of the Incident update allowing to specify teamInformation. + */ + interface WithTeamInformation { + /** + * Specifies the teamInformation property: Describes a team for the incident. + * + * @param teamInformation Describes a team for the incident. + * @return the next definition stage. + */ + Update withTeamInformation(TeamInformation teamInformation); } } @@ -603,62 +652,62 @@ interface WithTitle { Incident refresh(Context context); /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident along with {@link Response}. + * @return all incident alerts along with {@link Response}. */ Response listAlertsWithResponse(Context context); /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident. + * @return all incident alerts. */ IncidentAlertList listAlerts(); /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident along with {@link Response}. + * @return all incident bookmarks along with {@link Response}. */ Response listBookmarksWithResponse(Context context); /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident. + * @return all incident bookmarks. */ IncidentBookmarkList listBookmarks(); /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident along with {@link Response}. + * @return all incident related entities along with {@link Response}. */ Response listEntitiesWithResponse(Context context); /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident. + * @return all incident related entities. */ IncidentEntitiesResponse listEntities(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentAdditionalData.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentAdditionalData.java index d193bc8a8af3..f51496968e56 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentAdditionalData.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentAdditionalData.java @@ -42,6 +42,26 @@ public final class IncidentAdditionalData implements JsonSerializable tactics; + /* + * The techniques associated with incident's tactics + */ + private List techniques; + + /* + * The provider incident url to the incident in Microsoft 365 Defender portal + */ + private String providerIncidentUrl; + + /* + * The incident number of the incident that the current incident was merged into + */ + private String mergedIncidentNumber; + + /* + * The URL to the incident that the current incident was merged into + */ + private String mergedIncidentUrl; + /** * Creates an instance of IncidentAdditionalData class. */ @@ -93,6 +113,43 @@ public List tactics() { return this.tactics; } + /** + * Get the techniques property: The techniques associated with incident's tactics. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Get the providerIncidentUrl property: The provider incident url to the incident in Microsoft 365 Defender portal. + * + * @return the providerIncidentUrl value. + */ + public String providerIncidentUrl() { + return this.providerIncidentUrl; + } + + /** + * Get the mergedIncidentNumber property: The incident number of the incident that the current incident was merged + * into. + * + * @return the mergedIncidentNumber value. + */ + public String mergedIncidentNumber() { + return this.mergedIncidentNumber; + } + + /** + * Get the mergedIncidentUrl property: The URL to the incident that the current incident was merged into. + * + * @return the mergedIncidentUrl value. + */ + public String mergedIncidentUrl() { + return this.mergedIncidentUrl; + } + /** * Validates the instance. * @@ -138,6 +195,15 @@ public static IncidentAdditionalData fromJson(JsonReader jsonReader) throws IOEx List tactics = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString())); deserializedIncidentAdditionalData.tactics = tactics; + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedIncidentAdditionalData.techniques = techniques; + } else if ("providerIncidentUrl".equals(fieldName)) { + deserializedIncidentAdditionalData.providerIncidentUrl = reader.getString(); + } else if ("mergedIncidentNumber".equals(fieldName)) { + deserializedIncidentAdditionalData.mergedIncidentNumber = reader.getString(); + } else if ("mergedIncidentUrl".equals(fieldName)) { + deserializedIncidentAdditionalData.mergedIncidentUrl = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComment.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComment.java index 9388f3e915f1..2a5a616aefda 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComment.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComment.java @@ -48,6 +48,13 @@ public interface IncidentComment { */ SystemData systemData(); + /** + * Gets the message property: The comment message. + * + * @return the message value. + */ + String message(); + /** * Gets the createdTimeUtc property: The time the comment was created. * @@ -62,13 +69,6 @@ public interface IncidentComment { */ OffsetDateTime lastModifiedTimeUtc(); - /** - * Gets the message property: The comment message. - * - * @return the message value. - */ - String message(); - /** * Gets the author property: Describes the client that created the comment. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentCommentList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentCommentList.java index 35b1a08f5d39..4cbd6470825a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentCommentList.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentCommentList.java @@ -15,19 +15,19 @@ import java.util.List; /** - * List of incident comments. + * The IncidentCommentList model. */ @Fluent public final class IncidentCommentList implements JsonSerializable { /* - * URL to fetch the next set of comments. + * The value property. */ - private String nextLink; + private List value; /* - * Array of comments. + * The nextLink property. */ - private List value; + private String nextLink; /** * Creates an instance of IncidentCommentList class. @@ -36,16 +36,7 @@ public IncidentCommentList() { } /** - * Get the nextLink property: URL to fetch the next set of comments. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Get the value property: Array of comments. + * Get the value property: The value property. * * @return the value value. */ @@ -54,7 +45,7 @@ public List value() { } /** - * Set the value property: Array of comments. + * Set the value property: The value property. * * @param value the value value to set. * @return the IncidentCommentList object itself. @@ -64,6 +55,15 @@ public IncidentCommentList withValue(List value) { return this; } + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComments.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComments.java index 8670cc25bf44..da1cb988f9dc 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComments.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentComments.java @@ -13,7 +13,7 @@ */ public interface IncidentComments { /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -21,12 +21,12 @@ public interface IncidentComments { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedIterable}. + * @return all incident comments as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all comments for a given incident. + * Gets all incident comments. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -41,13 +41,13 @@ public interface IncidentComments { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all comments for a given incident as paginated response with {@link PagedIterable}. + * @return all incident comments as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, String filter, String orderby, Integer top, String skipToken, Context context); /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -57,13 +57,13 @@ PagedIterable list(String resourceGroupName, String workspaceNa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident along with {@link Response}. + * @return an incident comment along with {@link Response}. */ Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, String incidentCommentId, Context context); /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -72,12 +72,12 @@ Response getWithResponse(String resourceGroupName, String works * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident. + * @return an incident comment. */ IncidentComment get(String resourceGroupName, String workspaceName, String incidentId, String incidentCommentId); /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -93,7 +93,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName String incidentCommentId, Context context); /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -106,30 +106,30 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName void delete(String resourceGroupName, String workspaceName, String incidentId, String incidentCommentId); /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident along with {@link Response}. + * @return an incident comment along with {@link Response}. */ IncidentComment getById(String id); /** - * Gets a comment for a given incident. + * Gets an incident comment. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a comment for a given incident along with {@link Response}. + * @return an incident comment along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -139,7 +139,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName void deleteById(String id); /** - * Deletes a comment for a given incident. + * Delete the incident comment. * * @param id the resource ID. * @param context The context to associate with this operation. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentEntitiesResultsMetadata.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentEntitiesResultsMetadata.java index 7bc08ed6a4ec..d5b866feb8c7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentEntitiesResultsMetadata.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentEntitiesResultsMetadata.java @@ -18,14 +18,14 @@ @Fluent public final class IncidentEntitiesResultsMetadata implements JsonSerializable { /* - * Total number of aggregations of the given kind in the incident related entities result. + * The kind of the aggregated entity. */ - private int count; + private EntityKindEnum entityKind; /* - * The kind of the aggregated entity. + * Total number of aggregations of the given kind in the incident related entities result. */ - private EntityKindEnum entityKind; + private int count; /** * Creates an instance of IncidentEntitiesResultsMetadata class. @@ -34,42 +34,42 @@ public IncidentEntitiesResultsMetadata() { } /** - * Get the count property: Total number of aggregations of the given kind in the incident related entities result. + * Get the entityKind property: The kind of the aggregated entity. * - * @return the count value. + * @return the entityKind value. */ - public int count() { - return this.count; + public EntityKindEnum entityKind() { + return this.entityKind; } /** - * Set the count property: Total number of aggregations of the given kind in the incident related entities result. + * Set the entityKind property: The kind of the aggregated entity. * - * @param count the count value to set. + * @param entityKind the entityKind value to set. * @return the IncidentEntitiesResultsMetadata object itself. */ - public IncidentEntitiesResultsMetadata withCount(int count) { - this.count = count; + public IncidentEntitiesResultsMetadata withEntityKind(EntityKindEnum entityKind) { + this.entityKind = entityKind; return this; } /** - * Get the entityKind property: The kind of the aggregated entity. + * Get the count property: Total number of aggregations of the given kind in the incident related entities result. * - * @return the entityKind value. + * @return the count value. */ - public EntityKindEnum entityKind() { - return this.entityKind; + public int count() { + return this.count; } /** - * Set the entityKind property: The kind of the aggregated entity. + * Set the count property: Total number of aggregations of the given kind in the incident related entities result. * - * @param entityKind the entityKind value to set. + * @param count the count value to set. * @return the IncidentEntitiesResultsMetadata object itself. */ - public IncidentEntitiesResultsMetadata withEntityKind(EntityKindEnum entityKind) { - this.entityKind = entityKind; + public IncidentEntitiesResultsMetadata withCount(int count) { + this.count = count; return this; } @@ -94,8 +94,8 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeIntField("count", this.count); jsonWriter.writeStringField("entityKind", this.entityKind == null ? null : this.entityKind.toString()); + jsonWriter.writeIntField("count", this.count); return jsonWriter.writeEndObject(); } @@ -116,11 +116,11 @@ public static IncidentEntitiesResultsMetadata fromJson(JsonReader jsonReader) th String fieldName = reader.getFieldName(); reader.nextToken(); - if ("count".equals(fieldName)) { - deserializedIncidentEntitiesResultsMetadata.count = reader.getInt(); - } else if ("entityKind".equals(fieldName)) { + if ("entityKind".equals(fieldName)) { deserializedIncidentEntitiesResultsMetadata.entityKind = EntityKindEnum.fromString(reader.getString()); + } else if ("count".equals(fieldName)) { + deserializedIncidentEntitiesResultsMetadata.count = reader.getInt(); } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentList.java index 56f7130a4788..cef944907037 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentList.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentList.java @@ -20,14 +20,14 @@ @Fluent public final class IncidentList implements JsonSerializable { /* - * URL to fetch the next set of incidents. + * The value property. */ - private String nextLink; + private List value; /* - * Array of incidents. + * URL to fetch the next set of incidents. */ - private List value; + private String nextLink; /** * Creates an instance of IncidentList class. @@ -36,16 +36,7 @@ public IncidentList() { } /** - * Get the nextLink property: URL to fetch the next set of incidents. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Get the value property: Array of incidents. + * Get the value property: The value property. * * @return the value value. */ @@ -54,7 +45,7 @@ public List value() { } /** - * Set the value property: Array of incidents. + * Set the value property: The value property. * * @param value the value value to set. * @return the IncidentList object itself. @@ -64,6 +55,15 @@ public IncidentList withValue(List value) { return this; } + /** + * Get the nextLink property: URL to fetch the next set of incidents. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentRelations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentRelations.java index a7a0bb4edfb7..d1d10a28481f 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentRelations.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentRelations.java @@ -7,13 +7,14 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; /** * Resource collection API of IncidentRelations. */ public interface IncidentRelations { /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -21,12 +22,12 @@ public interface IncidentRelations { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedIterable}. + * @return all incident relations as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all relations for a given incident. + * Gets all incident relations. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -41,13 +42,13 @@ public interface IncidentRelations { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all relations for a given incident as paginated response with {@link PagedIterable}. + * @return all incident relations as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, String filter, String orderby, Integer top, String skipToken, Context context); /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -57,13 +58,13 @@ PagedIterable list(String resourceGroupName, String workspaceName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident along with {@link Response}. + * @return an incident relation along with {@link Response}. */ Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, String relationName, Context context); /** - * Gets a relation for a given incident. + * Gets an incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -72,89 +73,69 @@ Response getWithResponse(String resourceGroupName, String workspaceNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident. + * @return an incident relation. */ Relation get(String resourceGroupName, String workspaceName, String incidentId, String relationName); /** - * Deletes a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. * @param incidentId Incident ID. * @param relationName Relation Name. + * @param relation The relation model. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return represents a relation between two resources along with {@link Response}. */ - Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, - String relationName, Context context); + Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String relationName, RelationInner relation, Context context); /** - * Deletes a relation for a given incident. + * Creates or updates the incident relation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. * @param incidentId Incident ID. * @param relationName Relation Name. + * @param relation The relation model. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a relation between two resources. */ - void delete(String resourceGroupName, String workspaceName, String incidentId, String relationName); - - /** - * Gets a relation for a given incident. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident along with {@link Response}. - */ - Relation getById(String id); + Relation createOrUpdate(String resourceGroupName, String workspaceName, String incidentId, String relationName, + RelationInner relation); /** - * Gets a relation for a given incident. + * Delete the incident relation. * - * @param id the resource ID. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param relationName Relation Name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a relation for a given incident along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Deletes a relation for a given incident. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. */ - void deleteById(String id); + Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String relationName, Context context); /** - * Deletes a relation for a given incident. + * Delete the incident relation. * - * @param id the resource ID. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param relationName Relation Name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new Relation resource. - * - * @param name resource name. - * @return the first stage of the new Relation definition. - */ - Relation.DefinitionStages.Blank define(String name); + void delete(String resourceGroupName, String workspaceName, String incidentId, String relationName); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTask.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTask.java new file mode 100644 index 000000000000..4b2db5d3a392 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTask.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.IncidentTaskInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of IncidentTask. + */ +public interface IncidentTask { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the title property: The title of the task. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: The description of the task. + * + * @return the description value. + */ + String description(); + + /** + * Gets the status property: The status property. + * + * @return the status value. + */ + IncidentTaskStatus status(); + + /** + * Gets the createdTimeUtc property: The time the task was created. + * + * @return the createdTimeUtc value. + */ + OffsetDateTime createdTimeUtc(); + + /** + * Gets the lastModifiedTimeUtc property: The last time the task was updated. + * + * @return the lastModifiedTimeUtc value. + */ + OffsetDateTime lastModifiedTimeUtc(); + + /** + * Gets the createdBy property: Information on the client (user or application) that made some action. + * + * @return the createdBy value. + */ + ClientInfo createdBy(); + + /** + * Gets the lastModifiedBy property: Information on the client (user or application) that made some action. + * + * @return the lastModifiedBy value. + */ + ClientInfo lastModifiedBy(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.IncidentTaskInner object. + * + * @return the inner object. + */ + IncidentTaskInner innerModel(); + + /** + * The entirety of the IncidentTask definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithTitle, DefinitionStages.WithStatus, DefinitionStages.WithCreate { + } + + /** + * The IncidentTask definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the IncidentTask definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the IncidentTask definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName, incidentId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @return the next definition stage. + */ + WithTitle withExistingIncident(String resourceGroupName, String workspaceName, String incidentId); + } + + /** + * The stage of the IncidentTask definition allowing to specify title. + */ + interface WithTitle { + /** + * Specifies the title property: The title of the task. + * + * @param title The title of the task. + * @return the next definition stage. + */ + WithStatus withTitle(String title); + } + + /** + * The stage of the IncidentTask definition allowing to specify status. + */ + interface WithStatus { + /** + * Specifies the status property: The status property.. + * + * @param status The status property. + * @return the next definition stage. + */ + WithCreate withStatus(IncidentTaskStatus status); + } + + /** + * The stage of the IncidentTask definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithDescription, + DefinitionStages.WithCreatedBy, DefinitionStages.WithLastModifiedBy { + /** + * Executes the create request. + * + * @return the created resource. + */ + IncidentTask create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IncidentTask create(Context context); + } + + /** + * The stage of the IncidentTask definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the IncidentTask definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the task. + * + * @param description The description of the task. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the IncidentTask definition allowing to specify createdBy. + */ + interface WithCreatedBy { + /** + * Specifies the createdBy property: Information on the client (user or application) that made some action. + * + * @param createdBy Information on the client (user or application) that made some action. + * @return the next definition stage. + */ + WithCreate withCreatedBy(ClientInfo createdBy); + } + + /** + * The stage of the IncidentTask definition allowing to specify lastModifiedBy. + */ + interface WithLastModifiedBy { + /** + * Specifies the lastModifiedBy property: Information on the client (user or application) that made some + * action. + * + * @param lastModifiedBy Information on the client (user or application) that made some action. + * @return the next definition stage. + */ + WithCreate withLastModifiedBy(ClientInfo lastModifiedBy); + } + } + + /** + * Begins update for the IncidentTask resource. + * + * @return the stage of resource update. + */ + IncidentTask.Update update(); + + /** + * The template for IncidentTask update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithTitle, UpdateStages.WithDescription, + UpdateStages.WithStatus, UpdateStages.WithCreatedBy, UpdateStages.WithLastModifiedBy { + /** + * Executes the update request. + * + * @return the updated resource. + */ + IncidentTask apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + IncidentTask apply(Context context); + } + + /** + * The IncidentTask update stages. + */ + interface UpdateStages { + /** + * The stage of the IncidentTask update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the IncidentTask update allowing to specify title. + */ + interface WithTitle { + /** + * Specifies the title property: The title of the task. + * + * @param title The title of the task. + * @return the next definition stage. + */ + Update withTitle(String title); + } + + /** + * The stage of the IncidentTask update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the task. + * + * @param description The description of the task. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the IncidentTask update allowing to specify status. + */ + interface WithStatus { + /** + * Specifies the status property: The status property.. + * + * @param status The status property. + * @return the next definition stage. + */ + Update withStatus(IncidentTaskStatus status); + } + + /** + * The stage of the IncidentTask update allowing to specify createdBy. + */ + interface WithCreatedBy { + /** + * Specifies the createdBy property: Information on the client (user or application) that made some action. + * + * @param createdBy Information on the client (user or application) that made some action. + * @return the next definition stage. + */ + Update withCreatedBy(ClientInfo createdBy); + } + + /** + * The stage of the IncidentTask update allowing to specify lastModifiedBy. + */ + interface WithLastModifiedBy { + /** + * Specifies the lastModifiedBy property: Information on the client (user or application) that made some + * action. + * + * @param lastModifiedBy Information on the client (user or application) that made some action. + * @return the next definition stage. + */ + Update withLastModifiedBy(ClientInfo lastModifiedBy); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + IncidentTask refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IncidentTask refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTaskList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTaskList.java new file mode 100644 index 000000000000..1980058fc31d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTaskList.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.IncidentTaskInner; +import java.io.IOException; +import java.util.List; + +/** + * The IncidentTaskList model. + */ +@Fluent +public final class IncidentTaskList implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of IncidentTaskList class. + */ + public IncidentTaskList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the IncidentTaskList object itself. + */ + public IncidentTaskList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the IncidentTaskList object itself. + */ + public IncidentTaskList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IncidentTaskList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IncidentTaskList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IncidentTaskList. + */ + public static IncidentTaskList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IncidentTaskList deserializedIncidentTaskList = new IncidentTaskList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> IncidentTaskInner.fromJson(reader1)); + deserializedIncidentTaskList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedIncidentTaskList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIncidentTaskList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTaskStatus.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTaskStatus.java new file mode 100644 index 000000000000..81f9f8a74884 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTaskStatus.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for IncidentTaskStatus. + */ +public final class IncidentTaskStatus extends ExpandableStringEnum { + /** + * Static value New for IncidentTaskStatus. + */ + public static final IncidentTaskStatus NEW = fromString("New"); + + /** + * Static value Completed for IncidentTaskStatus. + */ + public static final IncidentTaskStatus COMPLETED = fromString("Completed"); + + /** + * Creates a new instance of IncidentTaskStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IncidentTaskStatus() { + } + + /** + * Creates or finds a IncidentTaskStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding IncidentTaskStatus. + */ + public static IncidentTaskStatus fromString(String name) { + return fromString(name, IncidentTaskStatus.class); + } + + /** + * Gets known IncidentTaskStatus values. + * + * @return known IncidentTaskStatus values. + */ + public static Collection values() { + return values(IncidentTaskStatus.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTasks.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTasks.java new file mode 100644 index 000000000000..6106480f83f6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IncidentTasks.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of IncidentTasks. + */ +public interface IncidentTasks { + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String incidentId); + + /** + * Gets all incident tasks. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all incident tasks as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String incidentId, + Context context); + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, Context context); + + /** + * Gets an incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task. + */ + IncidentTask get(String resourceGroupName, String workspaceName, String incidentId, String incidentTaskId); + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String incidentId, + String incidentTaskId, Context context); + + /** + * Delete the incident task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentId Incident ID. + * @param incidentTaskId Incident task ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String incidentId, String incidentTaskId); + + /** + * Gets an incident task. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task along with {@link Response}. + */ + IncidentTask getById(String id); + + /** + * Gets an incident task. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident task along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete the incident task. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete the incident task. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IncidentTask resource. + * + * @param name resource name. + * @return the first stage of the new IncidentTask definition. + */ + IncidentTask.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incidents.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incidents.java index f84d58af587a..21993d9f2935 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incidents.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Incidents.java @@ -12,6 +12,35 @@ * Resource collection API of Incidents. */ public interface Incidents { + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @param requestBody The requestBody parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object along with {@link Response}. + */ + Response runPlaybookWithResponse(String resourceGroupName, String workspaceName, String incidentIdentifier, + ManualTriggerRequestBody requestBody, Context context); + + /** + * Triggers playbook on a specific incident. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param incidentIdentifier The incidentIdentifier parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + Object runPlaybook(String resourceGroupName, String workspaceName, String incidentIdentifier); + /** * Gets all incidents. * @@ -45,7 +74,7 @@ PagedIterable list(String resourceGroupName, String workspaceName, Str Integer top, String skipToken, Context context); /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -54,13 +83,13 @@ PagedIterable list(String resourceGroupName, String workspaceName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident along with {@link Response}. + * @return an incident along with {@link Response}. */ Response getWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets a given incident. + * Gets an incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -68,12 +97,12 @@ Response getWithResponse(String resourceGroupName, String workspaceNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident. + * @return an incident. */ Incident get(String resourceGroupName, String workspaceName, String incidentId); /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -88,7 +117,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName Context context); /** - * Deletes a given incident. + * Delete the incident. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -100,7 +129,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName void delete(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -109,13 +138,13 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident along with {@link Response}. + * @return all incident alerts along with {@link Response}. */ Response listAlertsWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets all alerts for an incident. + * Gets all incident alerts. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -123,12 +152,12 @@ Response listAlertsWithResponse(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all alerts for an incident. + * @return all incident alerts. */ IncidentAlertList listAlerts(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -137,13 +166,13 @@ Response listAlertsWithResponse(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident along with {@link Response}. + * @return all incident bookmarks along with {@link Response}. */ Response listBookmarksWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets all bookmarks for an incident. + * Gets all incident bookmarks. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -151,12 +180,12 @@ Response listBookmarksWithResponse(String resourceGroupNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all bookmarks for an incident. + * @return all incident bookmarks. */ IncidentBookmarkList listBookmarks(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -165,13 +194,13 @@ Response listBookmarksWithResponse(String resourceGroupNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident along with {@link Response}. + * @return all incident related entities along with {@link Response}. */ Response listEntitiesWithResponse(String resourceGroupName, String workspaceName, String incidentId, Context context); /** - * Gets all entities for an incident. + * Gets all incident related entities. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -179,35 +208,35 @@ Response listEntitiesWithResponse(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all entities for an incident. + * @return all incident related entities. */ IncidentEntitiesResponse listEntities(String resourceGroupName, String workspaceName, String incidentId); /** - * Gets a given incident. + * Gets an incident. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident along with {@link Response}. + * @return an incident along with {@link Response}. */ Incident getById(String id); /** - * Gets a given incident. + * Gets an incident. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a given incident along with {@link Response}. + * @return an incident along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); /** - * Deletes a given incident. + * Delete the incident. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -217,7 +246,7 @@ Response listEntitiesWithResponse(String resourceGroup void deleteById(String id); /** - * Deletes a given incident. + * Delete the incident. * * @param id the resource ID. * @param context The context to associate with this operation. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Indicator.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Indicator.java new file mode 100644 index 000000000000..c16299926013 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Indicator.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectCommonProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Represents an indicator in Azure Security Insights. + */ +@Fluent +public final class Indicator extends TIObjectInner { + /* + * The kind of the TI object + */ + private TIObjectKind kind = TIObjectKind.INDICATOR; + + /* + * The observables of this indicator + */ + private List observables; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The properties of the TI object + */ + private TIObjectCommonProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of Indicator class. + */ + public Indicator() { + } + + /** + * Get the kind property: The kind of the TI object. + * + * @return the kind value. + */ + @Override + public TIObjectKind kind() { + return this.kind; + } + + /** + * Get the observables property: The observables of this indicator. + * + * @return the observables value. + */ + public List observables() { + return this.observables; + } + + /** + * Set the observables property: The observables of this indicator. + * + * @param observables the observables value to set. + * @return the Indicator object itself. + */ + public Indicator withObservables(List observables) { + this.observables = observables; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of the TI object. + * + * @return the innerProperties value. + */ + private TIObjectCommonProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + public Map data() { + return this.innerProperties() == null ? null : this.innerProperties().data(); + } + + /** + * Get the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the source property: The source name for this TI object. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Get the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + public OffsetDateTime firstIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().firstIngestedTimeUtc(); + } + + /** + * Get the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + public OffsetDateTime lastIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastIngestedTimeUtc(); + } + + /** + * Get the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + public UUID ingestionRulesVersion() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionRulesVersion(); + } + + /** + * Get the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + public String lastUpdateMethod() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateMethod(); + } + + /** + * Get the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + public UserInfo lastModifiedBy() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy(); + } + + /** + * Get the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateTimeUtc(); + } + + /** + * Get the relationshipHints property: A dictionary used to help follow relationships from this object to other STIX + * objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of sources + * that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + public List relationshipHints() { + return this.innerProperties() == null ? null : this.innerProperties().relationshipHints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (observables() != null) { + observables().forEach(e -> e.validate()); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeArrayField("observables", this.observables, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Indicator from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Indicator if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Indicator. + */ + public static Indicator fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Indicator deserializedIndicator = new Indicator(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIndicator.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIndicator.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIndicator.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIndicator.innerProperties = TIObjectCommonProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedIndicator.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedIndicator.kind = TIObjectKind.fromString(reader.getString()); + } else if ("observables".equals(fieldName)) { + List observables + = reader.readArray(reader1 -> IndicatorObservablesItem.fromJson(reader1)); + deserializedIndicator.observables = observables; + } else { + reader.skipChildren(); + } + } + + return deserializedIndicator; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IndicatorObservablesItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IndicatorObservablesItem.java new file mode 100644 index 000000000000..d8940a979d9b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IndicatorObservablesItem.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An observable of this indicator. + */ +@Fluent +public final class IndicatorObservablesItem implements JsonSerializable { + /* + * The type of the observable of this indicator + */ + private String type; + + /* + * The value of the observable of this indicator + */ + private String value; + + /** + * Creates an instance of IndicatorObservablesItem class. + */ + public IndicatorObservablesItem() { + } + + /** + * Get the type property: The type of the observable of this indicator. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the observable of this indicator. + * + * @param type the type value to set. + * @return the IndicatorObservablesItem object itself. + */ + public IndicatorObservablesItem withType(String type) { + this.type = type; + return this; + } + + /** + * Get the value property: The value of the observable of this indicator. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the observable of this indicator. + * + * @param value the value value to set. + * @return the IndicatorObservablesItem object itself. + */ + public IndicatorObservablesItem withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndicatorObservablesItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndicatorObservablesItem if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IndicatorObservablesItem. + */ + public static IndicatorObservablesItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IndicatorObservablesItem deserializedIndicatorObservablesItem = new IndicatorObservablesItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedIndicatorObservablesItem.type = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedIndicatorObservablesItem.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIndicatorObservablesItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IngestionMode.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IngestionMode.java new file mode 100644 index 000000000000..49771c79aa60 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IngestionMode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Describes how to ingest the records in the file. + */ +public final class IngestionMode extends ExpandableStringEnum { + /** + * Static value IngestOnlyIfAllAreValid for IngestionMode. + */ + public static final IngestionMode INGEST_ONLY_IF_ALL_ARE_VALID = fromString("IngestOnlyIfAllAreValid"); + + /** + * Static value IngestAnyValidRecords for IngestionMode. + */ + public static final IngestionMode INGEST_ANY_VALID_RECORDS = fromString("IngestAnyValidRecords"); + + /** + * Static value Unspecified for IngestionMode. + */ + public static final IngestionMode UNSPECIFIED = fromString("Unspecified"); + + /** + * Creates a new instance of IngestionMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IngestionMode() { + } + + /** + * Creates or finds a IngestionMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding IngestionMode. + */ + public static IngestionMode fromString(String name) { + return fromString(name, IngestionMode.class); + } + + /** + * Gets known IngestionMode values. + * + * @return known IngestionMode values. + */ + public static Collection values() { + return values(IngestionMode.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IngestionType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IngestionType.java new file mode 100644 index 000000000000..ca16bc5ce60d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IngestionType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of ingestion. + */ +public final class IngestionType extends ExpandableStringEnum { + /** + * Static value Full for IngestionType. + */ + public static final IngestionType FULL = fromString("Full"); + + /** + * Static value Incremental for IngestionType. + */ + public static final IngestionType INCREMENTAL = fromString("Incremental"); + + /** + * Creates a new instance of IngestionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IngestionType() { + } + + /** + * Creates or finds a IngestionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IngestionType. + */ + public static IngestionType fromString(String name) { + return fromString(name, IngestionType.class); + } + + /** + * Gets known IngestionType values. + * + * @return known IngestionType values. + */ + public static Collection values() { + return values(IngestionType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItem.java new file mode 100644 index 000000000000..8b0952be66c5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItem.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityQueryItemInner; +import java.io.IOException; + +/** + * Represents Insight Query. + */ +@Fluent +public final class InsightQueryItem extends EntityQueryItemInner { + /* + * The kind of the entity query + */ + private EntityQueryKind kind = EntityQueryKind.INSIGHT; + + /* + * Properties bag for InsightQueryItem + */ + private InsightQueryItemProperties properties; + + /* + * Query Template ARM ID + */ + private String id; + + /** + * Creates an instance of InsightQueryItem class. + */ + public InsightQueryItem() { + } + + /** + * Get the kind property: The kind of the entity query. + * + * @return the kind value. + */ + @Override + public EntityQueryKind kind() { + return this.kind; + } + + /** + * Get the properties property: Properties bag for InsightQueryItem. + * + * @return the properties value. + */ + public InsightQueryItemProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties bag for InsightQueryItem. + * + * @param properties the properties value to set. + * @return the InsightQueryItem object itself. + */ + public InsightQueryItem withProperties(InsightQueryItemProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the id property: Query Template ARM ID. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public InsightQueryItem withName(String name) { + super.withName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public InsightQueryItem withType(String type) { + super.withType(type); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("type", type()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightQueryItem. + */ + public static InsightQueryItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItem deserializedInsightQueryItem = new InsightQueryItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedInsightQueryItem.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedInsightQueryItem.withName(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedInsightQueryItem.withType(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedInsightQueryItem.kind = EntityQueryKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedInsightQueryItem.properties = InsightQueryItemProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemProperties.java new file mode 100644 index 000000000000..6820305b933d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemProperties.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents Insight Query. + */ +@Fluent +public final class InsightQueryItemProperties extends EntityQueryItemProperties { + /* + * The insight display name. + */ + private String displayName; + + /* + * The insight description. + */ + private String description; + + /* + * The base query of the insight. + */ + private String baseQuery; + + /* + * The insight table query. + */ + private InsightQueryItemPropertiesTableQuery tableQuery; + + /* + * The insight chart query. + */ + private Object chartQuery; + + /* + * The activity query definitions. + */ + private InsightQueryItemPropertiesAdditionalQuery additionalQuery; + + /* + * The insight chart query. + */ + private InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange; + + /* + * The insight chart query. + */ + private InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange; + + /** + * Creates an instance of InsightQueryItemProperties class. + */ + public InsightQueryItemProperties() { + } + + /** + * Get the displayName property: The insight display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The insight display name. + * + * @param displayName the displayName value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The insight description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The insight description. + * + * @param description the description value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the baseQuery property: The base query of the insight. + * + * @return the baseQuery value. + */ + public String baseQuery() { + return this.baseQuery; + } + + /** + * Set the baseQuery property: The base query of the insight. + * + * @param baseQuery the baseQuery value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties withBaseQuery(String baseQuery) { + this.baseQuery = baseQuery; + return this; + } + + /** + * Get the tableQuery property: The insight table query. + * + * @return the tableQuery value. + */ + public InsightQueryItemPropertiesTableQuery tableQuery() { + return this.tableQuery; + } + + /** + * Set the tableQuery property: The insight table query. + * + * @param tableQuery the tableQuery value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties withTableQuery(InsightQueryItemPropertiesTableQuery tableQuery) { + this.tableQuery = tableQuery; + return this; + } + + /** + * Get the chartQuery property: The insight chart query. + * + * @return the chartQuery value. + */ + public Object chartQuery() { + return this.chartQuery; + } + + /** + * Set the chartQuery property: The insight chart query. + * + * @param chartQuery the chartQuery value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties withChartQuery(Object chartQuery) { + this.chartQuery = chartQuery; + return this; + } + + /** + * Get the additionalQuery property: The activity query definitions. + * + * @return the additionalQuery value. + */ + public InsightQueryItemPropertiesAdditionalQuery additionalQuery() { + return this.additionalQuery; + } + + /** + * Set the additionalQuery property: The activity query definitions. + * + * @param additionalQuery the additionalQuery value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties withAdditionalQuery(InsightQueryItemPropertiesAdditionalQuery additionalQuery) { + this.additionalQuery = additionalQuery; + return this; + } + + /** + * Get the defaultTimeRange property: The insight chart query. + * + * @return the defaultTimeRange value. + */ + public InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange() { + return this.defaultTimeRange; + } + + /** + * Set the defaultTimeRange property: The insight chart query. + * + * @param defaultTimeRange the defaultTimeRange value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties + withDefaultTimeRange(InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange) { + this.defaultTimeRange = defaultTimeRange; + return this; + } + + /** + * Get the referenceTimeRange property: The insight chart query. + * + * @return the referenceTimeRange value. + */ + public InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange() { + return this.referenceTimeRange; + } + + /** + * Set the referenceTimeRange property: The insight chart query. + * + * @param referenceTimeRange the referenceTimeRange value to set. + * @return the InsightQueryItemProperties object itself. + */ + public InsightQueryItemProperties + withReferenceTimeRange(InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange) { + this.referenceTimeRange = referenceTimeRange; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public InsightQueryItemProperties withDataTypes(List dataTypes) { + super.withDataTypes(dataTypes); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public InsightQueryItemProperties withInputEntityType(EntityType inputEntityType) { + super.withInputEntityType(inputEntityType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public InsightQueryItemProperties withRequiredInputFieldsSets(List> requiredInputFieldsSets) { + super.withRequiredInputFieldsSets(requiredInputFieldsSets); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public InsightQueryItemProperties withEntitiesFilter(Object entitiesFilter) { + super.withEntitiesFilter(entitiesFilter); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tableQuery() != null) { + tableQuery().validate(); + } + if (additionalQuery() != null) { + additionalQuery().validate(); + } + if (defaultTimeRange() != null) { + defaultTimeRange().validate(); + } + if (referenceTimeRange() != null) { + referenceTimeRange().validate(); + } + if (dataTypes() != null) { + dataTypes().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dataTypes", dataTypes(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("inputEntityType", inputEntityType() == null ? null : inputEntityType().toString()); + jsonWriter.writeArrayField("requiredInputFieldsSets", requiredInputFieldsSets(), + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeUntypedField("entitiesFilter", entitiesFilter()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("baseQuery", this.baseQuery); + jsonWriter.writeJsonField("tableQuery", this.tableQuery); + jsonWriter.writeUntypedField("chartQuery", this.chartQuery); + jsonWriter.writeJsonField("additionalQuery", this.additionalQuery); + jsonWriter.writeJsonField("defaultTimeRange", this.defaultTimeRange); + jsonWriter.writeJsonField("referenceTimeRange", this.referenceTimeRange); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightQueryItemProperties. + */ + public static InsightQueryItemProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemProperties deserializedInsightQueryItemProperties = new InsightQueryItemProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataTypes".equals(fieldName)) { + List dataTypes + = reader.readArray(reader1 -> EntityQueryItemPropertiesDataTypesItem.fromJson(reader1)); + deserializedInsightQueryItemProperties.withDataTypes(dataTypes); + } else if ("inputEntityType".equals(fieldName)) { + deserializedInsightQueryItemProperties + .withInputEntityType(EntityType.fromString(reader.getString())); + } else if ("requiredInputFieldsSets".equals(fieldName)) { + List> requiredInputFieldsSets + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedInsightQueryItemProperties.withRequiredInputFieldsSets(requiredInputFieldsSets); + } else if ("entitiesFilter".equals(fieldName)) { + deserializedInsightQueryItemProperties.withEntitiesFilter(reader.readUntyped()); + } else if ("displayName".equals(fieldName)) { + deserializedInsightQueryItemProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedInsightQueryItemProperties.description = reader.getString(); + } else if ("baseQuery".equals(fieldName)) { + deserializedInsightQueryItemProperties.baseQuery = reader.getString(); + } else if ("tableQuery".equals(fieldName)) { + deserializedInsightQueryItemProperties.tableQuery + = InsightQueryItemPropertiesTableQuery.fromJson(reader); + } else if ("chartQuery".equals(fieldName)) { + deserializedInsightQueryItemProperties.chartQuery = reader.readUntyped(); + } else if ("additionalQuery".equals(fieldName)) { + deserializedInsightQueryItemProperties.additionalQuery + = InsightQueryItemPropertiesAdditionalQuery.fromJson(reader); + } else if ("defaultTimeRange".equals(fieldName)) { + deserializedInsightQueryItemProperties.defaultTimeRange + = InsightQueryItemPropertiesDefaultTimeRange.fromJson(reader); + } else if ("referenceTimeRange".equals(fieldName)) { + deserializedInsightQueryItemProperties.referenceTimeRange + = InsightQueryItemPropertiesReferenceTimeRange.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesAdditionalQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesAdditionalQuery.java new file mode 100644 index 000000000000..a7e830060ef4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesAdditionalQuery.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The activity query definitions. + */ +@Fluent +public final class InsightQueryItemPropertiesAdditionalQuery + implements JsonSerializable { + /* + * The insight query. + */ + private String query; + + /* + * The insight text. + */ + private String text; + + /** + * Creates an instance of InsightQueryItemPropertiesAdditionalQuery class. + */ + public InsightQueryItemPropertiesAdditionalQuery() { + } + + /** + * Get the query property: The insight query. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The insight query. + * + * @param query the query value to set. + * @return the InsightQueryItemPropertiesAdditionalQuery object itself. + */ + public InsightQueryItemPropertiesAdditionalQuery withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the text property: The insight text. + * + * @return the text value. + */ + public String text() { + return this.text; + } + + /** + * Set the text property: The insight text. + * + * @param text the text value to set. + * @return the InsightQueryItemPropertiesAdditionalQuery object itself. + */ + public InsightQueryItemPropertiesAdditionalQuery withText(String text) { + this.text = text; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeStringField("text", this.text); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemPropertiesAdditionalQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemPropertiesAdditionalQuery if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightQueryItemPropertiesAdditionalQuery. + */ + public static InsightQueryItemPropertiesAdditionalQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemPropertiesAdditionalQuery deserializedInsightQueryItemPropertiesAdditionalQuery + = new InsightQueryItemPropertiesAdditionalQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("query".equals(fieldName)) { + deserializedInsightQueryItemPropertiesAdditionalQuery.query = reader.getString(); + } else if ("text".equals(fieldName)) { + deserializedInsightQueryItemPropertiesAdditionalQuery.text = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemPropertiesAdditionalQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesDefaultTimeRange.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesDefaultTimeRange.java new file mode 100644 index 000000000000..fb01638b4f25 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesDefaultTimeRange.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The insight chart query. + */ +@Fluent +public final class InsightQueryItemPropertiesDefaultTimeRange + implements JsonSerializable { + /* + * The padding for the start time of the query. + */ + private String beforeRange; + + /* + * The padding for the end time of the query. + */ + private String afterRange; + + /** + * Creates an instance of InsightQueryItemPropertiesDefaultTimeRange class. + */ + public InsightQueryItemPropertiesDefaultTimeRange() { + } + + /** + * Get the beforeRange property: The padding for the start time of the query. + * + * @return the beforeRange value. + */ + public String beforeRange() { + return this.beforeRange; + } + + /** + * Set the beforeRange property: The padding for the start time of the query. + * + * @param beforeRange the beforeRange value to set. + * @return the InsightQueryItemPropertiesDefaultTimeRange object itself. + */ + public InsightQueryItemPropertiesDefaultTimeRange withBeforeRange(String beforeRange) { + this.beforeRange = beforeRange; + return this; + } + + /** + * Get the afterRange property: The padding for the end time of the query. + * + * @return the afterRange value. + */ + public String afterRange() { + return this.afterRange; + } + + /** + * Set the afterRange property: The padding for the end time of the query. + * + * @param afterRange the afterRange value to set. + * @return the InsightQueryItemPropertiesDefaultTimeRange object itself. + */ + public InsightQueryItemPropertiesDefaultTimeRange withAfterRange(String afterRange) { + this.afterRange = afterRange; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("beforeRange", this.beforeRange); + jsonWriter.writeStringField("afterRange", this.afterRange); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemPropertiesDefaultTimeRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemPropertiesDefaultTimeRange if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightQueryItemPropertiesDefaultTimeRange. + */ + public static InsightQueryItemPropertiesDefaultTimeRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemPropertiesDefaultTimeRange deserializedInsightQueryItemPropertiesDefaultTimeRange + = new InsightQueryItemPropertiesDefaultTimeRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("beforeRange".equals(fieldName)) { + deserializedInsightQueryItemPropertiesDefaultTimeRange.beforeRange = reader.getString(); + } else if ("afterRange".equals(fieldName)) { + deserializedInsightQueryItemPropertiesDefaultTimeRange.afterRange = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemPropertiesDefaultTimeRange; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesReferenceTimeRange.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesReferenceTimeRange.java new file mode 100644 index 000000000000..5c34e2f9691d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesReferenceTimeRange.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The insight chart query. + */ +@Fluent +public final class InsightQueryItemPropertiesReferenceTimeRange + implements JsonSerializable { + /* + * Additional query time for looking back. + */ + private String beforeRange; + + /** + * Creates an instance of InsightQueryItemPropertiesReferenceTimeRange class. + */ + public InsightQueryItemPropertiesReferenceTimeRange() { + } + + /** + * Get the beforeRange property: Additional query time for looking back. + * + * @return the beforeRange value. + */ + public String beforeRange() { + return this.beforeRange; + } + + /** + * Set the beforeRange property: Additional query time for looking back. + * + * @param beforeRange the beforeRange value to set. + * @return the InsightQueryItemPropertiesReferenceTimeRange object itself. + */ + public InsightQueryItemPropertiesReferenceTimeRange withBeforeRange(String beforeRange) { + this.beforeRange = beforeRange; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("beforeRange", this.beforeRange); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemPropertiesReferenceTimeRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemPropertiesReferenceTimeRange if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightQueryItemPropertiesReferenceTimeRange. + */ + public static InsightQueryItemPropertiesReferenceTimeRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemPropertiesReferenceTimeRange deserializedInsightQueryItemPropertiesReferenceTimeRange + = new InsightQueryItemPropertiesReferenceTimeRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("beforeRange".equals(fieldName)) { + deserializedInsightQueryItemPropertiesReferenceTimeRange.beforeRange = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemPropertiesReferenceTimeRange; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQuery.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQuery.java new file mode 100644 index 000000000000..caa097a37a31 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQuery.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The insight table query. + */ +@Fluent +public final class InsightQueryItemPropertiesTableQuery + implements JsonSerializable { + /* + * List of insight column definitions. + */ + private List columnsDefinitions; + + /* + * List of insight queries definitions. + */ + private List queriesDefinitions; + + /** + * Creates an instance of InsightQueryItemPropertiesTableQuery class. + */ + public InsightQueryItemPropertiesTableQuery() { + } + + /** + * Get the columnsDefinitions property: List of insight column definitions. + * + * @return the columnsDefinitions value. + */ + public List columnsDefinitions() { + return this.columnsDefinitions; + } + + /** + * Set the columnsDefinitions property: List of insight column definitions. + * + * @param columnsDefinitions the columnsDefinitions value to set. + * @return the InsightQueryItemPropertiesTableQuery object itself. + */ + public InsightQueryItemPropertiesTableQuery + withColumnsDefinitions(List columnsDefinitions) { + this.columnsDefinitions = columnsDefinitions; + return this; + } + + /** + * Get the queriesDefinitions property: List of insight queries definitions. + * + * @return the queriesDefinitions value. + */ + public List queriesDefinitions() { + return this.queriesDefinitions; + } + + /** + * Set the queriesDefinitions property: List of insight queries definitions. + * + * @param queriesDefinitions the queriesDefinitions value to set. + * @return the InsightQueryItemPropertiesTableQuery object itself. + */ + public InsightQueryItemPropertiesTableQuery + withQueriesDefinitions(List queriesDefinitions) { + this.queriesDefinitions = queriesDefinitions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columnsDefinitions() != null) { + columnsDefinitions().forEach(e -> e.validate()); + } + if (queriesDefinitions() != null) { + queriesDefinitions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("columnsDefinitions", this.columnsDefinitions, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("queriesDefinitions", this.queriesDefinitions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemPropertiesTableQuery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemPropertiesTableQuery if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightQueryItemPropertiesTableQuery. + */ + public static InsightQueryItemPropertiesTableQuery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemPropertiesTableQuery deserializedInsightQueryItemPropertiesTableQuery + = new InsightQueryItemPropertiesTableQuery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("columnsDefinitions".equals(fieldName)) { + List columnsDefinitions + = reader.readArray( + reader1 -> InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.fromJson(reader1)); + deserializedInsightQueryItemPropertiesTableQuery.columnsDefinitions = columnsDefinitions; + } else if ("queriesDefinitions".equals(fieldName)) { + List queriesDefinitions + = reader.readArray( + reader1 -> InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.fromJson(reader1)); + deserializedInsightQueryItemPropertiesTableQuery.queriesDefinitions = queriesDefinitions; + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemPropertiesTableQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.java new file mode 100644 index 000000000000..d4de4912e41a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem model. + */ +@Fluent +public final class InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem + implements JsonSerializable { + /* + * Insight column header. + */ + private String headerProperty; + + /* + * Insights Column type. + */ + private OutputType outputType; + + /* + * Is query supports deep-link. + */ + private Boolean supportDeepLink; + + /** + * Creates an instance of InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem class. + */ + public InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem() { + } + + /** + * Get the headerProperty property: Insight column header. + * + * @return the headerProperty value. + */ + public String headerProperty() { + return this.headerProperty; + } + + /** + * Set the headerProperty property: Insight column header. + * + * @param headerProperty the headerProperty value to set. + * @return the InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem withHeaderProperty(String headerProperty) { + this.headerProperty = headerProperty; + return this; + } + + /** + * Get the outputType property: Insights Column type. + * + * @return the outputType value. + */ + public OutputType outputType() { + return this.outputType; + } + + /** + * Set the outputType property: Insights Column type. + * + * @param outputType the outputType value to set. + * @return the InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem withOutputType(OutputType outputType) { + this.outputType = outputType; + return this; + } + + /** + * Get the supportDeepLink property: Is query supports deep-link. + * + * @return the supportDeepLink value. + */ + public Boolean supportDeepLink() { + return this.supportDeepLink; + } + + /** + * Set the supportDeepLink property: Is query supports deep-link. + * + * @param supportDeepLink the supportDeepLink value to set. + * @return the InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem withSupportDeepLink(Boolean supportDeepLink) { + this.supportDeepLink = supportDeepLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("header", this.headerProperty); + jsonWriter.writeStringField("outputType", this.outputType == null ? null : this.outputType.toString()); + jsonWriter.writeBooleanField("supportDeepLink", this.supportDeepLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem. + */ + public static InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem deserializedInsightQueryItemPropertiesTableQueryColumnsDefinitionsItem + = new InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("header".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.headerProperty + = reader.getString(); + } else if ("outputType".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.outputType + = OutputType.fromString(reader.getString()); + } else if ("supportDeepLink".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.supportDeepLink + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemPropertiesTableQueryColumnsDefinitionsItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.java new file mode 100644 index 000000000000..07c84936ba19 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem model. + */ +@Fluent +public final class InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem + implements JsonSerializable { + /* + * Insight column header. + */ + private String filter; + + /* + * Insight column header. + */ + private String summarize; + + /* + * Insight column header. + */ + private String project; + + /* + * Insight column header. + */ + private List linkColumnsDefinitions; + + /** + * Creates an instance of InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem class. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem() { + } + + /** + * Get the filter property: Insight column header. + * + * @return the filter value. + */ + public String filter() { + return this.filter; + } + + /** + * Set the filter property: Insight column header. + * + * @param filter the filter value to set. + * @return the InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the summarize property: Insight column header. + * + * @return the summarize value. + */ + public String summarize() { + return this.summarize; + } + + /** + * Set the summarize property: Insight column header. + * + * @param summarize the summarize value to set. + * @return the InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem withSummarize(String summarize) { + this.summarize = summarize; + return this; + } + + /** + * Get the project property: Insight column header. + * + * @return the project value. + */ + public String project() { + return this.project; + } + + /** + * Set the project property: Insight column header. + * + * @param project the project value to set. + * @return the InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem withProject(String project) { + this.project = project; + return this; + } + + /** + * Get the linkColumnsDefinitions property: Insight column header. + * + * @return the linkColumnsDefinitions value. + */ + public List linkColumnsDefinitions() { + return this.linkColumnsDefinitions; + } + + /** + * Set the linkColumnsDefinitions property: Insight column header. + * + * @param linkColumnsDefinitions the linkColumnsDefinitions value to set. + * @return the InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem withLinkColumnsDefinitions( + List linkColumnsDefinitions) { + this.linkColumnsDefinitions = linkColumnsDefinitions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (linkColumnsDefinitions() != null) { + linkColumnsDefinitions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("filter", this.filter); + jsonWriter.writeStringField("summarize", this.summarize); + jsonWriter.writeStringField("project", this.project); + jsonWriter.writeArrayField("linkColumnsDefinitions", this.linkColumnsDefinitions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem. + */ + public static InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsItem + = new InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("filter".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.filter = reader.getString(); + } else if ("summarize".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.summarize + = reader.getString(); + } else if ("project".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.project = reader.getString(); + } else if ("linkColumnsDefinitions".equals(fieldName)) { + List linkColumnsDefinitions + = reader.readArray( + reader1 -> InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem + .fromJson(reader1)); + deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.linkColumnsDefinitions + = linkColumnsDefinitions; + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem.java new file mode 100644 index 000000000000..8ecd4d24352b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem model. + */ +@Fluent +public final class InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem + implements JsonSerializable { + /* + * Insight Link Definition Projected Name. + */ + private String projectedName; + + /* + * Insight Link Definition Query. + */ + private String query; + + /** + * Creates an instance of InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem class. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem() { + } + + /** + * Get the projectedName property: Insight Link Definition Projected Name. + * + * @return the projectedName value. + */ + public String projectedName() { + return this.projectedName; + } + + /** + * Set the projectedName property: Insight Link Definition Projected Name. + * + * @param projectedName the projectedName value to set. + * @return the InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem + withProjectedName(String projectedName) { + this.projectedName = projectedName; + return this; + } + + /** + * Get the query property: Insight Link Definition Query. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: Insight Link Definition Query. + * + * @param query the query value to set. + * @return the InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem object itself. + */ + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem withQuery(String query) { + this.query = query; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("projectedName", this.projectedName); + jsonWriter.writeStringField("Query", this.query); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem from the + * JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem if the + * JsonReader was pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem. + */ + public static InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem + fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem + = new InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("projectedName".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem.projectedName + = reader.getString(); + } else if ("Query".equals(fieldName)) { + deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem.query + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightsTableResult.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightsTableResult.java new file mode 100644 index 000000000000..5a59df90db0d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightsTableResult.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Query results for table insights query. + */ +@Fluent +public final class InsightsTableResult implements JsonSerializable { + /* + * Columns Metadata of the table + */ + private List columns; + + /* + * Rows data of the table + */ + private List> rows; + + /** + * Creates an instance of InsightsTableResult class. + */ + public InsightsTableResult() { + } + + /** + * Get the columns property: Columns Metadata of the table. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Set the columns property: Columns Metadata of the table. + * + * @param columns the columns value to set. + * @return the InsightsTableResult object itself. + */ + public InsightsTableResult withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get the rows property: Rows data of the table. + * + * @return the rows value. + */ + public List> rows() { + return this.rows; + } + + /** + * Set the rows property: Rows data of the table. + * + * @param rows the rows value to set. + * @return the InsightsTableResult object itself. + */ + public InsightsTableResult withRows(List> rows) { + this.rows = rows; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("columns", this.columns, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("rows", this.rows, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightsTableResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightsTableResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightsTableResult. + */ + public static InsightsTableResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightsTableResult deserializedInsightsTableResult = new InsightsTableResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("columns".equals(fieldName)) { + List columns + = reader.readArray(reader1 -> InsightsTableResultColumnsItem.fromJson(reader1)); + deserializedInsightsTableResult.columns = columns; + } else if ("rows".equals(fieldName)) { + List> rows + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedInsightsTableResult.rows = rows; + } else { + reader.skipChildren(); + } + } + + return deserializedInsightsTableResult; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightsTableResultColumnsItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightsTableResultColumnsItem.java new file mode 100644 index 000000000000..b30088270c0e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightsTableResultColumnsItem.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The InsightsTableResultColumnsItem model. + */ +@Fluent +public final class InsightsTableResultColumnsItem implements JsonSerializable { + /* + * the type of the colum + */ + private String type; + + /* + * the name of the colum + */ + private String name; + + /** + * Creates an instance of InsightsTableResultColumnsItem class. + */ + public InsightsTableResultColumnsItem() { + } + + /** + * Get the type property: the type of the colum. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: the type of the colum. + * + * @param type the type value to set. + * @return the InsightsTableResultColumnsItem object itself. + */ + public InsightsTableResultColumnsItem withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: the name of the colum. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the name of the colum. + * + * @param name the name value to set. + * @return the InsightsTableResultColumnsItem object itself. + */ + public InsightsTableResultColumnsItem withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightsTableResultColumnsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightsTableResultColumnsItem if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InsightsTableResultColumnsItem. + */ + public static InsightsTableResultColumnsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightsTableResultColumnsItem deserializedInsightsTableResultColumnsItem + = new InsightsTableResultColumnsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedInsightsTableResultColumnsItem.type = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedInsightsTableResultColumnsItem.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightsTableResultColumnsItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStep.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStep.java new file mode 100644 index 000000000000..8024e15afa12 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStep.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Instruction steps to enable the connector. + */ +@Fluent +public final class InstructionStep implements JsonSerializable { + /* + * Gets or sets the instruction step title. + */ + private String title; + + /* + * Gets or sets the instruction step description. + */ + private String description; + + /* + * Gets or sets the instruction step details. + */ + private List instructions; + + /* + * Gets or sets the inner instruction steps details. + * For Example: instruction step 1 might contain inner instruction steps: [instruction step 1.1, instruction step + * 1.2]. + */ + private List innerSteps; + + /** + * Creates an instance of InstructionStep class. + */ + public InstructionStep() { + } + + /** + * Get the title property: Gets or sets the instruction step title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Gets or sets the instruction step title. + * + * @param title the title value to set. + * @return the InstructionStep object itself. + */ + public InstructionStep withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Gets or sets the instruction step description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Gets or sets the instruction step description. + * + * @param description the description value to set. + * @return the InstructionStep object itself. + */ + public InstructionStep withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: Gets or sets the instruction step details. + * + * @return the instructions value. + */ + public List instructions() { + return this.instructions; + } + + /** + * Set the instructions property: Gets or sets the instruction step details. + * + * @param instructions the instructions value to set. + * @return the InstructionStep object itself. + */ + public InstructionStep withInstructions(List instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the innerSteps property: Gets or sets the inner instruction steps details. + * For Example: instruction step 1 might contain inner instruction steps: [instruction step 1.1, instruction step + * 1.2]. + * + * @return the innerSteps value. + */ + public List innerSteps() { + return this.innerSteps; + } + + /** + * Set the innerSteps property: Gets or sets the inner instruction steps details. + * For Example: instruction step 1 might contain inner instruction steps: [instruction step 1.1, instruction step + * 1.2]. + * + * @param innerSteps the innerSteps value to set. + * @return the InstructionStep object itself. + */ + public InstructionStep withInnerSteps(List innerSteps) { + this.innerSteps = innerSteps; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instructions() != null) { + instructions().forEach(e -> e.validate()); + } + if (innerSteps() != null) { + innerSteps().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("instructions", this.instructions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("innerSteps", this.innerSteps, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstructionStep from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstructionStep if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the InstructionStep. + */ + public static InstructionStep fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstructionStep deserializedInstructionStep = new InstructionStep(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedInstructionStep.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedInstructionStep.description = reader.getString(); + } else if ("instructions".equals(fieldName)) { + List instructions + = reader.readArray(reader1 -> InstructionStepDetails.fromJson(reader1)); + deserializedInstructionStep.instructions = instructions; + } else if ("innerSteps".equals(fieldName)) { + List innerSteps = reader.readArray(reader1 -> InstructionStep.fromJson(reader1)); + deserializedInstructionStep.innerSteps = innerSteps; + } else { + reader.skipChildren(); + } + } + + return deserializedInstructionStep; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStepDetails.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStepDetails.java new file mode 100644 index 000000000000..21d7650b6360 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStepDetails.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Instruction step details, to be displayed in the Instructions steps section in the connector's page in Sentinel + * Portal. + */ +@Fluent +public final class InstructionStepDetails implements JsonSerializable { + /* + * Gets or sets the instruction type parameters settings. + */ + private Object parameters; + + /* + * Gets or sets the instruction type name. + */ + private String type; + + /** + * Creates an instance of InstructionStepDetails class. + */ + public InstructionStepDetails() { + } + + /** + * Get the parameters property: Gets or sets the instruction type parameters settings. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Gets or sets the instruction type parameters settings. + * + * @param parameters the parameters value to set. + * @return the InstructionStepDetails object itself. + */ + public InstructionStepDetails withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the type property: Gets or sets the instruction type name. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the instruction type name. + * + * @param type the type value to set. + * @return the InstructionStepDetails object itself. + */ + public InstructionStepDetails withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parameters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property parameters in model InstructionStepDetails")); + } + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model InstructionStepDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstructionStepDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeUntypedField("parameters", this.parameters); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstructionStepDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstructionStepDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InstructionStepDetails. + */ + public static InstructionStepDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstructionStepDetails deserializedInstructionStepDetails = new InstructionStepDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("parameters".equals(fieldName)) { + deserializedInstructionStepDetails.parameters = reader.readUntyped(); + } else if ("type".equals(fieldName)) { + deserializedInstructionStepDetails.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInstructionStepDetails; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionSteps.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionSteps.java new file mode 100644 index 000000000000..cabd8fc44fbb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionSteps.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Instruction steps to enable the connector. + */ +@Fluent +public class InstructionSteps implements JsonSerializable { + /* + * Instruction step title + */ + private String title; + + /* + * Instruction step description + */ + private String description; + + /* + * Instruction step details + */ + private List instructions; + + /** + * Creates an instance of InstructionSteps class. + */ + public InstructionSteps() { + } + + /** + * Get the title property: Instruction step title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Instruction step title. + * + * @param title the title value to set. + * @return the InstructionSteps object itself. + */ + public InstructionSteps withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Instruction step description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Instruction step description. + * + * @param description the description value to set. + * @return the InstructionSteps object itself. + */ + public InstructionSteps withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the instructions property: Instruction step details. + * + * @return the instructions value. + */ + public List instructions() { + return this.instructions; + } + + /** + * Set the instructions property: Instruction step details. + * + * @param instructions the instructions value to set. + * @return the InstructionSteps object itself. + */ + public InstructionSteps withInstructions(List instructions) { + this.instructions = instructions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instructions() != null) { + instructions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("instructions", this.instructions, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstructionSteps from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstructionSteps if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the InstructionSteps. + */ + public static InstructionSteps fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstructionSteps deserializedInstructionSteps = new InstructionSteps(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedInstructionSteps.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedInstructionSteps.description = reader.getString(); + } else if ("instructions".equals(fieldName)) { + List instructions + = reader.readArray(reader1 -> InstructionStepsInstructionsItem.fromJson(reader1)); + deserializedInstructionSteps.instructions = instructions; + } else { + reader.skipChildren(); + } + } + + return deserializedInstructionSteps; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStepsInstructionsItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStepsInstructionsItem.java new file mode 100644 index 000000000000..cf3dcf73e5d1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InstructionStepsInstructionsItem.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The InstructionStepsInstructionsItem model. + */ +@Fluent +public final class InstructionStepsInstructionsItem extends ConnectorInstructionModelBase { + /** + * Creates an instance of InstructionStepsInstructionsItem class. + */ + public InstructionStepsInstructionsItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public InstructionStepsInstructionsItem withParameters(Object parameters) { + super.withParameters(parameters); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public InstructionStepsInstructionsItem withType(SettingType type) { + super.withType(type); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model InstructionStepsInstructionsItem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstructionStepsInstructionsItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", type() == null ? null : type().toString()); + jsonWriter.writeUntypedField("parameters", parameters()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstructionStepsInstructionsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstructionStepsInstructionsItem if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InstructionStepsInstructionsItem. + */ + public static InstructionStepsInstructionsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstructionStepsInstructionsItem deserializedInstructionStepsInstructionsItem + = new InstructionStepsInstructionsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedInstructionStepsInstructionsItem.withType(SettingType.fromString(reader.getString())); + } else if ("parameters".equals(fieldName)) { + deserializedInstructionStepsInstructionsItem.withParameters(reader.readUntyped()); + } else { + reader.skipChildren(); + } + } + + return deserializedInstructionStepsInstructionsItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTCheckRequirements.java new file mode 100644 index 000000000000..62236798a3ff --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTCheckRequirements.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.IoTCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents IoT requirements check request. + */ +@Fluent +public final class IoTCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.IOT; + + /* + * IoT requirements check properties. + */ + private IoTCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of IoTCheckRequirements class. + */ + public IoTCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: IoT requirements check properties. + * + * @return the innerProperties value. + */ + IoTCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); + } + + /** + * Set the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the IoTCheckRequirements object itself. + */ + public IoTCheckRequirements withSubscriptionId(String subscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new IoTCheckRequirementsProperties(); + } + this.innerProperties().withSubscriptionId(subscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the IoTCheckRequirements. + */ + public static IoTCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTCheckRequirements deserializedIoTCheckRequirements = new IoTCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedIoTCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedIoTCheckRequirements.innerProperties = IoTCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIoTCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTDataConnector.java new file mode 100644 index 000000000000..cce199eb0f3e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTDataConnector.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.IoTDataConnectorProperties; +import java.io.IOException; + +/** + * Represents IoT data connector. + */ +@Fluent +public final class IoTDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.IOT; + + /* + * IoT data connector properties. + */ + private IoTDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of IoTDataConnector class. + */ + public IoTDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: IoT data connector properties. + * + * @return the innerProperties value. + */ + private IoTDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public IoTDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().subscriptionId(); + } + + /** + * Set the subscriptionId property: The subscription id to connect to, and get the data from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the IoTDataConnector object itself. + */ + public IoTDataConnector withSubscriptionId(String subscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new IoTDataConnectorProperties(); + } + this.innerProperties().withSubscriptionId(subscriptionId); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public AlertsDataTypeOfDataConnector dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the IoTDataConnector object itself. + */ + public IoTDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new IoTDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTDataConnector if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IoTDataConnector. + */ + public static IoTDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTDataConnector deserializedIoTDataConnector = new IoTDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIoTDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIoTDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIoTDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedIoTDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedIoTDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedIoTDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedIoTDataConnector.innerProperties = IoTDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIoTDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTDeviceEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTDeviceEntity.java index b4789194231d..0e4cc95f5f2c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTDeviceEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IoTDeviceEntity.java @@ -4,11 +4,12 @@ package com.azure.resourcemanager.securityinsights.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.IoTDeviceEntityProperties; import java.io.IOException; import java.util.List; @@ -18,8 +19,8 @@ /** * Represents an IoT device entity. */ -@Immutable -public final class IoTDeviceEntity extends Entity { +@Fluent +public final class IoTDeviceEntity extends EntityInner { /* * The kind of the entity. */ @@ -268,6 +269,119 @@ public List protocols() { return this.innerProperties() == null ? null : this.innerProperties().protocols(); } + /** + * Get the owners property: A list of owners of the IoTDevice entity. + * + * @return the owners value. + */ + public List owners() { + return this.innerProperties() == null ? null : this.innerProperties().owners(); + } + + /** + * Get the nicEntityIds property: A list of Nic entity ids of the IoTDevice entity. + * + * @return the nicEntityIds value. + */ + public List nicEntityIds() { + return this.innerProperties() == null ? null : this.innerProperties().nicEntityIds(); + } + + /** + * Get the site property: The site of the device. + * + * @return the site value. + */ + public String site() { + return this.innerProperties() == null ? null : this.innerProperties().site(); + } + + /** + * Get the zone property: The zone location of the device within a site. + * + * @return the zone value. + */ + public String zone() { + return this.innerProperties() == null ? null : this.innerProperties().zone(); + } + + /** + * Get the sensor property: The sensor the device is monitored by. + * + * @return the sensor value. + */ + public String sensor() { + return this.innerProperties() == null ? null : this.innerProperties().sensor(); + } + + /** + * Get the deviceSubType property: The subType of the device ('PLC', 'HMI', 'EWS', etc.). + * + * @return the deviceSubType value. + */ + public String deviceSubType() { + return this.innerProperties() == null ? null : this.innerProperties().deviceSubType(); + } + + /** + * Get the importance property: Device importance, determines if the device classified as 'crown jewel'. + * + * @return the importance value. + */ + public DeviceImportance importance() { + return this.innerProperties() == null ? null : this.innerProperties().importance(); + } + + /** + * Set the importance property: Device importance, determines if the device classified as 'crown jewel'. + * + * @param importance the importance value to set. + * @return the IoTDeviceEntity object itself. + */ + public IoTDeviceEntity withImportance(DeviceImportance importance) { + if (this.innerProperties() == null) { + this.innerProperties = new IoTDeviceEntityProperties(); + } + this.innerProperties().withImportance(importance); + return this; + } + + /** + * Get the purdueLayer property: The Purdue Layer of the device. + * + * @return the purdueLayer value. + */ + public String purdueLayer() { + return this.innerProperties() == null ? null : this.innerProperties().purdueLayer(); + } + + /** + * Get the isAuthorized property: Determines whether the device classified as authorized device. + * + * @return the isAuthorized value. + */ + public Boolean isAuthorized() { + return this.innerProperties() == null ? null : this.innerProperties().isAuthorized(); + } + + /** + * Get the isProgramming property: Determines whether the device classified as programming device. + * + * @return the isProgramming value. + */ + public Boolean isProgramming() { + return this.innerProperties() == null ? null : this.innerProperties().isProgramming(); + } + + /** + * Get the isScanner property: Is the device classified as a scanner device. + * + * @return the isScanner value. + */ + public Boolean isScanner() { + return this.innerProperties() == null ? null : this.innerProperties().isScanner(); + } + /** * Get the additionalData property: A bag of custom fields that should be part of the entity and will be presented * to the user. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IpEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IpEntity.java index 13b1e56a8840..2fcce6b857eb 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IpEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/IpEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.IpEntityProperties; import java.io.IOException; import java.util.List; @@ -18,7 +19,7 @@ * Represents an ip entity. */ @Immutable -public final class IpEntity extends Entity { +public final class IpEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Job.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Job.java new file mode 100644 index 000000000000..a2a5a25fe1fa --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Job.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.JobInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * An immutable client-side representation of Job. + */ +public interface Job { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the endTime property: The time the job completed. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the items property: List of items published by the job. + * + * @return the items value. + */ + List items(); + + /** + * Gets the provisioningState property: State of the job. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the startTime property: The time the job started. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the errorMessage property: Message to describe error, if an error exists. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.JobInner object. + * + * @return the inner object. + */ + JobInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JobItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JobItem.java new file mode 100644 index 000000000000..3dc0f9862622 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JobItem.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * An entity describing the publish status of a content item. + */ +@Fluent +public final class JobItem implements JsonSerializable { + /* + * The resource id of the content item + */ + private String resourceId; + + /* + * Status of the item publication + */ + private Status status; + + /* + * The time the item publishing was completed + */ + private OffsetDateTime executionTime; + + /* + * The list of error descriptions if the item publication fails. + */ + private List errors; + + /** + * Creates an instance of JobItem class. + */ + public JobItem() { + } + + /** + * Get the resourceId property: The resource id of the content item. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource id of the content item. + * + * @param resourceId the resourceId value to set. + * @return the JobItem object itself. + */ + public JobItem withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the status property: Status of the item publication. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Get the executionTime property: The time the item publishing was completed. + * + * @return the executionTime value. + */ + public OffsetDateTime executionTime() { + return this.executionTime; + } + + /** + * Get the errors property: The list of error descriptions if the item publication fails. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Set the errors property: The list of error descriptions if the item publication fails. + * + * @param errors the errors value to set. + * @return the JobItem object itself. + */ + public JobItem withErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeArrayField("errors", this.errors, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobItem if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the JobItem. + */ + public static JobItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobItem deserializedJobItem = new JobItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedJobItem.resourceId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedJobItem.status = Status.fromString(reader.getString()); + } else if ("executionTime".equals(fieldName)) { + deserializedJobItem.executionTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("errors".equals(fieldName)) { + List errors = reader.readArray(reader1 -> Error.fromJson(reader1)); + deserializedJobItem.errors = errors; + } else { + reader.skipChildren(); + } + } + + return deserializedJobItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JobList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JobList.java new file mode 100644 index 000000000000..77b011727fa9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JobList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.JobInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the jobs. + */ +@Fluent +public final class JobList implements JsonSerializable { + /* + * URL to fetch the next set of jobs. + */ + private String nextLink; + + /* + * Array of jobs. + */ + private List value; + + /** + * Creates an instance of JobList class. + */ + public JobList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of jobs. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of jobs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of jobs. + * + * @param value the value value to set. + * @return the JobList object itself. + */ + public JobList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model JobList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobList if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobList. + */ + public static JobList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobList deserializedJobList = new JobList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> JobInner.fromJson(reader1)); + deserializedJobList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedJobList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JwtAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JwtAuthModel.java new file mode 100644 index 000000000000..7d0df999a343 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/JwtAuthModel.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Model for API authentication with JWT. Simple exchange between user name + password to access token. + */ +@Fluent +public final class JwtAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.JWT_TOKEN; + + /* + * Token endpoint to request JWT + */ + private String tokenEndpoint; + + /* + * The user name. If user name and password sent in header request we only need to populate the `value` property + * with the user name (Same as basic auth). If user name and password sent in body request we need to specify the + * `Key` and `Value`. + */ + private Map username; + + /* + * The password + */ + private Map password; + + /* + * The custom query parameter we want to add once we send request to token endpoint. + */ + private Map queryParameters; + + /* + * The custom headers we want to add once we send request to token endpoint. + */ + private Map headers; + + /* + * Flag indicating whether we want to send the user name and password to token endpoint in the headers. + */ + private Boolean isCredentialsInHeaders; + + /* + * Flag indicating whether the body request is JSON (header Content-Type = application/json), meaning its a Form URL + * encoded request (header Content-Type = application/x-www-form-urlencoded). + */ + private Boolean isJsonRequest; + + /* + * Request timeout in seconds. + */ + private Integer requestTimeoutInSeconds; + + /** + * Creates an instance of JwtAuthModel class. + */ + public JwtAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the tokenEndpoint property: Token endpoint to request JWT. + * + * @return the tokenEndpoint value. + */ + public String tokenEndpoint() { + return this.tokenEndpoint; + } + + /** + * Set the tokenEndpoint property: Token endpoint to request JWT. + * + * @param tokenEndpoint the tokenEndpoint value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withTokenEndpoint(String tokenEndpoint) { + this.tokenEndpoint = tokenEndpoint; + return this; + } + + /** + * Get the username property: The user name. If user name and password sent in header request we only need to + * populate the `value` property with the user name (Same as basic auth). If user name and password sent in body + * request we need to specify the `Key` and `Value`. + * + * @return the username value. + */ + public Map username() { + return this.username; + } + + /** + * Set the username property: The user name. If user name and password sent in header request we only need to + * populate the `value` property with the user name (Same as basic auth). If user name and password sent in body + * request we need to specify the `Key` and `Value`. + * + * @param username the username value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withUsername(Map username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password. + * + * @return the password value. + */ + public Map password() { + return this.password; + } + + /** + * Set the password property: The password. + * + * @param password the password value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withPassword(Map password) { + this.password = password; + return this; + } + + /** + * Get the queryParameters property: The custom query parameter we want to add once we send request to token + * endpoint. + * + * @return the queryParameters value. + */ + public Map queryParameters() { + return this.queryParameters; + } + + /** + * Set the queryParameters property: The custom query parameter we want to add once we send request to token + * endpoint. + * + * @param queryParameters the queryParameters value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withQueryParameters(Map queryParameters) { + this.queryParameters = queryParameters; + return this; + } + + /** + * Get the headers property: The custom headers we want to add once we send request to token endpoint. + * + * @return the headers value. + */ + public Map headers() { + return this.headers; + } + + /** + * Set the headers property: The custom headers we want to add once we send request to token endpoint. + * + * @param headers the headers value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withHeaders(Map headers) { + this.headers = headers; + return this; + } + + /** + * Get the isCredentialsInHeaders property: Flag indicating whether we want to send the user name and password to + * token endpoint in the headers. + * + * @return the isCredentialsInHeaders value. + */ + public Boolean isCredentialsInHeaders() { + return this.isCredentialsInHeaders; + } + + /** + * Set the isCredentialsInHeaders property: Flag indicating whether we want to send the user name and password to + * token endpoint in the headers. + * + * @param isCredentialsInHeaders the isCredentialsInHeaders value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withIsCredentialsInHeaders(Boolean isCredentialsInHeaders) { + this.isCredentialsInHeaders = isCredentialsInHeaders; + return this; + } + + /** + * Get the isJsonRequest property: Flag indicating whether the body request is JSON (header Content-Type = + * application/json), meaning its a Form URL encoded request (header Content-Type = + * application/x-www-form-urlencoded). + * + * @return the isJsonRequest value. + */ + public Boolean isJsonRequest() { + return this.isJsonRequest; + } + + /** + * Set the isJsonRequest property: Flag indicating whether the body request is JSON (header Content-Type = + * application/json), meaning its a Form URL encoded request (header Content-Type = + * application/x-www-form-urlencoded). + * + * @param isJsonRequest the isJsonRequest value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withIsJsonRequest(Boolean isJsonRequest) { + this.isJsonRequest = isJsonRequest; + return this; + } + + /** + * Get the requestTimeoutInSeconds property: Request timeout in seconds. + * + * @return the requestTimeoutInSeconds value. + */ + public Integer requestTimeoutInSeconds() { + return this.requestTimeoutInSeconds; + } + + /** + * Set the requestTimeoutInSeconds property: Request timeout in seconds. + * + * @param requestTimeoutInSeconds the requestTimeoutInSeconds value to set. + * @return the JwtAuthModel object itself. + */ + public JwtAuthModel withRequestTimeoutInSeconds(Integer requestTimeoutInSeconds) { + this.requestTimeoutInSeconds = requestTimeoutInSeconds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tokenEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property tokenEndpoint in model JwtAuthModel")); + } + if (username() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property username in model JwtAuthModel")); + } + if (password() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property password in model JwtAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JwtAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tokenEndpoint", this.tokenEndpoint); + jsonWriter.writeMapField("userName", this.username, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("password", this.password, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("queryParameters", this.queryParameters, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("headers", this.headers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isCredentialsInHeaders", this.isCredentialsInHeaders); + jsonWriter.writeBooleanField("isJsonRequest", this.isJsonRequest); + jsonWriter.writeNumberField("requestTimeoutInSeconds", this.requestTimeoutInSeconds); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JwtAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JwtAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JwtAuthModel. + */ + public static JwtAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JwtAuthModel deserializedJwtAuthModel = new JwtAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tokenEndpoint".equals(fieldName)) { + deserializedJwtAuthModel.tokenEndpoint = reader.getString(); + } else if ("userName".equals(fieldName)) { + Map username = reader.readMap(reader1 -> reader1.getString()); + deserializedJwtAuthModel.username = username; + } else if ("password".equals(fieldName)) { + Map password = reader.readMap(reader1 -> reader1.getString()); + deserializedJwtAuthModel.password = password; + } else if ("type".equals(fieldName)) { + deserializedJwtAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else if ("queryParameters".equals(fieldName)) { + Map queryParameters = reader.readMap(reader1 -> reader1.getString()); + deserializedJwtAuthModel.queryParameters = queryParameters; + } else if ("headers".equals(fieldName)) { + Map headers = reader.readMap(reader1 -> reader1.getString()); + deserializedJwtAuthModel.headers = headers; + } else if ("isCredentialsInHeaders".equals(fieldName)) { + deserializedJwtAuthModel.isCredentialsInHeaders = reader.getNullable(JsonReader::getBoolean); + } else if ("isJsonRequest".equals(fieldName)) { + deserializedJwtAuthModel.isJsonRequest = reader.getNullable(JsonReader::getBoolean); + } else if ("requestTimeoutInSeconds".equals(fieldName)) { + deserializedJwtAuthModel.requestTimeoutInSeconds = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedJwtAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/KeyVaultAuthenticationMode.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/KeyVaultAuthenticationMode.java new file mode 100644 index 000000000000..ea0253f2f4cd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/KeyVaultAuthenticationMode.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type for authentication identity to key vault. + */ +public final class KeyVaultAuthenticationMode extends ExpandableStringEnum { + /** + * Static value ManagedIdentity for KeyVaultAuthenticationMode. + */ + public static final KeyVaultAuthenticationMode MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** + * Static value ServicePrincipal for KeyVaultAuthenticationMode. + */ + public static final KeyVaultAuthenticationMode SERVICE_PRINCIPAL = fromString("ServicePrincipal"); + + /** + * Creates a new instance of KeyVaultAuthenticationMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyVaultAuthenticationMode() { + } + + /** + * Creates or finds a KeyVaultAuthenticationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyVaultAuthenticationMode. + */ + public static KeyVaultAuthenticationMode fromString(String name) { + return fromString(name, KeyVaultAuthenticationMode.class); + } + + /** + * Gets known KeyVaultAuthenticationMode values. + * + * @return known KeyVaultAuthenticationMode values. + */ + public static Collection values() { + return values(KeyVaultAuthenticationMode.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/KillChainIntent.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/KillChainIntent.java index fbb2cc1ccc75..14bca304db69 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/KillChainIntent.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/KillChainIntent.java @@ -8,7 +8,7 @@ import java.util.Collection; /** - * Holds the alert intent stage(s) mapping for this alert. + * The intent of the alert. */ public final class KillChainIntent extends ExpandableStringEnum { /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Kind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Kind.java new file mode 100644 index 000000000000..990f4dca8a3d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Kind.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of content the metadata is for. + */ +public final class Kind extends ExpandableStringEnum { + /** + * Static value DataConnector for Kind. + */ + public static final Kind DATA_CONNECTOR = fromString("DataConnector"); + + /** + * Static value DataType for Kind. + */ + public static final Kind DATA_TYPE = fromString("DataType"); + + /** + * Static value Workbook for Kind. + */ + public static final Kind WORKBOOK = fromString("Workbook"); + + /** + * Static value WorkbookTemplate for Kind. + */ + public static final Kind WORKBOOK_TEMPLATE = fromString("WorkbookTemplate"); + + /** + * Static value Playbook for Kind. + */ + public static final Kind PLAYBOOK = fromString("Playbook"); + + /** + * Static value PlaybookTemplate for Kind. + */ + public static final Kind PLAYBOOK_TEMPLATE = fromString("PlaybookTemplate"); + + /** + * Static value AnalyticsRuleTemplate for Kind. + */ + public static final Kind ANALYTICS_RULE_TEMPLATE = fromString("AnalyticsRuleTemplate"); + + /** + * Static value AnalyticsRule for Kind. + */ + public static final Kind ANALYTICS_RULE = fromString("AnalyticsRule"); + + /** + * Static value HuntingQuery for Kind. + */ + public static final Kind HUNTING_QUERY = fromString("HuntingQuery"); + + /** + * Static value InvestigationQuery for Kind. + */ + public static final Kind INVESTIGATION_QUERY = fromString("InvestigationQuery"); + + /** + * Static value Parser for Kind. + */ + public static final Kind PARSER = fromString("Parser"); + + /** + * Static value Watchlist for Kind. + */ + public static final Kind WATCHLIST = fromString("Watchlist"); + + /** + * Static value WatchlistTemplate for Kind. + */ + public static final Kind WATCHLIST_TEMPLATE = fromString("WatchlistTemplate"); + + /** + * Static value Solution for Kind. + */ + public static final Kind SOLUTION = fromString("Solution"); + + /** + * Static value AzureFunction for Kind. + */ + public static final Kind AZURE_FUNCTION = fromString("AzureFunction"); + + /** + * Static value LogicAppsCustomConnector for Kind. + */ + public static final Kind LOGIC_APPS_CUSTOM_CONNECTOR = fromString("LogicAppsCustomConnector"); + + /** + * Static value AutomationRule for Kind. + */ + public static final Kind AUTOMATION_RULE = fromString("AutomationRule"); + + /** + * Static value ResourcesDataConnector for Kind. + */ + public static final Kind RESOURCES_DATA_CONNECTOR = fromString("ResourcesDataConnector"); + + /** + * Static value Notebook for Kind. + */ + public static final Kind NOTEBOOK = fromString("Notebook"); + + /** + * Static value Standalone for Kind. + */ + public static final Kind STANDALONE = fromString("Standalone"); + + /** + * Static value SummaryRule for Kind. + */ + public static final Kind SUMMARY_RULE = fromString("SummaryRule"); + + /** + * Static value CustomDetection for Kind. + */ + public static final Kind CUSTOM_DETECTION = fromString("CustomDetection"); + + /** + * Creates a new instance of Kind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Kind() { + } + + /** + * Creates or finds a Kind from its string representation. + * + * @param name a name to look for. + * @return the corresponding Kind. + */ + public static Kind fromString(String name) { + return fromString(name, Kind.class); + } + + /** + * Gets known Kind values. + * + * @return known Kind values. + */ + public static Collection values() { + return values(Kind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LastDataReceivedDataType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LastDataReceivedDataType.java new file mode 100644 index 000000000000..d790a797327c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LastDataReceivedDataType.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Data type for last data received. + */ +@Fluent +public class LastDataReceivedDataType implements JsonSerializable { + /* + * Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} placeholder + */ + private String name; + + /* + * Query for indicate last data received + */ + private String lastDataReceivedQuery; + + /** + * Creates an instance of LastDataReceivedDataType class. + */ + public LastDataReceivedDataType() { + } + + /** + * Get the name property: Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} + * placeholder. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} + * placeholder. + * + * @param name the name value to set. + * @return the LastDataReceivedDataType object itself. + */ + public LastDataReceivedDataType withName(String name) { + this.name = name; + return this; + } + + /** + * Get the lastDataReceivedQuery property: Query for indicate last data received. + * + * @return the lastDataReceivedQuery value. + */ + public String lastDataReceivedQuery() { + return this.lastDataReceivedQuery; + } + + /** + * Set the lastDataReceivedQuery property: Query for indicate last data received. + * + * @param lastDataReceivedQuery the lastDataReceivedQuery value to set. + * @return the LastDataReceivedDataType object itself. + */ + public LastDataReceivedDataType withLastDataReceivedQuery(String lastDataReceivedQuery) { + this.lastDataReceivedQuery = lastDataReceivedQuery; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("lastDataReceivedQuery", this.lastDataReceivedQuery); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LastDataReceivedDataType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LastDataReceivedDataType if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the LastDataReceivedDataType. + */ + public static LastDataReceivedDataType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LastDataReceivedDataType deserializedLastDataReceivedDataType = new LastDataReceivedDataType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedLastDataReceivedDataType.name = reader.getString(); + } else if ("lastDataReceivedQuery".equals(fieldName)) { + deserializedLastDataReceivedDataType.lastDataReceivedQuery = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLastDataReceivedDataType; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ListActionKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ListActionKind.java new file mode 100644 index 000000000000..e5b6d3ed01de --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ListActionKind.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the action. + */ +public final class ListActionKind extends ExpandableStringEnum { + /** + * Static value LockUser for ListActionKind. + */ + public static final ListActionKind LOCK_USER = fromString("LockUser"); + + /** + * Static value UnlockUser for ListActionKind. + */ + public static final ListActionKind UNLOCK_USER = fromString("UnlockUser"); + + /** + * Creates a new instance of ListActionKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ListActionKind() { + } + + /** + * Creates or finds a ListActionKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding ListActionKind. + */ + public static ListActionKind fromString(String name) { + return fromString(name, ListActionKind.class); + } + + /** + * Gets known ListActionKind values. + * + * @return known ListActionKind values. + */ + public static Collection values() { + return values(ListActionKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ListActionsResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ListActionsResponse.java new file mode 100644 index 000000000000..1159e5c18cb4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ListActionsResponse.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; +import java.io.IOException; +import java.util.List; + +/** + * List all actions for a system to perform. + */ +@Fluent +public final class ListActionsResponse implements JsonSerializable { + /* + * Array of actions. + */ + private List value; + + /* + * The link to fetch the next page of actions. + */ + private String nextLink; + + /** + * Creates an instance of ListActionsResponse class. + */ + public ListActionsResponse() { + } + + /** + * Get the value property: Array of actions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of actions. + * + * @param value the value value to set. + * @return the ListActionsResponse object itself. + */ + public ListActionsResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to fetch the next page of actions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to fetch the next page of actions. + * + * @param nextLink the nextLink value to set. + * @return the ListActionsResponse object itself. + */ + public ListActionsResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ListActionsResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ListActionsResponse.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListActionsResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListActionsResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ListActionsResponse. + */ + public static ListActionsResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListActionsResponse deserializedListActionsResponse = new ListActionsResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ActionInner.fromJson(reader1)); + deserializedListActionsResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedListActionsResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedListActionsResponse; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LockUserAction.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LockUserAction.java new file mode 100644 index 000000000000..f74b36d9cd2c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LockUserAction.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; +import java.io.IOException; + +/** + * Represents lock user action. + */ +@Fluent +public final class LockUserAction extends ActionInner { + /* + * The actions kind + */ + private ListActionKind kind = ListActionKind.LOCK_USER; + + /* + * The user to lock + */ + private String user; + + /* + * The reason of the failure of the action. Empty if the action is successful. + */ + private String failureReason; + + /** + * Creates an instance of LockUserAction class. + */ + public LockUserAction() { + } + + /** + * Get the kind property: The actions kind. + * + * @return the kind value. + */ + @Override + public ListActionKind kind() { + return this.kind; + } + + /** + * Get the user property: The user to lock. + * + * @return the user value. + */ + public String user() { + return this.user; + } + + /** + * Set the user property: The user to lock. + * + * @param user the user value to set. + * @return the LockUserAction object itself. + */ + public LockUserAction withUser(String user) { + this.user = user; + return this; + } + + /** + * Get the failureReason property: The reason of the failure of the action. Empty if the action is successful. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Set the failureReason property: The reason of the failure of the action. Empty if the action is successful. + * + * @param failureReason the failureReason value to set. + * @return the LockUserAction object itself. + */ + public LockUserAction withFailureReason(String failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("user", this.user); + jsonWriter.writeStringField("failureReason", this.failureReason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LockUserAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LockUserAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LockUserAction. + */ + public static LockUserAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LockUserAction deserializedLockUserAction = new LockUserAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedLockUserAction.kind = ListActionKind.fromString(reader.getString()); + } else if ("user".equals(fieldName)) { + deserializedLockUserAction.user = reader.getString(); + } else if ("failureReason".equals(fieldName)) { + deserializedLockUserAction.failureReason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLockUserAction; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Log.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Log.java new file mode 100644 index 000000000000..aec391f287f4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Log.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes a log. + */ +@Fluent +public final class Log implements JsonSerializable { + /* + * Types of logs and tables. + */ + private LogType type; + + /* + * Types of ingestion. + */ + private IngestionType ingestionType; + + /* + * Types of log status. + */ + private LogStatusType status; + + /* + * The schedule interval in seconds. + */ + private Integer scheduleInterval; + + /* + * The bulk size for the log. + */ + private Integer bulkSize; + + /* + * The filters for the log. + */ + private List filters; + + /** + * Creates an instance of Log class. + */ + public Log() { + } + + /** + * Get the type property: Types of logs and tables. + * + * @return the type value. + */ + public LogType type() { + return this.type; + } + + /** + * Set the type property: Types of logs and tables. + * + * @param type the type value to set. + * @return the Log object itself. + */ + public Log withType(LogType type) { + this.type = type; + return this; + } + + /** + * Get the ingestionType property: Types of ingestion. + * + * @return the ingestionType value. + */ + public IngestionType ingestionType() { + return this.ingestionType; + } + + /** + * Set the ingestionType property: Types of ingestion. + * + * @param ingestionType the ingestionType value to set. + * @return the Log object itself. + */ + public Log withIngestionType(IngestionType ingestionType) { + this.ingestionType = ingestionType; + return this; + } + + /** + * Get the status property: Types of log status. + * + * @return the status value. + */ + public LogStatusType status() { + return this.status; + } + + /** + * Set the status property: Types of log status. + * + * @param status the status value to set. + * @return the Log object itself. + */ + public Log withStatus(LogStatusType status) { + this.status = status; + return this; + } + + /** + * Get the scheduleInterval property: The schedule interval in seconds. + * + * @return the scheduleInterval value. + */ + public Integer scheduleInterval() { + return this.scheduleInterval; + } + + /** + * Set the scheduleInterval property: The schedule interval in seconds. + * + * @param scheduleInterval the scheduleInterval value to set. + * @return the Log object itself. + */ + public Log withScheduleInterval(Integer scheduleInterval) { + this.scheduleInterval = scheduleInterval; + return this; + } + + /** + * Get the bulkSize property: The bulk size for the log. + * + * @return the bulkSize value. + */ + public Integer bulkSize() { + return this.bulkSize; + } + + /** + * Set the bulkSize property: The bulk size for the log. + * + * @param bulkSize the bulkSize value to set. + * @return the Log object itself. + */ + public Log withBulkSize(Integer bulkSize) { + this.bulkSize = bulkSize; + return this; + } + + /** + * Get the filters property: The filters for the log. + * + * @return the filters value. + */ + public List filters() { + return this.filters; + } + + /** + * Set the filters property: The filters for the log. + * + * @param filters the filters value to set. + * @return the Log object itself. + */ + public Log withFilters(List filters) { + this.filters = filters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property type in model Log")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Log.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("ingestionType", this.ingestionType == null ? null : this.ingestionType.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeNumberField("scheduleInterval", this.scheduleInterval); + jsonWriter.writeNumberField("bulkSize", this.bulkSize); + jsonWriter.writeArrayField("filters", this.filters, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Log from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Log if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Log. + */ + public static Log fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Log deserializedLog = new Log(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedLog.type = LogType.fromString(reader.getString()); + } else if ("ingestionType".equals(fieldName)) { + deserializedLog.ingestionType = IngestionType.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedLog.status = LogStatusType.fromString(reader.getString()); + } else if ("scheduleInterval".equals(fieldName)) { + deserializedLog.scheduleInterval = reader.getNullable(JsonReader::getInt); + } else if ("bulkSize".equals(fieldName)) { + deserializedLog.bulkSize = reader.getNullable(JsonReader::getInt); + } else if ("filters".equals(fieldName)) { + List filters = reader.readArray(reader1 -> reader1.getString()); + deserializedLog.filters = filters; + } else { + reader.skipChildren(); + } + } + + return deserializedLog; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LogStatusType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LogStatusType.java new file mode 100644 index 000000000000..5cff1fbde02a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LogStatusType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of log status. + */ +public final class LogStatusType extends ExpandableStringEnum { + /** + * Static value Enabled for LogStatusType. + */ + public static final LogStatusType ENABLED = fromString("Enabled"); + + /** + * Static value Disabled for LogStatusType. + */ + public static final LogStatusType DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of LogStatusType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LogStatusType() { + } + + /** + * Creates or finds a LogStatusType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LogStatusType. + */ + public static LogStatusType fromString(String name) { + return fromString(name, LogStatusType.class); + } + + /** + * Gets known LogStatusType values. + * + * @return known LogStatusType values. + */ + public static Collection values() { + return values(LogStatusType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LogType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LogType.java new file mode 100644 index 000000000000..92002e5073a1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/LogType.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of logs and tables. + */ +public final class LogType extends ExpandableStringEnum { + /** + * Static value AbapAuditLog for LogType. + */ + public static final LogType ABAP_AUDIT_LOG = fromString("AbapAuditLog"); + + /** + * Static value AbapJobLog for LogType. + */ + public static final LogType ABAP_JOB_LOG = fromString("AbapJobLog"); + + /** + * Static value AbapSpoolLog for LogType. + */ + public static final LogType ABAP_SPOOL_LOG = fromString("AbapSpoolLog"); + + /** + * Static value AbapSpoolOutputLog for LogType. + */ + public static final LogType ABAP_SPOOL_OUTPUT_LOG = fromString("AbapSpoolOutputLog"); + + /** + * Static value AbapChangeDocsLog for LogType. + */ + public static final LogType ABAP_CHANGE_DOCS_LOG = fromString("AbapChangeDocsLog"); + + /** + * Static value AbapAppLog for LogType. + */ + public static final LogType ABAP_APP_LOG = fromString("AbapAppLog"); + + /** + * Static value AbapWorkflowLog for LogType. + */ + public static final LogType ABAP_WORKFLOW_LOG = fromString("AbapWorkflowLog"); + + /** + * Static value AbapCrLog for LogType. + */ + public static final LogType ABAP_CR_LOG = fromString("AbapCrLog"); + + /** + * Static value AbapTableDataLog for LogType. + */ + public static final LogType ABAP_TABLE_DATA_LOG = fromString("AbapTableDataLog"); + + /** + * Static value AbapFilesLogs for LogType. + */ + public static final LogType ABAP_FILES_LOGS = fromString("AbapFilesLogs"); + + /** + * Static value JavaFilesLogs for LogType. + */ + public static final LogType JAVA_FILES_LOGS = fromString("JavaFilesLogs"); + + /** + * Static value AGRTCODES for LogType. + */ + public static final LogType AGRTCODES = fromString("AGRTCODES"); + + /** + * Static value USR01 for LogType. + */ + public static final LogType USR01 = fromString("USR01"); + + /** + * Static value USR02 for LogType. + */ + public static final LogType USR02 = fromString("USR02"); + + /** + * Static value AGR1251 for LogType. + */ + public static final LogType AGR1251 = fromString("AGR1251"); + + /** + * Static value AGRUSERS for LogType. + */ + public static final LogType AGRUSERS = fromString("AGRUSERS"); + + /** + * Static value AGRPROF for LogType. + */ + public static final LogType AGRPROF = fromString("AGRPROF"); + + /** + * Static value UST04 for LogType. + */ + public static final LogType UST04 = fromString("UST04"); + + /** + * Static value USR21 for LogType. + */ + public static final LogType USR21 = fromString("USR21"); + + /** + * Static value ADR6 for LogType. + */ + public static final LogType ADR6 = fromString("ADR6"); + + /** + * Static value ADCP for LogType. + */ + public static final LogType ADCP = fromString("ADCP"); + + /** + * Static value USR05 for LogType. + */ + public static final LogType USR05 = fromString("USR05"); + + /** + * Static value USGRPUSER for LogType. + */ + public static final LogType USGRPUSER = fromString("USGRPUSER"); + + /** + * Static value USERADDR for LogType. + */ + public static final LogType USERADDR = fromString("USERADDR"); + + /** + * Static value DEVACCESS for LogType. + */ + public static final LogType DEVACCESS = fromString("DEVACCESS"); + + /** + * Static value AGRDEFINE for LogType. + */ + public static final LogType AGRDEFINE = fromString("AGRDEFINE"); + + /** + * Static value PAHI for LogType. + */ + public static final LogType PAHI = fromString("PAHI"); + + /** + * Static value AGRAGRS for LogType. + */ + public static final LogType AGRAGRS = fromString("AGRAGRS"); + + /** + * Static value USRSTAMP for LogType. + */ + public static final LogType USRSTAMP = fromString("USRSTAMP"); + + /** + * Static value AGRFLAGS for LogType. + */ + public static final LogType AGRFLAGS = fromString("AGRFLAGS"); + + /** + * Static value SNCSYSACL for LogType. + */ + public static final LogType SNCSYSACL = fromString("SNCSYSACL"); + + /** + * Static value USRACL for LogType. + */ + public static final LogType USRACL = fromString("USRACL"); + + /** + * Creates a new instance of LogType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LogType() { + } + + /** + * Creates or finds a LogType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LogType. + */ + public static LogType fromString(String name) { + return fromString(name, LogType.class); + } + + /** + * Gets known LogType values. + * + * @return known LogType values. + */ + public static Collection values() { + return values(LogType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MLBehaviorAnalyticsAlertRule.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MLBehaviorAnalyticsAlertRule.java new file mode 100644 index 000000000000..5ab303d623b1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MLBehaviorAnalyticsAlertRule.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleInner; +import com.azure.resourcemanager.securityinsights.fluent.models.MLBehaviorAnalyticsAlertRuleProperties; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Represents MLBehaviorAnalytics alert rule. + */ +@Fluent +public final class MLBehaviorAnalyticsAlertRule extends AlertRuleInner { + /* + * The kind of the alert rule + */ + private AlertRuleKind kind = AlertRuleKind.MLBEHAVIOR_ANALYTICS; + + /* + * MLBehaviorAnalytics alert rule properties + */ + private MLBehaviorAnalyticsAlertRuleProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MLBehaviorAnalyticsAlertRule class. + */ + public MLBehaviorAnalyticsAlertRule() { + } + + /** + * Get the kind property: The kind of the alert rule. + * + * @return the kind value. + */ + @Override + public AlertRuleKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: MLBehaviorAnalytics alert rule properties. + * + * @return the innerProperties value. + */ + private MLBehaviorAnalyticsAlertRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public MLBehaviorAnalyticsAlertRule withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @return the alertRuleTemplateName value. + */ + public String alertRuleTemplateName() { + return this.innerProperties() == null ? null : this.innerProperties().alertRuleTemplateName(); + } + + /** + * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @param alertRuleTemplateName the alertRuleTemplateName value to set. + * @return the MLBehaviorAnalyticsAlertRule object itself. + */ + public MLBehaviorAnalyticsAlertRule withAlertRuleTemplateName(String alertRuleTemplateName) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleProperties(); + } + this.innerProperties().withAlertRuleTemplateName(alertRuleTemplateName); + return this; + } + + /** + * Get the description property: The description of the alert rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the displayName property: The display name for alerts created by this alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the MLBehaviorAnalyticsAlertRule object itself. + */ + public MLBehaviorAnalyticsAlertRule withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the lastModifiedUtc property: The last time that this alert rule has been modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc(); + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.innerProperties() == null ? null : this.innerProperties().tactics(); + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.innerProperties() == null ? null : this.innerProperties().techniques(); + } + + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().subTechniques(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MLBehaviorAnalyticsAlertRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MLBehaviorAnalyticsAlertRule if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MLBehaviorAnalyticsAlertRule. + */ + public static MLBehaviorAnalyticsAlertRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MLBehaviorAnalyticsAlertRule deserializedMLBehaviorAnalyticsAlertRule = new MLBehaviorAnalyticsAlertRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRule.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRule.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRule.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRule.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRule.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRule.kind = AlertRuleKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRule.innerProperties + = MLBehaviorAnalyticsAlertRuleProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMLBehaviorAnalyticsAlertRule; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MLBehaviorAnalyticsAlertRuleTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MLBehaviorAnalyticsAlertRuleTemplate.java new file mode 100644 index 000000000000..24f8ce2a3cc7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MLBehaviorAnalyticsAlertRuleTemplate.java @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleTemplateInner; +import com.azure.resourcemanager.securityinsights.fluent.models.MLBehaviorAnalyticsAlertRuleTemplateProperties; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Represents MLBehaviorAnalytics alert rule template. + */ +@Fluent +public final class MLBehaviorAnalyticsAlertRuleTemplate extends AlertRuleTemplateInner { + /* + * The kind of the alert rule + */ + private AlertRuleKind kind = AlertRuleKind.MLBEHAVIOR_ANALYTICS; + + /* + * MLBehaviorAnalytics alert rule template properties. + */ + private MLBehaviorAnalyticsAlertRuleTemplateProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MLBehaviorAnalyticsAlertRuleTemplate class. + */ + public MLBehaviorAnalyticsAlertRuleTemplate() { + } + + /** + * Get the kind property: The kind of the alert rule. + * + * @return the kind value. + */ + @Override + public AlertRuleKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: MLBehaviorAnalytics alert rule template properties. + * + * @return the innerProperties value. + */ + private MLBehaviorAnalyticsAlertRuleTemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate withSeverity(AlertSeverity severity) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.innerProperties() == null ? null : this.innerProperties().tactics(); + } + + /** + * Set the tactics property: The tactics of the alert rule. + * + * @param tactics the tactics value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate withTactics(List tactics) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withTactics(tactics); + return this; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.innerProperties() == null ? null : this.innerProperties().techniques(); + } + + /** + * Set the techniques property: The techniques of the alert rule. + * + * @param techniques the techniques value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate withTechniques(List techniques) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withTechniques(techniques); + return this; + } + + /** + * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @return the alertRulesCreatedByTemplateCount value. + */ + public Integer alertRulesCreatedByTemplateCount() { + return this.innerProperties() == null ? null : this.innerProperties().alertRulesCreatedByTemplateCount(); + } + + /** + * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + public OffsetDateTime lastUpdatedDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateUtc(); + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + public OffsetDateTime createdDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdDateUtc(); + } + + /** + * Get the description property: The description of the alert rule template. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the alert rule template. + * + * @param description the description value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the displayName property: The display name for alert rule template. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name for alert rule template. + * + * @param displayName the displayName value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the requiredDataConnectors property: The required data sources for this template. + * + * @return the requiredDataConnectors value. + */ + public List requiredDataConnectors() { + return this.innerProperties() == null ? null : this.innerProperties().requiredDataConnectors(); + } + + /** + * Set the requiredDataConnectors property: The required data sources for this template. + * + * @param requiredDataConnectors the requiredDataConnectors value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate + withRequiredDataConnectors(List requiredDataConnectors) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * Get the status property: The alert rule template status. + * + * @return the status value. + */ + public TemplateStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The alert rule template status. + * + * @param status the status value to set. + * @return the MLBehaviorAnalyticsAlertRuleTemplate object itself. + */ + public MLBehaviorAnalyticsAlertRuleTemplate withStatus(TemplateStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new MLBehaviorAnalyticsAlertRuleTemplateProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MLBehaviorAnalyticsAlertRuleTemplate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MLBehaviorAnalyticsAlertRuleTemplate if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MLBehaviorAnalyticsAlertRuleTemplate. + */ + public static MLBehaviorAnalyticsAlertRuleTemplate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MLBehaviorAnalyticsAlertRuleTemplate deserializedMLBehaviorAnalyticsAlertRuleTemplate + = new MLBehaviorAnalyticsAlertRuleTemplate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplate.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplate.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplate.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplate.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplate.kind + = AlertRuleKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMLBehaviorAnalyticsAlertRuleTemplate.innerProperties + = MLBehaviorAnalyticsAlertRuleTemplateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMLBehaviorAnalyticsAlertRuleTemplate; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailClusterEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailClusterEntity.java index 2624e61021d4..9f57acaa1f1f 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailClusterEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailClusterEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.MailClusterEntityProperties; import java.io.IOException; import java.time.OffsetDateTime; @@ -19,7 +20,7 @@ * Represents a mail cluster entity. */ @Immutable -public final class MailClusterEntity extends Entity { +public final class MailClusterEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailMessageEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailMessageEntity.java index d0347b297f53..55070f4902df 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailMessageEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailMessageEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.MailMessageEntityProperties; import java.io.IOException; import java.time.OffsetDateTime; @@ -20,7 +21,7 @@ * Represents a mail message entity. */ @Fluent -public final class MailMessageEntity extends Entity { +public final class MailMessageEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailboxEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailboxEntity.java index 544385c39d3f..f2ab7b84a3e1 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailboxEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MailboxEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.MailboxEntityProperties; import java.io.IOException; import java.util.Map; @@ -18,7 +19,7 @@ * Represents a mailbox entity. */ @Immutable -public final class MailboxEntity extends Entity { +public final class MailboxEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MalwareEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MalwareEntity.java index 2569161a74aa..e3a687429393 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MalwareEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MalwareEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.MalwareEntityProperties; import java.io.IOException; import java.util.List; @@ -18,7 +19,7 @@ * Represents a malware entity. */ @Immutable -public final class MalwareEntity extends Entity { +public final class MalwareEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ManualTriggerRequestBody.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ManualTriggerRequestBody.java new file mode 100644 index 000000000000..6513ccebf765 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ManualTriggerRequestBody.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; +import java.util.UUID; + +/** + * The ManualTriggerRequestBody model. + */ +@Fluent +public final class ManualTriggerRequestBody implements JsonSerializable { + /* + * The tenantId property. + */ + private UUID tenantId; + + /* + * The logicAppsResourceId property. + */ + private String logicAppsResourceId; + + /** + * Creates an instance of ManualTriggerRequestBody class. + */ + public ManualTriggerRequestBody() { + } + + /** + * Get the tenantId property: The tenantId property. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenantId property. + * + * @param tenantId the tenantId value to set. + * @return the ManualTriggerRequestBody object itself. + */ + public ManualTriggerRequestBody withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the logicAppsResourceId property: The logicAppsResourceId property. + * + * @return the logicAppsResourceId value. + */ + public String logicAppsResourceId() { + return this.logicAppsResourceId; + } + + /** + * Set the logicAppsResourceId property: The logicAppsResourceId property. + * + * @param logicAppsResourceId the logicAppsResourceId value to set. + * @return the ManualTriggerRequestBody object itself. + */ + public ManualTriggerRequestBody withLogicAppsResourceId(String logicAppsResourceId) { + this.logicAppsResourceId = logicAppsResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logicAppsResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logicAppsResourceId in model ManualTriggerRequestBody")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManualTriggerRequestBody.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("logicAppsResourceId", this.logicAppsResourceId); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManualTriggerRequestBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManualTriggerRequestBody if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManualTriggerRequestBody. + */ + public static ManualTriggerRequestBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManualTriggerRequestBody deserializedManualTriggerRequestBody = new ManualTriggerRequestBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logicAppsResourceId".equals(fieldName)) { + deserializedManualTriggerRequestBody.logicAppsResourceId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManualTriggerRequestBody.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedManualTriggerRequestBody; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasCheckRequirements.java new file mode 100644 index 000000000000..aedc2e39d873 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasCheckRequirements.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.McasCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents MCAS (Microsoft Cloud App Security) requirements check request. + */ +@Fluent +public final class McasCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_CLOUD_APP_SECURITY; + + /* + * MCAS (Microsoft Cloud App Security) requirements check properties. + */ + private McasCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of McasCheckRequirements class. + */ + public McasCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: MCAS (Microsoft Cloud App Security) requirements check properties. + * + * @return the innerProperties value. + */ + McasCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the McasCheckRequirements object itself. + */ + public McasCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new McasCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of McasCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of McasCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the McasCheckRequirements. + */ + public static McasCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + McasCheckRequirements deserializedMcasCheckRequirements = new McasCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedMcasCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMcasCheckRequirements.innerProperties + = McasCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMcasCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnector.java index ef67e7474d1c..1c69f99934c7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnector.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnector.java @@ -123,48 +123,48 @@ public McasDataConnector withEtag(String etag) { } /** - * Get the tenantId property: The tenant id to connect to, and get the data from. + * Get the dataTypes property: The available data types for the connector. * - * @return the tenantId value. + * @return the dataTypes value. */ - public String tenantId() { - return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + public McasDataConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); } /** - * Set the tenantId property: The tenant id to connect to, and get the data from. + * Set the dataTypes property: The available data types for the connector. * - * @param tenantId the tenantId value to set. + * @param dataTypes the dataTypes value to set. * @return the McasDataConnector object itself. */ - public McasDataConnector withTenantId(String tenantId) { + public McasDataConnector withDataTypes(McasDataConnectorDataTypes dataTypes) { if (this.innerProperties() == null) { this.innerProperties = new McasDataConnectorProperties(); } - this.innerProperties().withTenantId(tenantId); + this.innerProperties().withDataTypes(dataTypes); return this; } /** - * Get the dataTypes property: The available data types for the connector. + * Get the tenantId property: The tenant id to connect to, and get the data from. * - * @return the dataTypes value. + * @return the tenantId value. */ - public McasDataConnectorDataTypes dataTypes() { - return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); } /** - * Set the dataTypes property: The available data types for the connector. + * Set the tenantId property: The tenant id to connect to, and get the data from. * - * @param dataTypes the dataTypes value to set. + * @param tenantId the tenantId value to set. * @return the McasDataConnector object itself. */ - public McasDataConnector withDataTypes(McasDataConnectorDataTypes dataTypes) { + public McasDataConnector withTenantId(String tenantId) { if (this.innerProperties() == null) { this.innerProperties = new McasDataConnectorProperties(); } - this.innerProperties().withDataTypes(dataTypes); + this.innerProperties().withTenantId(tenantId); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnectorDataTypes.java index 130604edbcf1..105e36f1456f 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnectorDataTypes.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/McasDataConnectorDataTypes.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -65,11 +66,17 @@ public void validate() { if (discoveryLogs() != null) { discoveryLogs().validate(); } - if (alerts() != null) { + if (alerts() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property alerts in model McasDataConnectorDataTypes")); + } else { alerts().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(McasDataConnectorDataTypes.class); + /** * {@inheritDoc} */ @@ -87,6 +94,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of McasDataConnectorDataTypes if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the McasDataConnectorDataTypes. */ public static McasDataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MdatpCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MdatpCheckRequirements.java new file mode 100644 index 000000000000..69dfef84d275 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MdatpCheckRequirements.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.MdatpCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents MDATP (Microsoft Defender Advanced Threat Protection) requirements check request. + */ +@Fluent +public final class MdatpCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_DEFENDER_ADVANCED_THREAT_PROTECTION; + + /* + * MDATP (Microsoft Defender Advanced Threat Protection) requirements check properties. + */ + private MdatpCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of MdatpCheckRequirements class. + */ + public MdatpCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: MDATP (Microsoft Defender Advanced Threat Protection) requirements check + * properties. + * + * @return the innerProperties value. + */ + MdatpCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the MdatpCheckRequirements object itself. + */ + public MdatpCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new MdatpCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MdatpCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MdatpCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MdatpCheckRequirements. + */ + public static MdatpCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MdatpCheckRequirements deserializedMdatpCheckRequirements = new MdatpCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedMdatpCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMdatpCheckRequirements.innerProperties + = MdatpCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMdatpCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MdatpDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MdatpDataConnector.java index 3f27949c9039..3867968030a5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MdatpDataConnector.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MdatpDataConnector.java @@ -124,48 +124,48 @@ public MdatpDataConnector withEtag(String etag) { } /** - * Get the tenantId property: The tenant id to connect to, and get the data from. + * Get the dataTypes property: The available data types for the connector. * - * @return the tenantId value. + * @return the dataTypes value. */ - public String tenantId() { - return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + public AlertsDataTypeOfDataConnector dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); } /** - * Set the tenantId property: The tenant id to connect to, and get the data from. + * Set the dataTypes property: The available data types for the connector. * - * @param tenantId the tenantId value to set. + * @param dataTypes the dataTypes value to set. * @return the MdatpDataConnector object itself. */ - public MdatpDataConnector withTenantId(String tenantId) { + public MdatpDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { if (this.innerProperties() == null) { this.innerProperties = new MdatpDataConnectorProperties(); } - this.innerProperties().withTenantId(tenantId); + this.innerProperties().withDataTypes(dataTypes); return this; } /** - * Get the dataTypes property: The available data types for the connector. + * Get the tenantId property: The tenant id to connect to, and get the data from. * - * @return the dataTypes value. + * @return the tenantId value. */ - public AlertsDataTypeOfDataConnector dataTypes() { - return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); } /** - * Set the dataTypes property: The available data types for the connector. + * Set the tenantId property: The tenant id to connect to, and get the data from. * - * @param dataTypes the dataTypes value to set. + * @param tenantId the tenantId value to set. * @return the MdatpDataConnector object itself. */ - public MdatpDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + public MdatpDataConnector withTenantId(String tenantId) { if (this.innerProperties() == null) { this.innerProperties = new MdatpDataConnectorProperties(); } - this.innerProperties().withDataTypes(dataTypes); + this.innerProperties().withTenantId(tenantId); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataAuthor.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataAuthor.java new file mode 100644 index 000000000000..8b723fd9eb2a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataAuthor.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Publisher or creator of the content item. + */ +@Fluent +public final class MetadataAuthor implements JsonSerializable { + /* + * Name of the author. Company or person. + */ + private String name; + + /* + * Email of author contact + */ + private String email; + + /* + * Link for author/vendor page + */ + private String link; + + /** + * Creates an instance of MetadataAuthor class. + */ + public MetadataAuthor() { + } + + /** + * Get the name property: Name of the author. Company or person. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the author. Company or person. + * + * @param name the name value to set. + * @return the MetadataAuthor object itself. + */ + public MetadataAuthor withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email property: Email of author contact. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: Email of author contact. + * + * @param email the email value to set. + * @return the MetadataAuthor object itself. + */ + public MetadataAuthor withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the link property: Link for author/vendor page. + * + * @return the link value. + */ + public String link() { + return this.link; + } + + /** + * Set the link property: Link for author/vendor page. + * + * @param link the link value to set. + * @return the MetadataAuthor object itself. + */ + public MetadataAuthor withLink(String link) { + this.link = link; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("email", this.email); + jsonWriter.writeStringField("link", this.link); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataAuthor from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataAuthor if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetadataAuthor. + */ + public static MetadataAuthor fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataAuthor deserializedMetadataAuthor = new MetadataAuthor(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMetadataAuthor.name = reader.getString(); + } else if ("email".equals(fieldName)) { + deserializedMetadataAuthor.email = reader.getString(); + } else if ("link".equals(fieldName)) { + deserializedMetadataAuthor.link = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataAuthor; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataCategories.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataCategories.java new file mode 100644 index 000000000000..e13526e4a32b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataCategories.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * ies for the solution content item. + */ +@Fluent +public final class MetadataCategories implements JsonSerializable { + /* + * domain for the solution content item + */ + private List domains; + + /* + * Industry verticals for the solution content item + */ + private List verticals; + + /** + * Creates an instance of MetadataCategories class. + */ + public MetadataCategories() { + } + + /** + * Get the domains property: domain for the solution content item. + * + * @return the domains value. + */ + public List domains() { + return this.domains; + } + + /** + * Set the domains property: domain for the solution content item. + * + * @param domains the domains value to set. + * @return the MetadataCategories object itself. + */ + public MetadataCategories withDomains(List domains) { + this.domains = domains; + return this; + } + + /** + * Get the verticals property: Industry verticals for the solution content item. + * + * @return the verticals value. + */ + public List verticals() { + return this.verticals; + } + + /** + * Set the verticals property: Industry verticals for the solution content item. + * + * @param verticals the verticals value to set. + * @return the MetadataCategories object itself. + */ + public MetadataCategories withVerticals(List verticals) { + this.verticals = verticals; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("domains", this.domains, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("verticals", this.verticals, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataCategories from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataCategories if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MetadataCategories. + */ + public static MetadataCategories fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataCategories deserializedMetadataCategories = new MetadataCategories(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domains".equals(fieldName)) { + List domains = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataCategories.domains = domains; + } else if ("verticals".equals(fieldName)) { + List verticals = reader.readArray(reader1 -> reader1.getString()); + deserializedMetadataCategories.verticals = verticals; + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataCategories; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataDependencies.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataDependencies.java new file mode 100644 index 000000000000..66d8e6132274 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataDependencies.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Dependencies for the content item, what other content items it requires to work. Can describe more complex + * dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or + * operator/criteria for complex dependencies. + */ +@Fluent +public final class MetadataDependencies implements JsonSerializable { + /* + * Id of the content item we depend on + */ + private String contentId; + + /* + * Type of the content item we depend on + */ + private Kind kind; + + /* + * Version of the the content item we depend on. Can be blank, * or missing to indicate any version fulfills the + * dependency. If version does not match our defined numeric format then an exact match is required. + */ + private String version; + + /* + * Name of the content item + */ + private String name; + + /* + * Operator used for list of dependencies in criteria array. + */ + private Operator operator; + + /* + * This is the list of dependencies we must fulfill, according to the AND/OR operator + */ + private List criteria; + + /** + * Creates an instance of MetadataDependencies class. + */ + public MetadataDependencies() { + } + + /** + * Get the contentId property: Id of the content item we depend on. + * + * @return the contentId value. + */ + public String contentId() { + return this.contentId; + } + + /** + * Set the contentId property: Id of the content item we depend on. + * + * @param contentId the contentId value to set. + * @return the MetadataDependencies object itself. + */ + public MetadataDependencies withContentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Get the kind property: Type of the content item we depend on. + * + * @return the kind value. + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind property: Type of the content item we depend on. + * + * @param kind the kind value to set. + * @return the MetadataDependencies object itself. + */ + public MetadataDependencies withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the version property: Version of the the content item we depend on. Can be blank, * or missing to indicate + * any version fulfills the dependency. If version does not match our defined numeric format then an exact match is + * required. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version of the the content item we depend on. Can be blank, * or missing to indicate + * any version fulfills the dependency. If version does not match our defined numeric format then an exact match is + * required. + * + * @param version the version value to set. + * @return the MetadataDependencies object itself. + */ + public MetadataDependencies withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the name property: Name of the content item. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the content item. + * + * @param name the name value to set. + * @return the MetadataDependencies object itself. + */ + public MetadataDependencies withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operator property: Operator used for list of dependencies in criteria array. + * + * @return the operator value. + */ + public Operator operator() { + return this.operator; + } + + /** + * Set the operator property: Operator used for list of dependencies in criteria array. + * + * @param operator the operator value to set. + * @return the MetadataDependencies object itself. + */ + public MetadataDependencies withOperator(Operator operator) { + this.operator = operator; + return this; + } + + /** + * Get the criteria property: This is the list of dependencies we must fulfill, according to the AND/OR operator. + * + * @return the criteria value. + */ + public List criteria() { + return this.criteria; + } + + /** + * Set the criteria property: This is the list of dependencies we must fulfill, according to the AND/OR operator. + * + * @param criteria the criteria value to set. + * @return the MetadataDependencies object itself. + */ + public MetadataDependencies withCriteria(List criteria) { + this.criteria = criteria; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (criteria() != null) { + criteria().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", this.contentId); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString()); + jsonWriter.writeArrayField("criteria", this.criteria, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataDependencies from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataDependencies if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MetadataDependencies. + */ + public static MetadataDependencies fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataDependencies deserializedMetadataDependencies = new MetadataDependencies(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedMetadataDependencies.contentId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedMetadataDependencies.kind = Kind.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedMetadataDependencies.version = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMetadataDependencies.name = reader.getString(); + } else if ("operator".equals(fieldName)) { + deserializedMetadataDependencies.operator = Operator.fromString(reader.getString()); + } else if ("criteria".equals(fieldName)) { + List criteria + = reader.readArray(reader1 -> MetadataDependencies.fromJson(reader1)); + deserializedMetadataDependencies.criteria = criteria; + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataDependencies; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataList.java new file mode 100644 index 000000000000..b87c0a466352 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.MetadataModelInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the metadata. + */ +@Fluent +public final class MetadataList implements JsonSerializable { + /* + * Array of metadata. + */ + private List value; + + /* + * URL to fetch the next page of metadata. + */ + private String nextLink; + + /** + * Creates an instance of MetadataList class. + */ + public MetadataList() { + } + + /** + * Get the value property: Array of metadata. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of metadata. + * + * @param value the value value to set. + * @return the MetadataList object itself. + */ + public MetadataList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to fetch the next page of metadata. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model MetadataList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetadataList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetadataList. + */ + public static MetadataList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataList deserializedMetadataList = new MetadataList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> MetadataModelInner.fromJson(reader1)); + deserializedMetadataList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMetadataList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataModel.java new file mode 100644 index 000000000000..0a1d7ff5a2dc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataModel.java @@ -0,0 +1,885 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.MetadataModelInner; +import java.time.LocalDate; +import java.util.List; + +/** + * An immutable client-side representation of MetadataModel. + */ +public interface MetadataModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + String contentId(); + + /** + * Gets the parentId property: Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * + * @return the parentId value. + */ + String parentId(); + + /** + * Gets the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + String version(); + + /** + * Gets the kind property: The kind of content the metadata is for. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + MetadataSource source(); + + /** + * Gets the author property: The creator of the content item. + * + * @return the author value. + */ + MetadataAuthor author(); + + /** + * Gets the support property: Support information for the metadata - type, name, contact information. + * + * @return the support value. + */ + MetadataSupport support(); + + /** + * Gets the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + MetadataDependencies dependencies(); + + /** + * Gets the categories property: Categories for the solution content item. + * + * @return the categories value. + */ + MetadataCategories categories(); + + /** + * Gets the providers property: Providers for the solution content item. + * + * @return the providers value. + */ + List providers(); + + /** + * Gets the firstPublishDate property: first publish date solution content item. + * + * @return the firstPublishDate value. + */ + LocalDate firstPublishDate(); + + /** + * Gets the lastPublishDate property: last publish date for the solution content item. + * + * @return the lastPublishDate value. + */ + LocalDate lastPublishDate(); + + /** + * Gets the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + String customVersion(); + + /** + * Gets the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + String contentSchemaVersion(); + + /** + * Gets the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + List threatAnalysisTactics(); + + /** + * Gets the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + List threatAnalysisTechniques(); + + /** + * Gets the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + List previewImages(); + + /** + * Gets the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + List previewImagesDark(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.MetadataModelInner object. + * + * @return the inner object. + */ + MetadataModelInner innerModel(); + + /** + * The entirety of the MetadataModel definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The MetadataModel definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MetadataModel definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the MetadataModel definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the MetadataModel definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithContentId, + DefinitionStages.WithParentId, DefinitionStages.WithVersion, DefinitionStages.WithKind, + DefinitionStages.WithSource, DefinitionStages.WithAuthor, DefinitionStages.WithSupport, + DefinitionStages.WithDependencies, DefinitionStages.WithCategories, DefinitionStages.WithProviders, + DefinitionStages.WithFirstPublishDate, DefinitionStages.WithLastPublishDate, + DefinitionStages.WithCustomVersion, DefinitionStages.WithContentSchemaVersion, DefinitionStages.WithIcon, + DefinitionStages.WithThreatAnalysisTactics, DefinitionStages.WithThreatAnalysisTechniques, + DefinitionStages.WithPreviewImages, DefinitionStages.WithPreviewImagesDark { + /** + * Executes the create request. + * + * @return the created resource. + */ + MetadataModel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MetadataModel create(Context context); + } + + /** + * The stage of the MetadataModel definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the MetadataModel definition allowing to specify contentId. + */ + interface WithContentId { + /** + * Specifies the contentId property: Static ID for the content. Used to identify dependencies and content + * from solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic for + * user-created. This is the resource name. + * + * @param contentId Static ID for the content. Used to identify dependencies and content from solutions or + * community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is + * the resource name. + * @return the next definition stage. + */ + WithCreate withContentId(String contentId); + } + + /** + * The stage of the MetadataModel definition allowing to specify parentId. + */ + interface WithParentId { + /** + * Specifies the parentId property: Full parent resource ID of the content item the metadata is for. This is + * the full resource ID including the scope (subscription and resource group). + * + * @param parentId Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * @return the next definition stage. + */ + WithCreate withParentId(String parentId); + } + + /** + * The stage of the MetadataModel definition allowing to specify version. + */ + interface WithVersion { + /** + * Specifies the version property: Version of the content. Default and recommended format is numeric (e.g. + * 1, 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we + * cannot guarantee any version checks. + * + * @param version Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + + /** + * The stage of the MetadataModel definition allowing to specify kind. + */ + interface WithKind { + /** + * Specifies the kind property: The kind of content the metadata is for.. + * + * @param kind The kind of content the metadata is for. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + + /** + * The stage of the MetadataModel definition allowing to specify source. + */ + interface WithSource { + /** + * Specifies the source property: Source of the content. This is where/how it was created.. + * + * @param source Source of the content. This is where/how it was created. + * @return the next definition stage. + */ + WithCreate withSource(MetadataSource source); + } + + /** + * The stage of the MetadataModel definition allowing to specify author. + */ + interface WithAuthor { + /** + * Specifies the author property: The creator of the content item.. + * + * @param author The creator of the content item. + * @return the next definition stage. + */ + WithCreate withAuthor(MetadataAuthor author); + } + + /** + * The stage of the MetadataModel definition allowing to specify support. + */ + interface WithSupport { + /** + * Specifies the support property: Support information for the metadata - type, name, contact information. + * + * @param support Support information for the metadata - type, name, contact information. + * @return the next definition stage. + */ + WithCreate withSupport(MetadataSupport support); + } + + /** + * The stage of the MetadataModel definition allowing to specify dependencies. + */ + interface WithDependencies { + /** + * Specifies the dependencies property: Dependencies for the content item, what other content items it + * requires to work. Can describe more complex dependencies using a recursive/nested structure. For a single + * dependency an id/kind/version can be supplied or operator/criteria for complex formats.. + * + * @param dependencies Dependencies for the content item, what other content items it requires to work. Can + * describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * @return the next definition stage. + */ + WithCreate withDependencies(MetadataDependencies dependencies); + } + + /** + * The stage of the MetadataModel definition allowing to specify categories. + */ + interface WithCategories { + /** + * Specifies the categories property: Categories for the solution content item. + * + * @param categories Categories for the solution content item. + * @return the next definition stage. + */ + WithCreate withCategories(MetadataCategories categories); + } + + /** + * The stage of the MetadataModel definition allowing to specify providers. + */ + interface WithProviders { + /** + * Specifies the providers property: Providers for the solution content item. + * + * @param providers Providers for the solution content item. + * @return the next definition stage. + */ + WithCreate withProviders(List providers); + } + + /** + * The stage of the MetadataModel definition allowing to specify firstPublishDate. + */ + interface WithFirstPublishDate { + /** + * Specifies the firstPublishDate property: first publish date solution content item. + * + * @param firstPublishDate first publish date solution content item. + * @return the next definition stage. + */ + WithCreate withFirstPublishDate(LocalDate firstPublishDate); + } + + /** + * The stage of the MetadataModel definition allowing to specify lastPublishDate. + */ + interface WithLastPublishDate { + /** + * Specifies the lastPublishDate property: last publish date for the solution content item. + * + * @param lastPublishDate last publish date for the solution content item. + * @return the next definition stage. + */ + WithCreate withLastPublishDate(LocalDate lastPublishDate); + } + + /** + * The stage of the MetadataModel definition allowing to specify customVersion. + */ + interface WithCustomVersion { + /** + * Specifies the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion The custom version of the content. A optional free text. + * @return the next definition stage. + */ + WithCreate withCustomVersion(String customVersion); + } + + /** + * The stage of the MetadataModel definition allowing to specify contentSchemaVersion. + */ + interface WithContentSchemaVersion { + /** + * Specifies the contentSchemaVersion property: Schema version of the content. Can be used to distinguish + * between different flow based on the schema version. + * + * @param contentSchemaVersion Schema version of the content. Can be used to distinguish between different + * flow based on the schema version. + * @return the next definition stage. + */ + WithCreate withContentSchemaVersion(String contentSchemaVersion); + } + + /** + * The stage of the MetadataModel definition allowing to specify icon. + */ + interface WithIcon { + /** + * Specifies the icon property: the icon identifier. this id can later be fetched from the solution + * template. + * + * @param icon the icon identifier. this id can later be fetched from the solution template. + * @return the next definition stage. + */ + WithCreate withIcon(String icon); + } + + /** + * The stage of the MetadataModel definition allowing to specify threatAnalysisTactics. + */ + interface WithThreatAnalysisTactics { + /** + * Specifies the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the tactics the resource covers. + * @return the next definition stage. + */ + WithCreate withThreatAnalysisTactics(List threatAnalysisTactics); + } + + /** + * The stage of the MetadataModel definition allowing to specify threatAnalysisTechniques. + */ + interface WithThreatAnalysisTechniques { + /** + * Specifies the threatAnalysisTechniques property: the techniques the resource covers, these have to be + * aligned with the tactics being used. + * + * @param threatAnalysisTechniques the techniques the resource covers, these have to be aligned with the + * tactics being used. + * @return the next definition stage. + */ + WithCreate withThreatAnalysisTechniques(List threatAnalysisTechniques); + } + + /** + * The stage of the MetadataModel definition allowing to specify previewImages. + */ + interface WithPreviewImages { + /** + * Specifies the previewImages property: preview image file names. These will be taken from the solution + * artifacts. + * + * @param previewImages preview image file names. These will be taken from the solution artifacts. + * @return the next definition stage. + */ + WithCreate withPreviewImages(List previewImages); + } + + /** + * The stage of the MetadataModel definition allowing to specify previewImagesDark. + */ + interface WithPreviewImagesDark { + /** + * Specifies the previewImagesDark property: preview image file names. These will be taken from the solution + * artifacts. used for dark theme support. + * + * @param previewImagesDark preview image file names. These will be taken from the solution artifacts. used + * for dark theme support. + * @return the next definition stage. + */ + WithCreate withPreviewImagesDark(List previewImagesDark); + } + } + + /** + * Begins update for the MetadataModel resource. + * + * @return the stage of resource update. + */ + MetadataModel.Update update(); + + /** + * The template for MetadataModel update. + */ + interface Update + extends UpdateStages.WithEtag, UpdateStages.WithContentId, UpdateStages.WithParentId, UpdateStages.WithVersion, + UpdateStages.WithKind, UpdateStages.WithSource, UpdateStages.WithAuthor, UpdateStages.WithSupport, + UpdateStages.WithDependencies, UpdateStages.WithCategories, UpdateStages.WithProviders, + UpdateStages.WithFirstPublishDate, UpdateStages.WithLastPublishDate, UpdateStages.WithCustomVersion, + UpdateStages.WithContentSchemaVersion, UpdateStages.WithIcon, UpdateStages.WithThreatAnalysisTactics, + UpdateStages.WithThreatAnalysisTechniques, UpdateStages.WithPreviewImages, UpdateStages.WithPreviewImagesDark { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MetadataModel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MetadataModel apply(Context context); + } + + /** + * The MetadataModel update stages. + */ + interface UpdateStages { + /** + * The stage of the MetadataModel update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the MetadataModel update allowing to specify contentId. + */ + interface WithContentId { + /** + * Specifies the contentId property: Static ID for the content. Used to identify dependencies and content + * from solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic for + * user-created. This is the resource name. + * + * @param contentId Static ID for the content. Used to identify dependencies and content from solutions or + * community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is + * the resource name. + * @return the next definition stage. + */ + Update withContentId(String contentId); + } + + /** + * The stage of the MetadataModel update allowing to specify parentId. + */ + interface WithParentId { + /** + * Specifies the parentId property: Full parent resource ID of the content item the metadata is for. This is + * the full resource ID including the scope (subscription and resource group). + * + * @param parentId Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * @return the next definition stage. + */ + Update withParentId(String parentId); + } + + /** + * The stage of the MetadataModel update allowing to specify version. + */ + interface WithVersion { + /** + * Specifies the version property: Version of the content. Default and recommended format is numeric (e.g. + * 1, 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we + * cannot guarantee any version checks. + * + * @param version Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * @return the next definition stage. + */ + Update withVersion(String version); + } + + /** + * The stage of the MetadataModel update allowing to specify kind. + */ + interface WithKind { + /** + * Specifies the kind property: The kind of content the metadata is for.. + * + * @param kind The kind of content the metadata is for. + * @return the next definition stage. + */ + Update withKind(String kind); + } + + /** + * The stage of the MetadataModel update allowing to specify source. + */ + interface WithSource { + /** + * Specifies the source property: Source of the content. This is where/how it was created.. + * + * @param source Source of the content. This is where/how it was created. + * @return the next definition stage. + */ + Update withSource(MetadataSource source); + } + + /** + * The stage of the MetadataModel update allowing to specify author. + */ + interface WithAuthor { + /** + * Specifies the author property: The creator of the content item.. + * + * @param author The creator of the content item. + * @return the next definition stage. + */ + Update withAuthor(MetadataAuthor author); + } + + /** + * The stage of the MetadataModel update allowing to specify support. + */ + interface WithSupport { + /** + * Specifies the support property: Support information for the metadata - type, name, contact information. + * + * @param support Support information for the metadata - type, name, contact information. + * @return the next definition stage. + */ + Update withSupport(MetadataSupport support); + } + + /** + * The stage of the MetadataModel update allowing to specify dependencies. + */ + interface WithDependencies { + /** + * Specifies the dependencies property: Dependencies for the content item, what other content items it + * requires to work. Can describe more complex dependencies using a recursive/nested structure. For a single + * dependency an id/kind/version can be supplied or operator/criteria for complex formats.. + * + * @param dependencies Dependencies for the content item, what other content items it requires to work. Can + * describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * @return the next definition stage. + */ + Update withDependencies(MetadataDependencies dependencies); + } + + /** + * The stage of the MetadataModel update allowing to specify categories. + */ + interface WithCategories { + /** + * Specifies the categories property: Categories for the solution content item. + * + * @param categories Categories for the solution content item. + * @return the next definition stage. + */ + Update withCategories(MetadataCategories categories); + } + + /** + * The stage of the MetadataModel update allowing to specify providers. + */ + interface WithProviders { + /** + * Specifies the providers property: Providers for the solution content item. + * + * @param providers Providers for the solution content item. + * @return the next definition stage. + */ + Update withProviders(List providers); + } + + /** + * The stage of the MetadataModel update allowing to specify firstPublishDate. + */ + interface WithFirstPublishDate { + /** + * Specifies the firstPublishDate property: first publish date solution content item. + * + * @param firstPublishDate first publish date solution content item. + * @return the next definition stage. + */ + Update withFirstPublishDate(LocalDate firstPublishDate); + } + + /** + * The stage of the MetadataModel update allowing to specify lastPublishDate. + */ + interface WithLastPublishDate { + /** + * Specifies the lastPublishDate property: last publish date for the solution content item. + * + * @param lastPublishDate last publish date for the solution content item. + * @return the next definition stage. + */ + Update withLastPublishDate(LocalDate lastPublishDate); + } + + /** + * The stage of the MetadataModel update allowing to specify customVersion. + */ + interface WithCustomVersion { + /** + * Specifies the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion The custom version of the content. A optional free text. + * @return the next definition stage. + */ + Update withCustomVersion(String customVersion); + } + + /** + * The stage of the MetadataModel update allowing to specify contentSchemaVersion. + */ + interface WithContentSchemaVersion { + /** + * Specifies the contentSchemaVersion property: Schema version of the content. Can be used to distinguish + * between different flow based on the schema version. + * + * @param contentSchemaVersion Schema version of the content. Can be used to distinguish between different + * flow based on the schema version. + * @return the next definition stage. + */ + Update withContentSchemaVersion(String contentSchemaVersion); + } + + /** + * The stage of the MetadataModel update allowing to specify icon. + */ + interface WithIcon { + /** + * Specifies the icon property: the icon identifier. this id can later be fetched from the solution + * template. + * + * @param icon the icon identifier. this id can later be fetched from the solution template. + * @return the next definition stage. + */ + Update withIcon(String icon); + } + + /** + * The stage of the MetadataModel update allowing to specify threatAnalysisTactics. + */ + interface WithThreatAnalysisTactics { + /** + * Specifies the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the tactics the resource covers. + * @return the next definition stage. + */ + Update withThreatAnalysisTactics(List threatAnalysisTactics); + } + + /** + * The stage of the MetadataModel update allowing to specify threatAnalysisTechniques. + */ + interface WithThreatAnalysisTechniques { + /** + * Specifies the threatAnalysisTechniques property: the techniques the resource covers, these have to be + * aligned with the tactics being used. + * + * @param threatAnalysisTechniques the techniques the resource covers, these have to be aligned with the + * tactics being used. + * @return the next definition stage. + */ + Update withThreatAnalysisTechniques(List threatAnalysisTechniques); + } + + /** + * The stage of the MetadataModel update allowing to specify previewImages. + */ + interface WithPreviewImages { + /** + * Specifies the previewImages property: preview image file names. These will be taken from the solution + * artifacts. + * + * @param previewImages preview image file names. These will be taken from the solution artifacts. + * @return the next definition stage. + */ + Update withPreviewImages(List previewImages); + } + + /** + * The stage of the MetadataModel update allowing to specify previewImagesDark. + */ + interface WithPreviewImagesDark { + /** + * Specifies the previewImagesDark property: preview image file names. These will be taken from the solution + * artifacts. used for dark theme support. + * + * @param previewImagesDark preview image file names. These will be taken from the solution artifacts. used + * for dark theme support. + * @return the next definition stage. + */ + Update withPreviewImagesDark(List previewImagesDark); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MetadataModel refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MetadataModel refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataPatch.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataPatch.java new file mode 100644 index 000000000000..cdfe5eeb8708 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataPatch.java @@ -0,0 +1,627 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.MetadataPropertiesPatch; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; + +/** + * Metadata patch request body. + */ +@Fluent +public final class MetadataPatch extends ResourceWithEtag { + /* + * Metadata patch request body + */ + private MetadataPropertiesPatch innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MetadataPatch class. + */ + public MetadataPatch() { + } + + /** + * Get the innerProperties property: Metadata patch request body. + * + * @return the innerProperties value. + */ + private MetadataPropertiesPatch innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public MetadataPatch withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + public String contentId() { + return this.innerProperties() == null ? null : this.innerProperties().contentId(); + } + + /** + * Set the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @param contentId the contentId value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withContentId(String contentId) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withContentId(contentId); + return this; + } + + /** + * Get the parentId property: Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * + * @return the parentId value. + */ + public String parentId() { + return this.innerProperties() == null ? null : this.innerProperties().parentId(); + } + + /** + * Set the parentId property: Full parent resource ID of the content item the metadata is for. This is the full + * resource ID including the scope (subscription and resource group). + * + * @param parentId the parentId value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withParentId(String parentId) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withParentId(parentId); + return this; + } + + /** + * Get the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @param version the version value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the kind property: The kind of content the metadata is for. + * + * @return the kind value. + */ + public String kind() { + return this.innerProperties() == null ? null : this.innerProperties().kind(); + } + + /** + * Set the kind property: The kind of content the metadata is for. + * + * @param kind the kind value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withKind(String kind) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withKind(kind); + return this; + } + + /** + * Get the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + public MetadataSource source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: Source of the content. This is where/how it was created. + * + * @param source the source value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withSource(MetadataSource source) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the author property: The creator of the content item. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.innerProperties() == null ? null : this.innerProperties().author(); + } + + /** + * Set the author property: The creator of the content item. + * + * @param author the author value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withAuthor(MetadataAuthor author) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withAuthor(author); + return this; + } + + /** + * Get the support property: Support information for the metadata - type, name, contact information. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.innerProperties() == null ? null : this.innerProperties().support(); + } + + /** + * Set the support property: Support information for the metadata - type, name, contact information. + * + * @param support the support value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withSupport(MetadataSupport support) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withSupport(support); + return this; + } + + /** + * Get the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.innerProperties() == null ? null : this.innerProperties().dependencies(); + } + + /** + * Set the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @param dependencies the dependencies value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withDependencies(MetadataDependencies dependencies) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withDependencies(dependencies); + return this; + } + + /** + * Get the categories property: Categories for the solution content item. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.innerProperties() == null ? null : this.innerProperties().categories(); + } + + /** + * Set the categories property: Categories for the solution content item. + * + * @param categories the categories value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withCategories(MetadataCategories categories) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withCategories(categories); + return this; + } + + /** + * Get the providers property: Providers for the solution content item. + * + * @return the providers value. + */ + public List providers() { + return this.innerProperties() == null ? null : this.innerProperties().providers(); + } + + /** + * Set the providers property: Providers for the solution content item. + * + * @param providers the providers value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withProviders(List providers) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withProviders(providers); + return this; + } + + /** + * Get the firstPublishDate property: first publish date solution content item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().firstPublishDate(); + } + + /** + * Set the firstPublishDate property: first publish date solution content item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withFirstPublishDate(LocalDate firstPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withFirstPublishDate(firstPublishDate); + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the solution content item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastPublishDate(); + } + + /** + * Set the lastPublishDate property: last publish date for the solution content item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withLastPublishDate(LocalDate lastPublishDate) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withLastPublishDate(lastPublishDate); + return this; + } + + /** + * Get the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + public String customVersion() { + return this.innerProperties() == null ? null : this.innerProperties().customVersion(); + } + + /** + * Set the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion the customVersion value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withCustomVersion(String customVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withCustomVersion(customVersion); + return this; + } + + /** + * Get the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.innerProperties() == null ? null : this.innerProperties().contentSchemaVersion(); + } + + /** + * Set the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withContentSchemaVersion(String contentSchemaVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withContentSchemaVersion(contentSchemaVersion); + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @return the icon value. + */ + public String icon() { + return this.innerProperties() == null ? null : this.innerProperties().icon(); + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the solution template. + * + * @param icon the icon value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withIcon(String icon) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withIcon(icon); + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTactics(); + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withThreatAnalysisTactics(List threatAnalysisTactics) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withThreatAnalysisTactics(threatAnalysisTactics); + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().threatAnalysisTechniques(); + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withThreatAnalysisTechniques(List threatAnalysisTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withThreatAnalysisTechniques(threatAnalysisTechniques); + return this; + } + + /** + * Get the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + public List previewImages() { + return this.innerProperties() == null ? null : this.innerProperties().previewImages(); + } + + /** + * Set the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @param previewImages the previewImages value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withPreviewImages(List previewImages) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withPreviewImages(previewImages); + return this; + } + + /** + * Get the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + public List previewImagesDark() { + return this.innerProperties() == null ? null : this.innerProperties().previewImagesDark(); + } + + /** + * Set the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @param previewImagesDark the previewImagesDark value to set. + * @return the MetadataPatch object itself. + */ + public MetadataPatch withPreviewImagesDark(List previewImagesDark) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataPropertiesPatch(); + } + this.innerProperties().withPreviewImagesDark(previewImagesDark); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataPatch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetadataPatch. + */ + public static MetadataPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataPatch deserializedMetadataPatch = new MetadataPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMetadataPatch.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMetadataPatch.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMetadataPatch.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedMetadataPatch.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedMetadataPatch.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedMetadataPatch.innerProperties = MetadataPropertiesPatch.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataPatch; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataSource.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataSource.java new file mode 100644 index 000000000000..c292189ef761 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataSource.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The original source of the content item, where it comes from. + */ +@Fluent +public final class MetadataSource implements JsonSerializable { + /* + * Source type of the content + */ + private SourceKind kind; + + /* + * Name of the content source. The repo name, solution name, LA workspace name etc. + */ + private String name; + + /* + * ID of the content source. The solution ID, workspace ID, etc + */ + private String sourceId; + + /** + * Creates an instance of MetadataSource class. + */ + public MetadataSource() { + } + + /** + * Get the kind property: Source type of the content. + * + * @return the kind value. + */ + public SourceKind kind() { + return this.kind; + } + + /** + * Set the kind property: Source type of the content. + * + * @param kind the kind value to set. + * @return the MetadataSource object itself. + */ + public MetadataSource withKind(SourceKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the name property: Name of the content source. The repo name, solution name, LA workspace name etc. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the content source. The repo name, solution name, LA workspace name etc. + * + * @param name the name value to set. + * @return the MetadataSource object itself. + */ + public MetadataSource withName(String name) { + this.name = name; + return this; + } + + /** + * Get the sourceId property: ID of the content source. The solution ID, workspace ID, etc. + * + * @return the sourceId value. + */ + public String sourceId() { + return this.sourceId; + } + + /** + * Set the sourceId property: ID of the content source. The solution ID, workspace ID, etc. + * + * @param sourceId the sourceId value to set. + * @return the MetadataSource object itself. + */ + public MetadataSource withSourceId(String sourceId) { + this.sourceId = sourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (kind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property kind in model MetadataSource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetadataSource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("sourceId", this.sourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataSource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetadataSource. + */ + public static MetadataSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataSource deserializedMetadataSource = new MetadataSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedMetadataSource.kind = SourceKind.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedMetadataSource.name = reader.getString(); + } else if ("sourceId".equals(fieldName)) { + deserializedMetadataSource.sourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataSource; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataSupport.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataSupport.java new file mode 100644 index 000000000000..313484f6b6d5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MetadataSupport.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Support information for the content item. + */ +@Fluent +public final class MetadataSupport implements JsonSerializable { + /* + * Type of support for content item + */ + private SupportTier tier; + + /* + * Name of the support contact. Company or person. + */ + private String name; + + /* + * Email of support contact + */ + private String email; + + /* + * Link for support help, like to support page to open a ticket etc. + */ + private String link; + + /** + * Creates an instance of MetadataSupport class. + */ + public MetadataSupport() { + } + + /** + * Get the tier property: Type of support for content item. + * + * @return the tier value. + */ + public SupportTier tier() { + return this.tier; + } + + /** + * Set the tier property: Type of support for content item. + * + * @param tier the tier value to set. + * @return the MetadataSupport object itself. + */ + public MetadataSupport withTier(SupportTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the name property: Name of the support contact. Company or person. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the support contact. Company or person. + * + * @param name the name value to set. + * @return the MetadataSupport object itself. + */ + public MetadataSupport withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email property: Email of support contact. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: Email of support contact. + * + * @param email the email value to set. + * @return the MetadataSupport object itself. + */ + public MetadataSupport withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the link property: Link for support help, like to support page to open a ticket etc. + * + * @return the link value. + */ + public String link() { + return this.link; + } + + /** + * Set the link property: Link for support help, like to support page to open a ticket etc. + * + * @param link the link value to set. + * @return the MetadataSupport object itself. + */ + public MetadataSupport withLink(String link) { + this.link = link; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tier() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property tier in model MetadataSupport")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetadataSupport.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("email", this.email); + jsonWriter.writeStringField("link", this.link); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetadataSupport from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetadataSupport if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MetadataSupport. + */ + public static MetadataSupport fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetadataSupport deserializedMetadataSupport = new MetadataSupport(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tier".equals(fieldName)) { + deserializedMetadataSupport.tier = SupportTier.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedMetadataSupport.name = reader.getString(); + } else if ("email".equals(fieldName)) { + deserializedMetadataSupport.email = reader.getString(); + } else if ("link".equals(fieldName)) { + deserializedMetadataSupport.link = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetadataSupport; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Metadatas.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Metadatas.java new file mode 100644 index 000000000000..02864767ddff --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Metadatas.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Metadatas. + */ +public interface Metadatas { + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * List of all metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the metadata as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, String orderby, + Integer top, Integer skip, Context context); + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String metadataName, + Context context); + + /** + * Get a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata. + */ + MetadataModel get(String resourceGroupName, String workspaceName, String metadataName); + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String metadataName, + Context context); + + /** + * Delete a Metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param metadataName The Metadata name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String metadataName); + + /** + * Get a Metadata. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata along with {@link Response}. + */ + MetadataModel getById(String id); + + /** + * Get a Metadata. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Metadata along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Metadata. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Metadata. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MetadataModel resource. + * + * @param name resource name. + * @return the first stage of the new MetadataModel definition. + */ + MetadataModel.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionCheckRequirements.java new file mode 100644 index 000000000000..d47fcd112404 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionCheckRequirements.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.MicrosoftPurviewInformationProtectionCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents MicrosoftPurviewInformationProtection requirements check request. + */ +@Fluent +public final class MicrosoftPurviewInformationProtectionCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_PURVIEW_INFORMATION_PROTECTION; + + /* + * MicrosoftPurviewInformationProtection requirements check properties. + */ + private MicrosoftPurviewInformationProtectionCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of MicrosoftPurviewInformationProtectionCheckRequirements class. + */ + public MicrosoftPurviewInformationProtectionCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: MicrosoftPurviewInformationProtection requirements check properties. + * + * @return the innerProperties value. + */ + MicrosoftPurviewInformationProtectionCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the MicrosoftPurviewInformationProtectionCheckRequirements object itself. + */ + public MicrosoftPurviewInformationProtectionCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new MicrosoftPurviewInformationProtectionCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftPurviewInformationProtectionCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftPurviewInformationProtectionCheckRequirements if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MicrosoftPurviewInformationProtectionCheckRequirements. + */ + public static MicrosoftPurviewInformationProtectionCheckRequirements fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftPurviewInformationProtectionCheckRequirements deserializedMicrosoftPurviewInformationProtectionCheckRequirements + = new MicrosoftPurviewInformationProtectionCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionCheckRequirements.kind + = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionCheckRequirements.innerProperties + = MicrosoftPurviewInformationProtectionCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftPurviewInformationProtectionCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionConnectorDataTypes.java new file mode 100644 index 000000000000..2f5f60c7ef81 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionConnectorDataTypes.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Microsoft Purview Information Protection data connector. + */ +@Fluent +public final class MicrosoftPurviewInformationProtectionConnectorDataTypes + implements JsonSerializable { + /* + * Logs data type. + */ + private MicrosoftPurviewInformationProtectionConnectorDataTypesLogs logs; + + /** + * Creates an instance of MicrosoftPurviewInformationProtectionConnectorDataTypes class. + */ + public MicrosoftPurviewInformationProtectionConnectorDataTypes() { + } + + /** + * Get the logs property: Logs data type. + * + * @return the logs value. + */ + public MicrosoftPurviewInformationProtectionConnectorDataTypesLogs logs() { + return this.logs; + } + + /** + * Set the logs property: Logs data type. + * + * @param logs the logs value to set. + * @return the MicrosoftPurviewInformationProtectionConnectorDataTypes object itself. + */ + public MicrosoftPurviewInformationProtectionConnectorDataTypes + withLogs(MicrosoftPurviewInformationProtectionConnectorDataTypesLogs logs) { + this.logs = logs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logs() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logs in model MicrosoftPurviewInformationProtectionConnectorDataTypes")); + } else { + logs().validate(); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(MicrosoftPurviewInformationProtectionConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("logs", this.logs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftPurviewInformationProtectionConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftPurviewInformationProtectionConnectorDataTypes if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MicrosoftPurviewInformationProtectionConnectorDataTypes. + */ + public static MicrosoftPurviewInformationProtectionConnectorDataTypes fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftPurviewInformationProtectionConnectorDataTypes deserializedMicrosoftPurviewInformationProtectionConnectorDataTypes + = new MicrosoftPurviewInformationProtectionConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logs".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionConnectorDataTypes.logs + = MicrosoftPurviewInformationProtectionConnectorDataTypesLogs.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftPurviewInformationProtectionConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionConnectorDataTypesLogs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionConnectorDataTypesLogs.java new file mode 100644 index 000000000000..85183eebfe56 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionConnectorDataTypesLogs.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Logs data type. + */ +@Fluent +public final class MicrosoftPurviewInformationProtectionConnectorDataTypesLogs extends DataConnectorDataTypeCommon { + /** + * Creates an instance of MicrosoftPurviewInformationProtectionConnectorDataTypesLogs class. + */ + public MicrosoftPurviewInformationProtectionConnectorDataTypesLogs() { + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftPurviewInformationProtectionConnectorDataTypesLogs withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model MicrosoftPurviewInformationProtectionConnectorDataTypesLogs")); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(MicrosoftPurviewInformationProtectionConnectorDataTypesLogs.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftPurviewInformationProtectionConnectorDataTypesLogs from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftPurviewInformationProtectionConnectorDataTypesLogs if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the + * MicrosoftPurviewInformationProtectionConnectorDataTypesLogs. + */ + public static MicrosoftPurviewInformationProtectionConnectorDataTypesLogs fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftPurviewInformationProtectionConnectorDataTypesLogs deserializedMicrosoftPurviewInformationProtectionConnectorDataTypesLogs + = new MicrosoftPurviewInformationProtectionConnectorDataTypesLogs(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionConnectorDataTypesLogs + .withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftPurviewInformationProtectionConnectorDataTypesLogs; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionDataConnector.java new file mode 100644 index 000000000000..14dee7b79589 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftPurviewInformationProtectionDataConnector.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.MicrosoftPurviewInformationProtectionDataConnectorProperties; +import java.io.IOException; + +/** + * Represents Microsoft Purview Information Protection data connector. + */ +@Fluent +public final class MicrosoftPurviewInformationProtectionDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_PURVIEW_INFORMATION_PROTECTION; + + /* + * Microsoft Purview Information Protection data connector properties. + */ + private MicrosoftPurviewInformationProtectionDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MicrosoftPurviewInformationProtectionDataConnector class. + */ + public MicrosoftPurviewInformationProtectionDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Microsoft Purview Information Protection data connector properties. + * + * @return the innerProperties value. + */ + private MicrosoftPurviewInformationProtectionDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public MicrosoftPurviewInformationProtectionDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public MicrosoftPurviewInformationProtectionConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the MicrosoftPurviewInformationProtectionDataConnector object itself. + */ + public MicrosoftPurviewInformationProtectionDataConnector + withDataTypes(MicrosoftPurviewInformationProtectionConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new MicrosoftPurviewInformationProtectionDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the MicrosoftPurviewInformationProtectionDataConnector object itself. + */ + public MicrosoftPurviewInformationProtectionDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new MicrosoftPurviewInformationProtectionDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MicrosoftPurviewInformationProtectionDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MicrosoftPurviewInformationProtectionDataConnector if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MicrosoftPurviewInformationProtectionDataConnector. + */ + public static MicrosoftPurviewInformationProtectionDataConnector fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MicrosoftPurviewInformationProtectionDataConnector deserializedMicrosoftPurviewInformationProtectionDataConnector + = new MicrosoftPurviewInformationProtectionDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnector.systemData + = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnector.kind + = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMicrosoftPurviewInformationProtectionDataConnector.innerProperties + = MicrosoftPurviewInformationProtectionDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMicrosoftPurviewInformationProtectionDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRule.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRule.java index e2a360a4b2c3..2b94c3d75ae5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRule.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRule.java @@ -21,7 +21,7 @@ @Fluent public final class MicrosoftSecurityIncidentCreationAlertRule extends AlertRuleInner { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.MICROSOFT_SECURITY_INCIDENT_CREATION; @@ -57,7 +57,7 @@ public MicrosoftSecurityIncidentCreationAlertRule() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.java index 9667e3c42ee0..4b76b0d4e7f2 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.java @@ -21,7 +21,7 @@ @Fluent public final class MicrosoftSecurityIncidentCreationAlertRuleTemplate extends AlertRuleTemplateInner { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.MICROSOFT_SECURITY_INCIDENT_CREATION; @@ -57,7 +57,7 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ @@ -116,232 +116,232 @@ public String id() { } /** - * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * Get the displayNamesFilter property: the alerts' displayNames on which the cases will be generated. * - * @return the alertRulesCreatedByTemplateCount value. + * @return the displayNamesFilter value. */ - public Integer alertRulesCreatedByTemplateCount() { - return this.innerProperties() == null ? null : this.innerProperties().alertRulesCreatedByTemplateCount(); + public List displayNamesFilter() { + return this.innerProperties() == null ? null : this.innerProperties().displayNamesFilter(); } /** - * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * Set the displayNamesFilter property: the alerts' displayNames on which the cases will be generated. * - * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set. + * @param displayNamesFilter the displayNamesFilter value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplate - withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + public MicrosoftSecurityIncidentCreationAlertRuleTemplate withDisplayNamesFilter(List displayNamesFilter) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + this.innerProperties().withDisplayNamesFilter(displayNamesFilter); return this; } /** - * Get the createdDateUtc property: The time that this alert rule template has been added. + * Get the displayNamesExcludeFilter property: the alerts' displayNames on which the cases will not be generated. * - * @return the createdDateUtc value. + * @return the displayNamesExcludeFilter value. */ - public OffsetDateTime createdDateUtc() { - return this.innerProperties() == null ? null : this.innerProperties().createdDateUtc(); + public List displayNamesExcludeFilter() { + return this.innerProperties() == null ? null : this.innerProperties().displayNamesExcludeFilter(); } /** - * Get the lastUpdatedDateUtc property: The time that this alert rule template was last updated. + * Set the displayNamesExcludeFilter property: the alerts' displayNames on which the cases will not be generated. * - * @return the lastUpdatedDateUtc value. + * @param displayNamesExcludeFilter the displayNamesExcludeFilter value to set. + * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ - public OffsetDateTime lastUpdatedDateUtc() { - return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateUtc(); + public MicrosoftSecurityIncidentCreationAlertRuleTemplate + withDisplayNamesExcludeFilter(List displayNamesExcludeFilter) { + if (this.innerProperties() == null) { + this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); + } + this.innerProperties().withDisplayNamesExcludeFilter(displayNamesExcludeFilter); + return this; } /** - * Get the description property: The description of the alert rule template. + * Get the productFilter property: The alerts' productName on which the cases will be generated. * - * @return the description value. + * @return the productFilter value. */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); + public MicrosoftSecurityProductName productFilter() { + return this.innerProperties() == null ? null : this.innerProperties().productFilter(); } /** - * Set the description property: The description of the alert rule template. + * Set the productFilter property: The alerts' productName on which the cases will be generated. * - * @param description the description value to set. + * @param productFilter the productFilter value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplate withDescription(String description) { + public MicrosoftSecurityIncidentCreationAlertRuleTemplate + withProductFilter(MicrosoftSecurityProductName productFilter) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withDescription(description); + this.innerProperties().withProductFilter(productFilter); return this; } /** - * Get the displayName property: The display name for alert rule template. + * Get the severitiesFilter property: the alerts' severities on which the cases will be generated. * - * @return the displayName value. + * @return the severitiesFilter value. */ - public String displayName() { - return this.innerProperties() == null ? null : this.innerProperties().displayName(); + public List severitiesFilter() { + return this.innerProperties() == null ? null : this.innerProperties().severitiesFilter(); } /** - * Set the displayName property: The display name for alert rule template. + * Set the severitiesFilter property: the alerts' severities on which the cases will be generated. * - * @param displayName the displayName value to set. + * @param severitiesFilter the severitiesFilter value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplate withDisplayName(String displayName) { + public MicrosoftSecurityIncidentCreationAlertRuleTemplate + withSeveritiesFilter(List severitiesFilter) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withDisplayName(displayName); + this.innerProperties().withSeveritiesFilter(severitiesFilter); return this; } /** - * Get the requiredDataConnectors property: The required data connectors for this template. + * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. * - * @return the requiredDataConnectors value. + * @return the alertRulesCreatedByTemplateCount value. */ - public List requiredDataConnectors() { - return this.innerProperties() == null ? null : this.innerProperties().requiredDataConnectors(); + public Integer alertRulesCreatedByTemplateCount() { + return this.innerProperties() == null ? null : this.innerProperties().alertRulesCreatedByTemplateCount(); } /** - * Set the requiredDataConnectors property: The required data connectors for this template. + * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. * - * @param requiredDataConnectors the requiredDataConnectors value to set. + * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ public MicrosoftSecurityIncidentCreationAlertRuleTemplate - withRequiredDataConnectors(List requiredDataConnectors) { + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withRequiredDataConnectors(requiredDataConnectors); + this.innerProperties().withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); return this; } /** - * Get the status property: The alert rule template status. + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. * - * @return the status value. + * @return the lastUpdatedDateUtc value. */ - public TemplateStatus status() { - return this.innerProperties() == null ? null : this.innerProperties().status(); + public OffsetDateTime lastUpdatedDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateUtc(); } /** - * Set the status property: The alert rule template status. + * Get the createdDateUtc property: The time that this alert rule template has been added. * - * @param status the status value to set. - * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. + * @return the createdDateUtc value. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplate withStatus(TemplateStatus status) { - if (this.innerProperties() == null) { - this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); - } - this.innerProperties().withStatus(status); - return this; + public OffsetDateTime createdDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdDateUtc(); } /** - * Get the displayNamesFilter property: the alerts' displayNames on which the cases will be generated. + * Get the description property: The description of the alert rule template. * - * @return the displayNamesFilter value. + * @return the description value. */ - public List displayNamesFilter() { - return this.innerProperties() == null ? null : this.innerProperties().displayNamesFilter(); + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); } /** - * Set the displayNamesFilter property: the alerts' displayNames on which the cases will be generated. + * Set the description property: The description of the alert rule template. * - * @param displayNamesFilter the displayNamesFilter value to set. + * @param description the description value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplate withDisplayNamesFilter(List displayNamesFilter) { + public MicrosoftSecurityIncidentCreationAlertRuleTemplate withDescription(String description) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withDisplayNamesFilter(displayNamesFilter); + this.innerProperties().withDescription(description); return this; } /** - * Get the displayNamesExcludeFilter property: the alerts' displayNames on which the cases will not be generated. + * Get the displayName property: The display name for alert rule template. * - * @return the displayNamesExcludeFilter value. + * @return the displayName value. */ - public List displayNamesExcludeFilter() { - return this.innerProperties() == null ? null : this.innerProperties().displayNamesExcludeFilter(); + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); } /** - * Set the displayNamesExcludeFilter property: the alerts' displayNames on which the cases will not be generated. + * Set the displayName property: The display name for alert rule template. * - * @param displayNamesExcludeFilter the displayNamesExcludeFilter value to set. + * @param displayName the displayName value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplate - withDisplayNamesExcludeFilter(List displayNamesExcludeFilter) { + public MicrosoftSecurityIncidentCreationAlertRuleTemplate withDisplayName(String displayName) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withDisplayNamesExcludeFilter(displayNamesExcludeFilter); + this.innerProperties().withDisplayName(displayName); return this; } /** - * Get the productFilter property: The alerts' productName on which the cases will be generated. + * Get the requiredDataConnectors property: The required data sources for this template. * - * @return the productFilter value. + * @return the requiredDataConnectors value. */ - public MicrosoftSecurityProductName productFilter() { - return this.innerProperties() == null ? null : this.innerProperties().productFilter(); + public List requiredDataConnectors() { + return this.innerProperties() == null ? null : this.innerProperties().requiredDataConnectors(); } /** - * Set the productFilter property: The alerts' productName on which the cases will be generated. + * Set the requiredDataConnectors property: The required data sources for this template. * - * @param productFilter the productFilter value to set. + * @param requiredDataConnectors the requiredDataConnectors value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ public MicrosoftSecurityIncidentCreationAlertRuleTemplate - withProductFilter(MicrosoftSecurityProductName productFilter) { + withRequiredDataConnectors(List requiredDataConnectors) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withProductFilter(productFilter); + this.innerProperties().withRequiredDataConnectors(requiredDataConnectors); return this; } /** - * Get the severitiesFilter property: the alerts' severities on which the cases will be generated. + * Get the status property: The alert rule template status. * - * @return the severitiesFilter value. + * @return the status value. */ - public List severitiesFilter() { - return this.innerProperties() == null ? null : this.innerProperties().severitiesFilter(); + public TemplateStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); } /** - * Set the severitiesFilter property: the alerts' severities on which the cases will be generated. + * Set the status property: The alert rule template status. * - * @param severitiesFilter the severitiesFilter value to set. + * @param status the status value to set. * @return the MicrosoftSecurityIncidentCreationAlertRuleTemplate object itself. */ - public MicrosoftSecurityIncidentCreationAlertRuleTemplate - withSeveritiesFilter(List severitiesFilter) { + public MicrosoftSecurityIncidentCreationAlertRuleTemplate withStatus(TemplateStatus status) { if (this.innerProperties() == null) { this.innerProperties = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(); } - this.innerProperties().withSeveritiesFilter(severitiesFilter); + this.innerProperties().withStatus(status); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityProductName.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityProductName.java index 03eede753943..bc00b8b74ded 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityProductName.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MicrosoftSecurityProductName.java @@ -40,6 +40,18 @@ public final class MicrosoftSecurityProductName extends ExpandableStringEnum { + /** + * Static value Enabled for Mode. + */ + public static final Mode ENABLED = fromString("Enabled"); + + /** + * Static value Disabled for Mode. + */ + public static final Mode DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of Mode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Mode() { + } + + /** + * Creates or finds a Mode from its string representation. + * + * @param name a name to look for. + * @return the corresponding Mode. + */ + public static Mode fromString(String name) { + return fromString(name, Mode.class); + } + + /** + * Gets known Mode values. + * + * @return known Mode values. + */ + public static Collection values() { + return values(Mode.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiCheckRequirements.java new file mode 100644 index 000000000000..189a310828a7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiCheckRequirements.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.MstiCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents Microsoft Threat Intelligence requirements check request. + */ +@Fluent +public final class MstiCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_THREAT_INTELLIGENCE; + + /* + * Microsoft Threat Intelligence requirements check properties. + */ + private MstiCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of MstiCheckRequirements class. + */ + public MstiCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Microsoft Threat Intelligence requirements check properties. + * + * @return the innerProperties value. + */ + MstiCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the MstiCheckRequirements object itself. + */ + public MstiCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new MstiCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MstiCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MstiCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MstiCheckRequirements. + */ + public static MstiCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MstiCheckRequirements deserializedMstiCheckRequirements = new MstiCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedMstiCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMstiCheckRequirements.innerProperties + = MstiCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMstiCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnector.java new file mode 100644 index 000000000000..a219357b9c15 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnector.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.MstiDataConnectorProperties; +import java.io.IOException; + +/** + * Represents Microsoft Threat Intelligence data connector. + */ +@Fluent +public final class MstiDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_THREAT_INTELLIGENCE; + + /* + * Microsoft Threat Intelligence data connector properties. + */ + private MstiDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MstiDataConnector class. + */ + public MstiDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Microsoft Threat Intelligence data connector properties. + * + * @return the innerProperties value. + */ + private MstiDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public MstiDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public MstiDataConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the MstiDataConnector object itself. + */ + public MstiDataConnector withDataTypes(MstiDataConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new MstiDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the MstiDataConnector object itself. + */ + public MstiDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new MstiDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MstiDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MstiDataConnector if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MstiDataConnector. + */ + public static MstiDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MstiDataConnector deserializedMstiDataConnector = new MstiDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMstiDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMstiDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMstiDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedMstiDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedMstiDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedMstiDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMstiDataConnector.innerProperties = MstiDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMstiDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnectorDataTypes.java new file mode 100644 index 000000000000..1a23db7ed50b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnectorDataTypes.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Microsoft Threat Intelligence Platforms data connector. + */ +@Fluent +public final class MstiDataConnectorDataTypes implements JsonSerializable { + /* + * Data type for Microsoft Threat Intelligence Platforms data connector. + */ + private MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed microsoftEmergingThreatFeed; + + /** + * Creates an instance of MstiDataConnectorDataTypes class. + */ + public MstiDataConnectorDataTypes() { + } + + /** + * Get the microsoftEmergingThreatFeed property: Data type for Microsoft Threat Intelligence Platforms data + * connector. + * + * @return the microsoftEmergingThreatFeed value. + */ + public MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed microsoftEmergingThreatFeed() { + return this.microsoftEmergingThreatFeed; + } + + /** + * Set the microsoftEmergingThreatFeed property: Data type for Microsoft Threat Intelligence Platforms data + * connector. + * + * @param microsoftEmergingThreatFeed the microsoftEmergingThreatFeed value to set. + * @return the MstiDataConnectorDataTypes object itself. + */ + public MstiDataConnectorDataTypes withMicrosoftEmergingThreatFeed( + MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed microsoftEmergingThreatFeed) { + this.microsoftEmergingThreatFeed = microsoftEmergingThreatFeed; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (microsoftEmergingThreatFeed() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property microsoftEmergingThreatFeed in model MstiDataConnectorDataTypes")); + } else { + microsoftEmergingThreatFeed().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MstiDataConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("microsoftEmergingThreatFeed", this.microsoftEmergingThreatFeed); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MstiDataConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MstiDataConnectorDataTypes if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MstiDataConnectorDataTypes. + */ + public static MstiDataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MstiDataConnectorDataTypes deserializedMstiDataConnectorDataTypes = new MstiDataConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("microsoftEmergingThreatFeed".equals(fieldName)) { + deserializedMstiDataConnectorDataTypes.microsoftEmergingThreatFeed + = MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMstiDataConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed.java new file mode 100644 index 000000000000..e79a1de9153b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Data type for Microsoft Threat Intelligence Platforms data connector. + */ +@Fluent +public final class MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed extends DataConnectorDataTypeCommon { + /* + * The lookback period for the feed to be imported. + */ + private String lookbackPeriod; + + /** + * Creates an instance of MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed class. + */ + public MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed() { + } + + /** + * Get the lookbackPeriod property: The lookback period for the feed to be imported. + * + * @return the lookbackPeriod value. + */ + public String lookbackPeriod() { + return this.lookbackPeriod; + } + + /** + * Set the lookbackPeriod property: The lookback period for the feed to be imported. + * + * @param lookbackPeriod the lookbackPeriod value to set. + * @return the MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed object itself. + */ + public MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed withLookbackPeriod(String lookbackPeriod) { + this.lookbackPeriod = lookbackPeriod; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (lookbackPeriod() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property lookbackPeriod in model MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed")); + } + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed")); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + jsonWriter.writeStringField("lookbackPeriod", this.lookbackPeriod); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed. + */ + public static MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed deserializedMstiDataConnectorDataTypesMicrosoftEmergingThreatFeed + = new MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedMstiDataConnectorDataTypesMicrosoftEmergingThreatFeed + .withState(DataTypeState.fromString(reader.getString())); + } else if ("lookbackPeriod".equals(fieldName)) { + deserializedMstiDataConnectorDataTypesMicrosoftEmergingThreatFeed.lookbackPeriod + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMstiDataConnectorDataTypesMicrosoftEmergingThreatFeed; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpCheckRequirements.java new file mode 100644 index 000000000000..e7b477289f9b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpCheckRequirements.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.MtpCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents MTP (Microsoft Threat Protection) requirements check request. + */ +@Fluent +public final class MtpCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_THREAT_PROTECTION; + + /* + * MTP (Microsoft Threat Protection) requirements check properties. + */ + private MtpCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of MtpCheckRequirements class. + */ + public MtpCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: MTP (Microsoft Threat Protection) requirements check properties. + * + * @return the innerProperties value. + */ + MtpCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the MtpCheckRequirements object itself. + */ + public MtpCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new MtpCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpCheckRequirements if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MtpCheckRequirements. + */ + public static MtpCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpCheckRequirements deserializedMtpCheckRequirements = new MtpCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedMtpCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMtpCheckRequirements.innerProperties = MtpCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMtpCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnector.java new file mode 100644 index 000000000000..96cedffa0fd6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnector.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.MtpDataConnectorProperties; +import java.io.IOException; + +/** + * Represents MTP (Microsoft Threat Protection) data connector. + */ +@Fluent +public final class MtpDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.MICROSOFT_THREAT_PROTECTION; + + /* + * MTP (Microsoft Threat Protection) data connector properties. + */ + private MtpDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MtpDataConnector class. + */ + public MtpDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: MTP (Microsoft Threat Protection) data connector properties. + * + * @return the innerProperties value. + */ + private MtpDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public MtpDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public MtpDataConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the MtpDataConnector object itself. + */ + public MtpDataConnector withDataTypes(MtpDataConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new MtpDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the filteredProviders property: The available filtered providers for the connector. + * + * @return the filteredProviders value. + */ + public MtpFilteredProviders filteredProviders() { + return this.innerProperties() == null ? null : this.innerProperties().filteredProviders(); + } + + /** + * Set the filteredProviders property: The available filtered providers for the connector. + * + * @param filteredProviders the filteredProviders value to set. + * @return the MtpDataConnector object itself. + */ + public MtpDataConnector withFilteredProviders(MtpFilteredProviders filteredProviders) { + if (this.innerProperties() == null) { + this.innerProperties = new MtpDataConnectorProperties(); + } + this.innerProperties().withFilteredProviders(filteredProviders); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the MtpDataConnector object itself. + */ + public MtpDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new MtpDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpDataConnector if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MtpDataConnector. + */ + public static MtpDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpDataConnector deserializedMtpDataConnector = new MtpDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMtpDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMtpDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMtpDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedMtpDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedMtpDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedMtpDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedMtpDataConnector.innerProperties = MtpDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMtpDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypes.java new file mode 100644 index 000000000000..2d9639d0d313 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypes.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Microsoft Threat Protection Platforms data connector. + */ +@Fluent +public final class MtpDataConnectorDataTypes implements JsonSerializable { + /* + * Incidents data type for Microsoft Threat Protection Platforms data connector. + */ + private MtpDataConnectorDataTypesIncidents incidents; + + /* + * Alerts data type for Microsoft Threat Protection Platforms data connector. + */ + private MtpDataConnectorDataTypesAlerts alerts; + + /** + * Creates an instance of MtpDataConnectorDataTypes class. + */ + public MtpDataConnectorDataTypes() { + } + + /** + * Get the incidents property: Incidents data type for Microsoft Threat Protection Platforms data connector. + * + * @return the incidents value. + */ + public MtpDataConnectorDataTypesIncidents incidents() { + return this.incidents; + } + + /** + * Set the incidents property: Incidents data type for Microsoft Threat Protection Platforms data connector. + * + * @param incidents the incidents value to set. + * @return the MtpDataConnectorDataTypes object itself. + */ + public MtpDataConnectorDataTypes withIncidents(MtpDataConnectorDataTypesIncidents incidents) { + this.incidents = incidents; + return this; + } + + /** + * Get the alerts property: Alerts data type for Microsoft Threat Protection Platforms data connector. + * + * @return the alerts value. + */ + public MtpDataConnectorDataTypesAlerts alerts() { + return this.alerts; + } + + /** + * Set the alerts property: Alerts data type for Microsoft Threat Protection Platforms data connector. + * + * @param alerts the alerts value to set. + * @return the MtpDataConnectorDataTypes object itself. + */ + public MtpDataConnectorDataTypes withAlerts(MtpDataConnectorDataTypesAlerts alerts) { + this.alerts = alerts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (incidents() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property incidents in model MtpDataConnectorDataTypes")); + } else { + incidents().validate(); + } + if (alerts() != null) { + alerts().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MtpDataConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("incidents", this.incidents); + jsonWriter.writeJsonField("alerts", this.alerts); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpDataConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpDataConnectorDataTypes if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MtpDataConnectorDataTypes. + */ + public static MtpDataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpDataConnectorDataTypes deserializedMtpDataConnectorDataTypes = new MtpDataConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("incidents".equals(fieldName)) { + deserializedMtpDataConnectorDataTypes.incidents + = MtpDataConnectorDataTypesIncidents.fromJson(reader); + } else if ("alerts".equals(fieldName)) { + deserializedMtpDataConnectorDataTypes.alerts = MtpDataConnectorDataTypesAlerts.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMtpDataConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypesAlerts.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypesAlerts.java new file mode 100644 index 000000000000..9900db629876 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypesAlerts.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Alerts data type for Microsoft Threat Protection Platforms data connector. + */ +@Fluent +public final class MtpDataConnectorDataTypesAlerts extends DataConnectorDataTypeCommon { + /** + * Creates an instance of MtpDataConnectorDataTypesAlerts class. + */ + public MtpDataConnectorDataTypesAlerts() { + } + + /** + * {@inheritDoc} + */ + @Override + public MtpDataConnectorDataTypesAlerts withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model MtpDataConnectorDataTypesAlerts")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MtpDataConnectorDataTypesAlerts.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpDataConnectorDataTypesAlerts from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpDataConnectorDataTypesAlerts if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MtpDataConnectorDataTypesAlerts. + */ + public static MtpDataConnectorDataTypesAlerts fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpDataConnectorDataTypesAlerts deserializedMtpDataConnectorDataTypesAlerts + = new MtpDataConnectorDataTypesAlerts(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedMtpDataConnectorDataTypesAlerts.withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedMtpDataConnectorDataTypesAlerts; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypesIncidents.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypesIncidents.java new file mode 100644 index 000000000000..fcbe08b38783 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpDataConnectorDataTypesIncidents.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Incidents data type for Microsoft Threat Protection Platforms data connector. + */ +@Fluent +public final class MtpDataConnectorDataTypesIncidents extends DataConnectorDataTypeCommon { + /** + * Creates an instance of MtpDataConnectorDataTypesIncidents class. + */ + public MtpDataConnectorDataTypesIncidents() { + } + + /** + * {@inheritDoc} + */ + @Override + public MtpDataConnectorDataTypesIncidents withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model MtpDataConnectorDataTypesIncidents")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MtpDataConnectorDataTypesIncidents.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpDataConnectorDataTypesIncidents from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpDataConnectorDataTypesIncidents if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MtpDataConnectorDataTypesIncidents. + */ + public static MtpDataConnectorDataTypesIncidents fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpDataConnectorDataTypesIncidents deserializedMtpDataConnectorDataTypesIncidents + = new MtpDataConnectorDataTypesIncidents(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedMtpDataConnectorDataTypesIncidents + .withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedMtpDataConnectorDataTypesIncidents; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpFilteredProviders.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpFilteredProviders.java new file mode 100644 index 000000000000..c4417c4ffdbf --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpFilteredProviders.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents the connector's Filtered providers. + */ +@Fluent +public final class MtpFilteredProviders implements JsonSerializable { + /* + * Alerts filtered providers. When filters are not applied, all alerts will stream through the MTP pipeline, still + * in private preview for all products EXCEPT MDA and MDI, which are in GA state. + */ + private List alerts; + + /** + * Creates an instance of MtpFilteredProviders class. + */ + public MtpFilteredProviders() { + } + + /** + * Get the alerts property: Alerts filtered providers. When filters are not applied, all alerts will stream through + * the MTP pipeline, still in private preview for all products EXCEPT MDA and MDI, which are in GA state. + * + * @return the alerts value. + */ + public List alerts() { + return this.alerts; + } + + /** + * Set the alerts property: Alerts filtered providers. When filters are not applied, all alerts will stream through + * the MTP pipeline, still in private preview for all products EXCEPT MDA and MDI, which are in GA state. + * + * @param alerts the alerts value to set. + * @return the MtpFilteredProviders object itself. + */ + public MtpFilteredProviders withAlerts(List alerts) { + this.alerts = alerts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (alerts() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property alerts in model MtpFilteredProviders")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MtpFilteredProviders.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("alerts", this.alerts, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MtpFilteredProviders from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MtpFilteredProviders if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MtpFilteredProviders. + */ + public static MtpFilteredProviders fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MtpFilteredProviders deserializedMtpFilteredProviders = new MtpFilteredProviders(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alerts".equals(fieldName)) { + List alerts = reader.readArray(reader1 -> MtpProvider.fromString(reader1.getString())); + deserializedMtpFilteredProviders.alerts = alerts; + } else { + reader.skipChildren(); + } + } + + return deserializedMtpFilteredProviders; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpProvider.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpProvider.java new file mode 100644 index 000000000000..98d193c770c4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/MtpProvider.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The available data providers. + */ +public final class MtpProvider extends ExpandableStringEnum { + /** + * Static value microsoftDefenderForCloudApps for MtpProvider. + */ + public static final MtpProvider MICROSOFT_DEFENDER_FOR_CLOUD_APPS = fromString("microsoftDefenderForCloudApps"); + + /** + * Static value microsoftDefenderForIdentity for MtpProvider. + */ + public static final MtpProvider MICROSOFT_DEFENDER_FOR_IDENTITY = fromString("microsoftDefenderForIdentity"); + + /** + * Creates a new instance of MtpProvider value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MtpProvider() { + } + + /** + * Creates or finds a MtpProvider from its string representation. + * + * @param name a name to look for. + * @return the corresponding MtpProvider. + */ + public static MtpProvider fromString(String name) { + return fromString(name, MtpProvider.class); + } + + /** + * Gets known MtpProvider values. + * + * @return known MtpProvider values. + */ + public static Collection values() { + return values(MtpProvider.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NicEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NicEntity.java new file mode 100644 index 000000000000..b28eff8bfcea --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NicEntity.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; +import com.azure.resourcemanager.securityinsights.fluent.models.NicEntityProperties; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Represents an network interface entity. + */ +@Immutable +public final class NicEntity extends EntityInner { + /* + * The kind of the entity. + */ + private EntityKindEnum kind = EntityKindEnum.NIC; + + /* + * Network interface entity properties + */ + private NicEntityProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NicEntity class. + */ + public NicEntity() { + } + + /** + * Get the kind property: The kind of the entity. + * + * @return the kind value. + */ + @Override + public EntityKindEnum kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Network interface entity properties. + * + * @return the innerProperties value. + */ + private NicEntityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the macAddress property: The MAC address of this network interface. + * + * @return the macAddress value. + */ + public String macAddress() { + return this.innerProperties() == null ? null : this.innerProperties().macAddress(); + } + + /** + * Get the ipAddressEntityId property: The IP entity id of this network interface. + * + * @return the ipAddressEntityId value. + */ + public String ipAddressEntityId() { + return this.innerProperties() == null ? null : this.innerProperties().ipAddressEntityId(); + } + + /** + * Get the vlans property: A list of VLANs of the network interface entity. + * + * @return the vlans value. + */ + public List vlans() { + return this.innerProperties() == null ? null : this.innerProperties().vlans(); + } + + /** + * Get the additionalData property: A bag of custom fields that should be part of the entity and will be presented + * to the user. + * + * @return the additionalData value. + */ + public Map additionalData() { + return this.innerProperties() == null ? null : this.innerProperties().additionalData(); + } + + /** + * Get the friendlyName property: The graph item display name which is a short humanly readable description of the + * graph item instance. This property is optional and might be system generated. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().friendlyName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NicEntity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NicEntity if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NicEntity. + */ + public static NicEntity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NicEntity deserializedNicEntity = new NicEntity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNicEntity.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNicEntity.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNicEntity.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedNicEntity.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedNicEntity.kind = EntityKindEnum.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedNicEntity.innerProperties = NicEntityProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNicEntity; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NoneAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NoneAuthModel.java new file mode 100644 index 000000000000..b4e9e3daf3bf --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NoneAuthModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for API authentication with no authentication method - public API. + */ +@Immutable +public final class NoneAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.NONE; + + /** + * Creates an instance of NoneAuthModel class. + */ + public NoneAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NoneAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NoneAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the NoneAuthModel. + */ + public static NoneAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NoneAuthModel deserializedNoneAuthModel = new NoneAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedNoneAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNoneAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NrtAlertRule.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NrtAlertRule.java new file mode 100644 index 000000000000..d46d0f5766eb --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NrtAlertRule.java @@ -0,0 +1,622 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleInner; +import com.azure.resourcemanager.securityinsights.fluent.models.NrtAlertRuleProperties; +import java.io.IOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Represents NRT alert rule. + */ +@Fluent +public final class NrtAlertRule extends AlertRuleInner { + /* + * The kind of the alert rule + */ + private AlertRuleKind kind = AlertRuleKind.NRT; + + /* + * NRT alert rule properties + */ + private NrtAlertRuleProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NrtAlertRule class. + */ + public NrtAlertRule() { + } + + /** + * Get the kind property: The kind of the alert rule. + * + * @return the kind value. + */ + @Override + public AlertRuleKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: NRT alert rule properties. + * + * @return the innerProperties value. + */ + private NrtAlertRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public NrtAlertRule withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @return the alertRuleTemplateName value. + */ + public String alertRuleTemplateName() { + return this.innerProperties() == null ? null : this.innerProperties().alertRuleTemplateName(); + } + + /** + * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @param alertRuleTemplateName the alertRuleTemplateName value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withAlertRuleTemplateName(String alertRuleTemplateName) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withAlertRuleTemplateName(alertRuleTemplateName); + return this; + } + + /** + * Get the templateVersion property: The version of the alert rule template used to create this rule - in format + * <a.b.c>, where all are numbers, for example 0 <1.0.2>. + * + * @return the templateVersion value. + */ + public String templateVersion() { + return this.innerProperties() == null ? null : this.innerProperties().templateVersion(); + } + + /** + * Set the templateVersion property: The version of the alert rule template used to create this rule - in format + * <a.b.c>, where all are numbers, for example 0 <1.0.2>. + * + * @param templateVersion the templateVersion value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withTemplateVersion(String templateVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withTemplateVersion(templateVersion); + return this; + } + + /** + * Get the description property: The description of the alert rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the alert rule. + * + * @param description the description value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the query property: The query that creates alerts for this rule. + * + * @return the query value. + */ + public String query() { + return this.innerProperties() == null ? null : this.innerProperties().query(); + } + + /** + * Set the query property: The query that creates alerts for this rule. + * + * @param query the query value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withQuery(String query) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withQuery(query); + return this; + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.innerProperties() == null ? null : this.innerProperties().tactics(); + } + + /** + * Set the tactics property: The tactics of the alert rule. + * + * @param tactics the tactics value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withTactics(List tactics) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withTactics(tactics); + return this; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.innerProperties() == null ? null : this.innerProperties().techniques(); + } + + /** + * Set the techniques property: The techniques of the alert rule. + * + * @param techniques the techniques value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withTechniques(List techniques) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withTechniques(techniques); + return this; + } + + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().subTechniques(); + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withSubTechniques(List subTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withSubTechniques(subTechniques); + return this; + } + + /** + * Get the displayName property: The display name for alerts created by this alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name for alerts created by this alert rule. + * + * @param displayName the displayName value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the lastModifiedUtc property: The last time that this alert rule has been modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc(); + } + + /** + * Get the suppressionDuration property: The suppression (in ISO 8601 duration format) to wait since last time this + * alert rule been triggered. + * + * @return the suppressionDuration value. + */ + public Duration suppressionDuration() { + return this.innerProperties() == null ? null : this.innerProperties().suppressionDuration(); + } + + /** + * Set the suppressionDuration property: The suppression (in ISO 8601 duration format) to wait since last time this + * alert rule been triggered. + * + * @param suppressionDuration the suppressionDuration value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withSuppressionDuration(Duration suppressionDuration) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withSuppressionDuration(suppressionDuration); + return this; + } + + /** + * Get the suppressionEnabled property: Determines whether the suppression for this alert rule is enabled or + * disabled. + * + * @return the suppressionEnabled value. + */ + public Boolean suppressionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().suppressionEnabled(); + } + + /** + * Set the suppressionEnabled property: Determines whether the suppression for this alert rule is enabled or + * disabled. + * + * @param suppressionEnabled the suppressionEnabled value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withSuppressionEnabled(Boolean suppressionEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withSuppressionEnabled(suppressionEnabled); + return this; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withSeverity(AlertSeverity severity) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this + * analytics rule. + * + * @return the incidentConfiguration value. + */ + public IncidentConfiguration incidentConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().incidentConfiguration(); + } + + /** + * Set the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this + * analytics rule. + * + * @param incidentConfiguration the incidentConfiguration value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withIncidentConfiguration(IncidentConfiguration incidentConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withIncidentConfiguration(incidentConfiguration); + return this; + } + + /** + * Get the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @return the customDetails value. + */ + public Map customDetails() { + return this.innerProperties() == null ? null : this.innerProperties().customDetails(); + } + + /** + * Set the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @param customDetails the customDetails value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withCustomDetails(Map customDetails) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withCustomDetails(customDetails); + return this; + } + + /** + * Get the entityMappings property: Array of the entity mappings of the alert rule. + * + * @return the entityMappings value. + */ + public List entityMappings() { + return this.innerProperties() == null ? null : this.innerProperties().entityMappings(); + } + + /** + * Set the entityMappings property: Array of the entity mappings of the alert rule. + * + * @param entityMappings the entityMappings value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withEntityMappings(List entityMappings) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withEntityMappings(entityMappings); + return this; + } + + /** + * Get the alertDetailsOverride property: The alert details override settings. + * + * @return the alertDetailsOverride value. + */ + public AlertDetailsOverride alertDetailsOverride() { + return this.innerProperties() == null ? null : this.innerProperties().alertDetailsOverride(); + } + + /** + * Set the alertDetailsOverride property: The alert details override settings. + * + * @param alertDetailsOverride the alertDetailsOverride value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withAlertDetailsOverride(AlertDetailsOverride alertDetailsOverride) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withAlertDetailsOverride(alertDetailsOverride); + return this; + } + + /** + * Get the eventGroupingSettings property: The event grouping settings. + * + * @return the eventGroupingSettings value. + */ + public EventGroupingSettings eventGroupingSettings() { + return this.innerProperties() == null ? null : this.innerProperties().eventGroupingSettings(); + } + + /** + * Set the eventGroupingSettings property: The event grouping settings. + * + * @param eventGroupingSettings the eventGroupingSettings value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withEventGroupingSettings(EventGroupingSettings eventGroupingSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withEventGroupingSettings(eventGroupingSettings); + return this; + } + + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.innerProperties() == null ? null : this.innerProperties().sentinelEntitiesMappings(); + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the NrtAlertRule object itself. + */ + public NrtAlertRule withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleProperties(); + } + this.innerProperties().withSentinelEntitiesMappings(sentinelEntitiesMappings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NrtAlertRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NrtAlertRule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NrtAlertRule. + */ + public static NrtAlertRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NrtAlertRule deserializedNrtAlertRule = new NrtAlertRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNrtAlertRule.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNrtAlertRule.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNrtAlertRule.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedNrtAlertRule.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedNrtAlertRule.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedNrtAlertRule.kind = AlertRuleKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedNrtAlertRule.innerProperties = NrtAlertRuleProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNrtAlertRule; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NrtAlertRuleTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NrtAlertRuleTemplate.java new file mode 100644 index 000000000000..7e83ab427f7a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/NrtAlertRuleTemplate.java @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleTemplateInner; +import com.azure.resourcemanager.securityinsights.fluent.models.NrtAlertRuleTemplateProperties; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * Represents NRT alert rule template. + */ +@Fluent +public final class NrtAlertRuleTemplate extends AlertRuleTemplateInner { + /* + * The kind of the alert rule + */ + private AlertRuleKind kind = AlertRuleKind.NRT; + + /* + * NRT alert rule template properties + */ + private NrtAlertRuleTemplateProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NrtAlertRuleTemplate class. + */ + public NrtAlertRuleTemplate() { + } + + /** + * Get the kind property: The kind of the alert rule. + * + * @return the kind value. + */ + @Override + public AlertRuleKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: NRT alert rule template properties. + * + * @return the innerProperties value. + */ + private NrtAlertRuleTemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the query property: The query that creates alerts for this rule. + * + * @return the query value. + */ + public String query() { + return this.innerProperties() == null ? null : this.innerProperties().query(); + } + + /** + * Set the query property: The query that creates alerts for this rule. + * + * @param query the query value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withQuery(String query) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withQuery(query); + return this; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withSeverity(AlertSeverity severity) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the version property: The version of this template - in format <a.b.c>, where all are numbers. For + * example <1.0.2>. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: The version of this template - in format <a.b.c>, where all are numbers. For + * example <1.0.2>. + * + * @param version the version value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @return the customDetails value. + */ + public Map customDetails() { + return this.innerProperties() == null ? null : this.innerProperties().customDetails(); + } + + /** + * Set the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @param customDetails the customDetails value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withCustomDetails(Map customDetails) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withCustomDetails(customDetails); + return this; + } + + /** + * Get the entityMappings property: Array of the entity mappings of the alert rule. + * + * @return the entityMappings value. + */ + public List entityMappings() { + return this.innerProperties() == null ? null : this.innerProperties().entityMappings(); + } + + /** + * Set the entityMappings property: Array of the entity mappings of the alert rule. + * + * @param entityMappings the entityMappings value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withEntityMappings(List entityMappings) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withEntityMappings(entityMappings); + return this; + } + + /** + * Get the alertDetailsOverride property: The alert details override settings. + * + * @return the alertDetailsOverride value. + */ + public AlertDetailsOverride alertDetailsOverride() { + return this.innerProperties() == null ? null : this.innerProperties().alertDetailsOverride(); + } + + /** + * Set the alertDetailsOverride property: The alert details override settings. + * + * @param alertDetailsOverride the alertDetailsOverride value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withAlertDetailsOverride(AlertDetailsOverride alertDetailsOverride) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withAlertDetailsOverride(alertDetailsOverride); + return this; + } + + /** + * Get the eventGroupingSettings property: The event grouping settings. + * + * @return the eventGroupingSettings value. + */ + public EventGroupingSettings eventGroupingSettings() { + return this.innerProperties() == null ? null : this.innerProperties().eventGroupingSettings(); + } + + /** + * Set the eventGroupingSettings property: The event grouping settings. + * + * @param eventGroupingSettings the eventGroupingSettings value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withEventGroupingSettings(EventGroupingSettings eventGroupingSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withEventGroupingSettings(eventGroupingSettings); + return this; + } + + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.innerProperties() == null ? null : this.innerProperties().sentinelEntitiesMappings(); + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withSentinelEntitiesMappings(sentinelEntitiesMappings); + return this; + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.innerProperties() == null ? null : this.innerProperties().tactics(); + } + + /** + * Set the tactics property: The tactics of the alert rule. + * + * @param tactics the tactics value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withTactics(List tactics) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withTactics(tactics); + return this; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.innerProperties() == null ? null : this.innerProperties().techniques(); + } + + /** + * Set the techniques property: The techniques of the alert rule. + * + * @param techniques the techniques value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withTechniques(List techniques) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withTechniques(techniques); + return this; + } + + /** + * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @return the alertRulesCreatedByTemplateCount value. + */ + public Integer alertRulesCreatedByTemplateCount() { + return this.innerProperties() == null ? null : this.innerProperties().alertRulesCreatedByTemplateCount(); + } + + /** + * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + public OffsetDateTime lastUpdatedDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateUtc(); + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + public OffsetDateTime createdDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdDateUtc(); + } + + /** + * Get the description property: The description of the alert rule template. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the alert rule template. + * + * @param description the description value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the displayName property: The display name for alert rule template. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name for alert rule template. + * + * @param displayName the displayName value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the requiredDataConnectors property: The required data sources for this template. + * + * @return the requiredDataConnectors value. + */ + public List requiredDataConnectors() { + return this.innerProperties() == null ? null : this.innerProperties().requiredDataConnectors(); + } + + /** + * Set the requiredDataConnectors property: The required data sources for this template. + * + * @param requiredDataConnectors the requiredDataConnectors value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withRequiredDataConnectors(List requiredDataConnectors) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * Get the status property: The alert rule template status. + * + * @return the status value. + */ + public TemplateStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The alert rule template status. + * + * @param status the status value to set. + * @return the NrtAlertRuleTemplate object itself. + */ + public NrtAlertRuleTemplate withStatus(TemplateStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new NrtAlertRuleTemplateProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NrtAlertRuleTemplate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NrtAlertRuleTemplate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NrtAlertRuleTemplate. + */ + public static NrtAlertRuleTemplate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NrtAlertRuleTemplate deserializedNrtAlertRuleTemplate = new NrtAlertRuleTemplate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNrtAlertRuleTemplate.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNrtAlertRuleTemplate.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNrtAlertRuleTemplate.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedNrtAlertRuleTemplate.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedNrtAlertRuleTemplate.kind = AlertRuleKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedNrtAlertRuleTemplate.innerProperties = NrtAlertRuleTemplateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNrtAlertRuleTemplate; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OAuthModel.java new file mode 100644 index 000000000000..2f11a3f3f2ab --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OAuthModel.java @@ -0,0 +1,536 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Model for API authentication with OAuth2. + */ +@Fluent +public final class OAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.OAUTH2; + + /* + * The user's authorization code. + */ + private String authorizationCode; + + /* + * The Application (client) secret that the OAuth provider assigned to your app. + */ + private String clientSecret; + + /* + * The Application (client) ID that the OAuth provider assigned to your app. + */ + private String clientId; + + /* + * Indicating whether we want to send the clientId and clientSecret to token endpoint in the headers. + */ + private Boolean isCredentialsInHeaders; + + /* + * The Application (client) Scope that the OAuth provider assigned to your app. + */ + private String scope; + + /* + * The Application redirect url that the user config in the OAuth provider. + */ + private String redirectUri; + + /* + * The grant type, usually will be 'authorization code'. + */ + private String grantType; + + /* + * The token endpoint. Defines the OAuth2 refresh token. + */ + private String tokenEndpoint; + + /* + * The token endpoint headers. + */ + private Map tokenEndpointHeaders; + + /* + * The token endpoint query parameters. + */ + private Map tokenEndpointQueryParameters; + + /* + * The authorization endpoint. + */ + private String authorizationEndpoint; + + /* + * The authorization endpoint headers. + */ + private Map authorizationEndpointHeaders; + + /* + * The authorization endpoint query parameters. + */ + private Map authorizationEndpointQueryParameters; + + /* + * A value indicating whether it's a JWT flow. + */ + private Boolean isJwtBearerFlow; + + /* + * Access token prepend. Default is 'Bearer'. + */ + private String accessTokenPrepend; + + /** + * Creates an instance of OAuthModel class. + */ + public OAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the authorizationCode property: The user's authorization code. + * + * @return the authorizationCode value. + */ + public String authorizationCode() { + return this.authorizationCode; + } + + /** + * Set the authorizationCode property: The user's authorization code. + * + * @param authorizationCode the authorizationCode value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withAuthorizationCode(String authorizationCode) { + this.authorizationCode = authorizationCode; + return this; + } + + /** + * Get the clientSecret property: The Application (client) secret that the OAuth provider assigned to your app. + * + * @return the clientSecret value. + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set the clientSecret property: The Application (client) secret that the OAuth provider assigned to your app. + * + * @param clientSecret the clientSecret value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get the clientId property: The Application (client) ID that the OAuth provider assigned to your app. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: The Application (client) ID that the OAuth provider assigned to your app. + * + * @param clientId the clientId value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the isCredentialsInHeaders property: Indicating whether we want to send the clientId and clientSecret to + * token endpoint in the headers. + * + * @return the isCredentialsInHeaders value. + */ + public Boolean isCredentialsInHeaders() { + return this.isCredentialsInHeaders; + } + + /** + * Set the isCredentialsInHeaders property: Indicating whether we want to send the clientId and clientSecret to + * token endpoint in the headers. + * + * @param isCredentialsInHeaders the isCredentialsInHeaders value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withIsCredentialsInHeaders(Boolean isCredentialsInHeaders) { + this.isCredentialsInHeaders = isCredentialsInHeaders; + return this; + } + + /** + * Get the scope property: The Application (client) Scope that the OAuth provider assigned to your app. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The Application (client) Scope that the OAuth provider assigned to your app. + * + * @param scope the scope value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the redirectUri property: The Application redirect url that the user config in the OAuth provider. + * + * @return the redirectUri value. + */ + public String redirectUri() { + return this.redirectUri; + } + + /** + * Set the redirectUri property: The Application redirect url that the user config in the OAuth provider. + * + * @param redirectUri the redirectUri value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withRedirectUri(String redirectUri) { + this.redirectUri = redirectUri; + return this; + } + + /** + * Get the grantType property: The grant type, usually will be 'authorization code'. + * + * @return the grantType value. + */ + public String grantType() { + return this.grantType; + } + + /** + * Set the grantType property: The grant type, usually will be 'authorization code'. + * + * @param grantType the grantType value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withGrantType(String grantType) { + this.grantType = grantType; + return this; + } + + /** + * Get the tokenEndpoint property: The token endpoint. Defines the OAuth2 refresh token. + * + * @return the tokenEndpoint value. + */ + public String tokenEndpoint() { + return this.tokenEndpoint; + } + + /** + * Set the tokenEndpoint property: The token endpoint. Defines the OAuth2 refresh token. + * + * @param tokenEndpoint the tokenEndpoint value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withTokenEndpoint(String tokenEndpoint) { + this.tokenEndpoint = tokenEndpoint; + return this; + } + + /** + * Get the tokenEndpointHeaders property: The token endpoint headers. + * + * @return the tokenEndpointHeaders value. + */ + public Map tokenEndpointHeaders() { + return this.tokenEndpointHeaders; + } + + /** + * Set the tokenEndpointHeaders property: The token endpoint headers. + * + * @param tokenEndpointHeaders the tokenEndpointHeaders value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withTokenEndpointHeaders(Map tokenEndpointHeaders) { + this.tokenEndpointHeaders = tokenEndpointHeaders; + return this; + } + + /** + * Get the tokenEndpointQueryParameters property: The token endpoint query parameters. + * + * @return the tokenEndpointQueryParameters value. + */ + public Map tokenEndpointQueryParameters() { + return this.tokenEndpointQueryParameters; + } + + /** + * Set the tokenEndpointQueryParameters property: The token endpoint query parameters. + * + * @param tokenEndpointQueryParameters the tokenEndpointQueryParameters value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withTokenEndpointQueryParameters(Map tokenEndpointQueryParameters) { + this.tokenEndpointQueryParameters = tokenEndpointQueryParameters; + return this; + } + + /** + * Get the authorizationEndpoint property: The authorization endpoint. + * + * @return the authorizationEndpoint value. + */ + public String authorizationEndpoint() { + return this.authorizationEndpoint; + } + + /** + * Set the authorizationEndpoint property: The authorization endpoint. + * + * @param authorizationEndpoint the authorizationEndpoint value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withAuthorizationEndpoint(String authorizationEndpoint) { + this.authorizationEndpoint = authorizationEndpoint; + return this; + } + + /** + * Get the authorizationEndpointHeaders property: The authorization endpoint headers. + * + * @return the authorizationEndpointHeaders value. + */ + public Map authorizationEndpointHeaders() { + return this.authorizationEndpointHeaders; + } + + /** + * Set the authorizationEndpointHeaders property: The authorization endpoint headers. + * + * @param authorizationEndpointHeaders the authorizationEndpointHeaders value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withAuthorizationEndpointHeaders(Map authorizationEndpointHeaders) { + this.authorizationEndpointHeaders = authorizationEndpointHeaders; + return this; + } + + /** + * Get the authorizationEndpointQueryParameters property: The authorization endpoint query parameters. + * + * @return the authorizationEndpointQueryParameters value. + */ + public Map authorizationEndpointQueryParameters() { + return this.authorizationEndpointQueryParameters; + } + + /** + * Set the authorizationEndpointQueryParameters property: The authorization endpoint query parameters. + * + * @param authorizationEndpointQueryParameters the authorizationEndpointQueryParameters value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel + withAuthorizationEndpointQueryParameters(Map authorizationEndpointQueryParameters) { + this.authorizationEndpointQueryParameters = authorizationEndpointQueryParameters; + return this; + } + + /** + * Get the isJwtBearerFlow property: A value indicating whether it's a JWT flow. + * + * @return the isJwtBearerFlow value. + */ + public Boolean isJwtBearerFlow() { + return this.isJwtBearerFlow; + } + + /** + * Set the isJwtBearerFlow property: A value indicating whether it's a JWT flow. + * + * @param isJwtBearerFlow the isJwtBearerFlow value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withIsJwtBearerFlow(Boolean isJwtBearerFlow) { + this.isJwtBearerFlow = isJwtBearerFlow; + return this; + } + + /** + * Get the accessTokenPrepend property: Access token prepend. Default is 'Bearer'. + * + * @return the accessTokenPrepend value. + */ + public String accessTokenPrepend() { + return this.accessTokenPrepend; + } + + /** + * Set the accessTokenPrepend property: Access token prepend. Default is 'Bearer'. + * + * @param accessTokenPrepend the accessTokenPrepend value to set. + * @return the OAuthModel object itself. + */ + public OAuthModel withAccessTokenPrepend(String accessTokenPrepend) { + this.accessTokenPrepend = accessTokenPrepend; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (clientSecret() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property clientSecret in model OAuthModel")); + } + if (clientId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property clientId in model OAuthModel")); + } + if (grantType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property grantType in model OAuthModel")); + } + if (tokenEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property tokenEndpoint in model OAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("clientSecret", this.clientSecret); + jsonWriter.writeStringField("clientId", this.clientId); + jsonWriter.writeStringField("grantType", this.grantType); + jsonWriter.writeStringField("tokenEndpoint", this.tokenEndpoint); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("authorizationCode", this.authorizationCode); + jsonWriter.writeBooleanField("isCredentialsInHeaders", this.isCredentialsInHeaders); + jsonWriter.writeStringField("scope", this.scope); + jsonWriter.writeStringField("redirectUri", this.redirectUri); + jsonWriter.writeMapField("tokenEndpointHeaders", this.tokenEndpointHeaders, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("tokenEndpointQueryParameters", this.tokenEndpointQueryParameters, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("authorizationEndpoint", this.authorizationEndpoint); + jsonWriter.writeMapField("authorizationEndpointHeaders", this.authorizationEndpointHeaders, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("authorizationEndpointQueryParameters", this.authorizationEndpointQueryParameters, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isJwtBearerFlow", this.isJwtBearerFlow); + jsonWriter.writeStringField("accessTokenPrepend", this.accessTokenPrepend); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OAuthModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OAuthModel. + */ + public static OAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OAuthModel deserializedOAuthModel = new OAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientSecret".equals(fieldName)) { + deserializedOAuthModel.clientSecret = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedOAuthModel.clientId = reader.getString(); + } else if ("grantType".equals(fieldName)) { + deserializedOAuthModel.grantType = reader.getString(); + } else if ("tokenEndpoint".equals(fieldName)) { + deserializedOAuthModel.tokenEndpoint = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else if ("authorizationCode".equals(fieldName)) { + deserializedOAuthModel.authorizationCode = reader.getString(); + } else if ("isCredentialsInHeaders".equals(fieldName)) { + deserializedOAuthModel.isCredentialsInHeaders = reader.getNullable(JsonReader::getBoolean); + } else if ("scope".equals(fieldName)) { + deserializedOAuthModel.scope = reader.getString(); + } else if ("redirectUri".equals(fieldName)) { + deserializedOAuthModel.redirectUri = reader.getString(); + } else if ("tokenEndpointHeaders".equals(fieldName)) { + Map tokenEndpointHeaders = reader.readMap(reader1 -> reader1.getString()); + deserializedOAuthModel.tokenEndpointHeaders = tokenEndpointHeaders; + } else if ("tokenEndpointQueryParameters".equals(fieldName)) { + Map tokenEndpointQueryParameters = reader.readMap(reader1 -> reader1.getString()); + deserializedOAuthModel.tokenEndpointQueryParameters = tokenEndpointQueryParameters; + } else if ("authorizationEndpoint".equals(fieldName)) { + deserializedOAuthModel.authorizationEndpoint = reader.getString(); + } else if ("authorizationEndpointHeaders".equals(fieldName)) { + Map authorizationEndpointHeaders = reader.readMap(reader1 -> reader1.getString()); + deserializedOAuthModel.authorizationEndpointHeaders = authorizationEndpointHeaders; + } else if ("authorizationEndpointQueryParameters".equals(fieldName)) { + Map authorizationEndpointQueryParameters + = reader.readMap(reader1 -> reader1.getString()); + deserializedOAuthModel.authorizationEndpointQueryParameters = authorizationEndpointQueryParameters; + } else if ("isJwtBearerFlow".equals(fieldName)) { + deserializedOAuthModel.isJwtBearerFlow = reader.getNullable(JsonReader::getBoolean); + } else if ("accessTokenPrepend".equals(fieldName)) { + deserializedOAuthModel.accessTokenPrepend = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectCheckRequirements.java new file mode 100644 index 000000000000..bef6e654a998 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectCheckRequirements.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.Office365ProjectCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents Office365 Project requirements check request. + */ +@Fluent +public final class Office365ProjectCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE365PROJECT; + + /* + * Office365 Project requirements check properties. + */ + private Office365ProjectCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of Office365ProjectCheckRequirements class. + */ + public Office365ProjectCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Office365 Project requirements check properties. + * + * @return the innerProperties value. + */ + Office365ProjectCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the Office365ProjectCheckRequirements object itself. + */ + public Office365ProjectCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new Office365ProjectCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Office365ProjectCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Office365ProjectCheckRequirements if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the Office365ProjectCheckRequirements. + */ + public static Office365ProjectCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Office365ProjectCheckRequirements deserializedOffice365ProjectCheckRequirements + = new Office365ProjectCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedOffice365ProjectCheckRequirements.kind + = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOffice365ProjectCheckRequirements.innerProperties + = Office365ProjectCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOffice365ProjectCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectConnectorDataTypes.java new file mode 100644 index 000000000000..909cf98781e4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectConnectorDataTypes.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Office Microsoft Project data connector. + */ +@Fluent +public final class Office365ProjectConnectorDataTypes implements JsonSerializable { + /* + * Logs data type. + */ + private Office365ProjectConnectorDataTypesLogs logs; + + /** + * Creates an instance of Office365ProjectConnectorDataTypes class. + */ + public Office365ProjectConnectorDataTypes() { + } + + /** + * Get the logs property: Logs data type. + * + * @return the logs value. + */ + public Office365ProjectConnectorDataTypesLogs logs() { + return this.logs; + } + + /** + * Set the logs property: Logs data type. + * + * @param logs the logs value to set. + * @return the Office365ProjectConnectorDataTypes object itself. + */ + public Office365ProjectConnectorDataTypes withLogs(Office365ProjectConnectorDataTypesLogs logs) { + this.logs = logs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logs() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logs in model Office365ProjectConnectorDataTypes")); + } else { + logs().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Office365ProjectConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("logs", this.logs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Office365ProjectConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Office365ProjectConnectorDataTypes if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Office365ProjectConnectorDataTypes. + */ + public static Office365ProjectConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Office365ProjectConnectorDataTypes deserializedOffice365ProjectConnectorDataTypes + = new Office365ProjectConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logs".equals(fieldName)) { + deserializedOffice365ProjectConnectorDataTypes.logs + = Office365ProjectConnectorDataTypesLogs.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOffice365ProjectConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectConnectorDataTypesLogs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectConnectorDataTypesLogs.java new file mode 100644 index 000000000000..f720b65df54a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectConnectorDataTypesLogs.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Logs data type. + */ +@Fluent +public final class Office365ProjectConnectorDataTypesLogs extends DataConnectorDataTypeCommon { + /** + * Creates an instance of Office365ProjectConnectorDataTypesLogs class. + */ + public Office365ProjectConnectorDataTypesLogs() { + } + + /** + * {@inheritDoc} + */ + @Override + public Office365ProjectConnectorDataTypesLogs withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model Office365ProjectConnectorDataTypesLogs")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Office365ProjectConnectorDataTypesLogs.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Office365ProjectConnectorDataTypesLogs from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Office365ProjectConnectorDataTypesLogs if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Office365ProjectConnectorDataTypesLogs. + */ + public static Office365ProjectConnectorDataTypesLogs fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Office365ProjectConnectorDataTypesLogs deserializedOffice365ProjectConnectorDataTypesLogs + = new Office365ProjectConnectorDataTypesLogs(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedOffice365ProjectConnectorDataTypesLogs + .withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedOffice365ProjectConnectorDataTypesLogs; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectDataConnector.java new file mode 100644 index 000000000000..fcd4e58961a4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Office365ProjectDataConnector.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.Office365ProjectDataConnectorProperties; +import java.io.IOException; + +/** + * Represents Office Microsoft Project data connector. + */ +@Fluent +public final class Office365ProjectDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE365PROJECT; + + /* + * Office Microsoft Project data connector properties. + */ + private Office365ProjectDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of Office365ProjectDataConnector class. + */ + public Office365ProjectDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Office Microsoft Project data connector properties. + * + * @return the innerProperties value. + */ + private Office365ProjectDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public Office365ProjectDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public Office365ProjectConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the Office365ProjectDataConnector object itself. + */ + public Office365ProjectDataConnector withDataTypes(Office365ProjectConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new Office365ProjectDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the Office365ProjectDataConnector object itself. + */ + public Office365ProjectDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new Office365ProjectDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Office365ProjectDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Office365ProjectDataConnector if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Office365ProjectDataConnector. + */ + public static Office365ProjectDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Office365ProjectDataConnector deserializedOffice365ProjectDataConnector + = new Office365ProjectDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOffice365ProjectDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOffice365ProjectDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOffice365ProjectDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedOffice365ProjectDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedOffice365ProjectDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedOffice365ProjectDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOffice365ProjectDataConnector.innerProperties + = Office365ProjectDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOffice365ProjectDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeAtpCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeAtpCheckRequirements.java new file mode 100644 index 000000000000..03ed654faabe --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeAtpCheckRequirements.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeAtpCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents OfficeATP (Office 365 Advanced Threat Protection) requirements check request. + */ +@Fluent +public final class OfficeAtpCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE_ATP; + + /* + * OfficeATP (Office 365 Advanced Threat Protection) requirements check properties. + */ + private OfficeAtpCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of OfficeAtpCheckRequirements class. + */ + public OfficeAtpCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: OfficeATP (Office 365 Advanced Threat Protection) requirements check + * properties. + * + * @return the innerProperties value. + */ + OfficeAtpCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the OfficeAtpCheckRequirements object itself. + */ + public OfficeAtpCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeAtpCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeAtpCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeAtpCheckRequirements if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OfficeAtpCheckRequirements. + */ + public static OfficeAtpCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeAtpCheckRequirements deserializedOfficeAtpCheckRequirements = new OfficeAtpCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedOfficeAtpCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOfficeAtpCheckRequirements.innerProperties + = OfficeAtpCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeAtpCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeAtpDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeAtpDataConnector.java new file mode 100644 index 000000000000..7953d1ea845a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeAtpDataConnector.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeAtpDataConnectorProperties; +import java.io.IOException; + +/** + * Represents OfficeATP (Office 365 Advanced Threat Protection) data connector. + */ +@Fluent +public final class OfficeAtpDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE_ATP; + + /* + * OfficeATP (Office 365 Advanced Threat Protection) data connector properties. + */ + private OfficeAtpDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OfficeAtpDataConnector class. + */ + public OfficeAtpDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: OfficeATP (Office 365 Advanced Threat Protection) data connector properties. + * + * @return the innerProperties value. + */ + private OfficeAtpDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public OfficeAtpDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public AlertsDataTypeOfDataConnector dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the OfficeAtpDataConnector object itself. + */ + public OfficeAtpDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeAtpDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the OfficeAtpDataConnector object itself. + */ + public OfficeAtpDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeAtpDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeAtpDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeAtpDataConnector if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficeAtpDataConnector. + */ + public static OfficeAtpDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeAtpDataConnector deserializedOfficeAtpDataConnector = new OfficeAtpDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOfficeAtpDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOfficeAtpDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOfficeAtpDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedOfficeAtpDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedOfficeAtpDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedOfficeAtpDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOfficeAtpDataConnector.innerProperties + = OfficeAtpDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeAtpDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsent.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsent.java new file mode 100644 index 000000000000..0deb4f0b42c9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsent.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeConsentInner; + +/** + * An immutable client-side representation of OfficeConsent. + */ +public interface OfficeConsent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the tenantId property: The tenantId of the Office365 with the consent. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the consentId property: Help to easily cascade among the data layers. + * + * @return the consentId value. + */ + String consentId(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.OfficeConsentInner object. + * + * @return the inner object. + */ + OfficeConsentInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsentList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsentList.java new file mode 100644 index 000000000000..307ad037ba9c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsentList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeConsentInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the office365 consents. + */ +@Fluent +public final class OfficeConsentList implements JsonSerializable { + /* + * URL to fetch the next set of office consents. + */ + private String nextLink; + + /* + * Array of the consents. + */ + private List value; + + /** + * Creates an instance of OfficeConsentList class. + */ + public OfficeConsentList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of office consents. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of the consents. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of the consents. + * + * @param value the value value to set. + * @return the OfficeConsentList object itself. + */ + public OfficeConsentList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OfficeConsentList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficeConsentList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeConsentList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeConsentList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficeConsentList. + */ + public static OfficeConsentList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeConsentList deserializedOfficeConsentList = new OfficeConsentList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OfficeConsentInner.fromJson(reader1)); + deserializedOfficeConsentList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOfficeConsentList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeConsentList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsents.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsents.java new file mode 100644 index 000000000000..3dedf73cf76e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeConsents.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of OfficeConsents. + */ +public interface OfficeConsents { + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all office365 consents. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all office365 consents as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String consentId, + Context context); + + /** + * Gets an office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an office365 consent. + */ + OfficeConsent get(String resourceGroupName, String workspaceName, String consentId); + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String consentId, + Context context); + + /** + * Delete the office365 consent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param consentId consent ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String consentId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnector.java index 09176819de9e..8692392d3699 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnector.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnector.java @@ -123,48 +123,48 @@ public OfficeDataConnector withEtag(String etag) { } /** - * Get the tenantId property: The tenant id to connect to, and get the data from. + * Get the dataTypes property: The available data types for the connector. * - * @return the tenantId value. + * @return the dataTypes value. */ - public String tenantId() { - return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + public OfficeDataConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); } /** - * Set the tenantId property: The tenant id to connect to, and get the data from. + * Set the dataTypes property: The available data types for the connector. * - * @param tenantId the tenantId value to set. + * @param dataTypes the dataTypes value to set. * @return the OfficeDataConnector object itself. */ - public OfficeDataConnector withTenantId(String tenantId) { + public OfficeDataConnector withDataTypes(OfficeDataConnectorDataTypes dataTypes) { if (this.innerProperties() == null) { this.innerProperties = new OfficeDataConnectorProperties(); } - this.innerProperties().withTenantId(tenantId); + this.innerProperties().withDataTypes(dataTypes); return this; } /** - * Get the dataTypes property: The available data types for the connector. + * Get the tenantId property: The tenant id to connect to, and get the data from. * - * @return the dataTypes value. + * @return the tenantId value. */ - public OfficeDataConnectorDataTypes dataTypes() { - return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); } /** - * Set the dataTypes property: The available data types for the connector. + * Set the tenantId property: The tenant id to connect to, and get the data from. * - * @param dataTypes the dataTypes value to set. + * @param tenantId the tenantId value to set. * @return the OfficeDataConnector object itself. */ - public OfficeDataConnector withDataTypes(OfficeDataConnectorDataTypes dataTypes) { + public OfficeDataConnector withTenantId(String tenantId) { if (this.innerProperties() == null) { this.innerProperties = new OfficeDataConnectorProperties(); } - this.innerProperties().withDataTypes(dataTypes); + this.innerProperties().withTenantId(tenantId); return this; } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypes.java index d09bbb1385fd..f7295104231d 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypes.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypes.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -103,17 +104,31 @@ public OfficeDataConnectorDataTypes withTeams(OfficeDataConnectorDataTypesTeams * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (exchange() != null) { + if (exchange() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property exchange in model OfficeDataConnectorDataTypes")); + } else { exchange().validate(); } - if (sharePoint() != null) { + if (sharePoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sharePoint in model OfficeDataConnectorDataTypes")); + } else { sharePoint().validate(); } - if (teams() != null) { + if (teams() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property teams in model OfficeDataConnectorDataTypes")); + } else { teams().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(OfficeDataConnectorDataTypes.class); + /** * {@inheritDoc} */ @@ -132,6 +147,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OfficeDataConnectorDataTypes if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OfficeDataConnectorDataTypes. */ public static OfficeDataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesExchange.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesExchange.java index ca4b0c5083f0..29f755d33ca2 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesExchange.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesExchange.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -37,8 +38,15 @@ public OfficeDataConnectorDataTypesExchange withState(DataTypeState state) { */ @Override public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model OfficeDataConnectorDataTypesExchange")); + } } + private static final ClientLogger LOGGER = new ClientLogger(OfficeDataConnectorDataTypesExchange.class); + /** * {@inheritDoc} */ @@ -55,6 +63,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OfficeDataConnectorDataTypesExchange if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OfficeDataConnectorDataTypesExchange. */ public static OfficeDataConnectorDataTypesExchange fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesSharePoint.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesSharePoint.java index 327fbc01eb2e..95a41cdf22b7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesSharePoint.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesSharePoint.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -37,8 +38,15 @@ public OfficeDataConnectorDataTypesSharePoint withState(DataTypeState state) { */ @Override public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model OfficeDataConnectorDataTypesSharePoint")); + } } + private static final ClientLogger LOGGER = new ClientLogger(OfficeDataConnectorDataTypesSharePoint.class); + /** * {@inheritDoc} */ @@ -55,6 +63,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OfficeDataConnectorDataTypesSharePoint if the JsonReader was pointing to an instance of * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OfficeDataConnectorDataTypesSharePoint. */ public static OfficeDataConnectorDataTypesSharePoint fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesTeams.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesTeams.java index 0a20f0a0e0bf..2aa4d4cea5a6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesTeams.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeDataConnectorDataTypesTeams.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -37,8 +38,15 @@ public OfficeDataConnectorDataTypesTeams withState(DataTypeState state) { */ @Override public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model OfficeDataConnectorDataTypesTeams")); + } } + private static final ClientLogger LOGGER = new ClientLogger(OfficeDataConnectorDataTypesTeams.class); + /** * {@inheritDoc} */ @@ -55,6 +63,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OfficeDataConnectorDataTypesTeams if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OfficeDataConnectorDataTypesTeams. */ public static OfficeDataConnectorDataTypesTeams fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeIrmCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeIrmCheckRequirements.java new file mode 100644 index 000000000000..35f3ad8c327a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeIrmCheckRequirements.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeIrmCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents OfficeIRM (Microsoft Insider Risk Management) requirements check request. + */ +@Fluent +public final class OfficeIrmCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE_IRM; + + /* + * OfficeIRM (Microsoft Insider Risk Management) requirements check properties. + */ + private OfficeIrmCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of OfficeIrmCheckRequirements class. + */ + public OfficeIrmCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: OfficeIRM (Microsoft Insider Risk Management) requirements check properties. + * + * @return the innerProperties value. + */ + OfficeIrmCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the OfficeIrmCheckRequirements object itself. + */ + public OfficeIrmCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeIrmCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeIrmCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeIrmCheckRequirements if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OfficeIrmCheckRequirements. + */ + public static OfficeIrmCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeIrmCheckRequirements deserializedOfficeIrmCheckRequirements = new OfficeIrmCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedOfficeIrmCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOfficeIrmCheckRequirements.innerProperties + = OfficeIrmCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeIrmCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeIrmDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeIrmDataConnector.java new file mode 100644 index 000000000000..86fb9c8fe785 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficeIrmDataConnector.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficeIrmDataConnectorProperties; +import java.io.IOException; + +/** + * Represents OfficeIRM (Microsoft Insider Risk Management) data connector. + */ +@Fluent +public final class OfficeIrmDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE_IRM; + + /* + * OfficeIRM (Microsoft Insider Risk Management) data connector properties. + */ + private OfficeIrmDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OfficeIrmDataConnector class. + */ + public OfficeIrmDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: OfficeIRM (Microsoft Insider Risk Management) data connector properties. + * + * @return the innerProperties value. + */ + private OfficeIrmDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public OfficeIrmDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public AlertsDataTypeOfDataConnector dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the OfficeIrmDataConnector object itself. + */ + public OfficeIrmDataConnector withDataTypes(AlertsDataTypeOfDataConnector dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeIrmDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the OfficeIrmDataConnector object itself. + */ + public OfficeIrmDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficeIrmDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficeIrmDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficeIrmDataConnector if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficeIrmDataConnector. + */ + public static OfficeIrmDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficeIrmDataConnector deserializedOfficeIrmDataConnector = new OfficeIrmDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOfficeIrmDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOfficeIrmDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOfficeIrmDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedOfficeIrmDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedOfficeIrmDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedOfficeIrmDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOfficeIrmDataConnector.innerProperties + = OfficeIrmDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficeIrmDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBICheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBICheckRequirements.java new file mode 100644 index 000000000000..9e70335aa2df --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBICheckRequirements.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficePowerBICheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents Office PowerBI requirements check request. + */ +@Fluent +public final class OfficePowerBICheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE_POWER_BI; + + /* + * Office Power BI requirements check properties. + */ + private OfficePowerBICheckRequirementsProperties innerProperties; + + /** + * Creates an instance of OfficePowerBICheckRequirements class. + */ + public OfficePowerBICheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Office Power BI requirements check properties. + * + * @return the innerProperties value. + */ + OfficePowerBICheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the OfficePowerBICheckRequirements object itself. + */ + public OfficePowerBICheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficePowerBICheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficePowerBICheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficePowerBICheckRequirements if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OfficePowerBICheckRequirements. + */ + public static OfficePowerBICheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficePowerBICheckRequirements deserializedOfficePowerBICheckRequirements + = new OfficePowerBICheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedOfficePowerBICheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOfficePowerBICheckRequirements.innerProperties + = OfficePowerBICheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficePowerBICheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIConnectorDataTypes.java new file mode 100644 index 000000000000..062bb3fbd571 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIConnectorDataTypes.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Office Microsoft PowerBI data connector. + */ +@Fluent +public final class OfficePowerBIConnectorDataTypes implements JsonSerializable { + /* + * Logs data type. + */ + private OfficePowerBIConnectorDataTypesLogs logs; + + /** + * Creates an instance of OfficePowerBIConnectorDataTypes class. + */ + public OfficePowerBIConnectorDataTypes() { + } + + /** + * Get the logs property: Logs data type. + * + * @return the logs value. + */ + public OfficePowerBIConnectorDataTypesLogs logs() { + return this.logs; + } + + /** + * Set the logs property: Logs data type. + * + * @param logs the logs value to set. + * @return the OfficePowerBIConnectorDataTypes object itself. + */ + public OfficePowerBIConnectorDataTypes withLogs(OfficePowerBIConnectorDataTypesLogs logs) { + this.logs = logs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logs() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logs in model OfficePowerBIConnectorDataTypes")); + } else { + logs().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficePowerBIConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("logs", this.logs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficePowerBIConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficePowerBIConnectorDataTypes if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficePowerBIConnectorDataTypes. + */ + public static OfficePowerBIConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficePowerBIConnectorDataTypes deserializedOfficePowerBIConnectorDataTypes + = new OfficePowerBIConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logs".equals(fieldName)) { + deserializedOfficePowerBIConnectorDataTypes.logs + = OfficePowerBIConnectorDataTypesLogs.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficePowerBIConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIConnectorDataTypesLogs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIConnectorDataTypesLogs.java new file mode 100644 index 000000000000..362325073401 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIConnectorDataTypesLogs.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Logs data type. + */ +@Fluent +public final class OfficePowerBIConnectorDataTypesLogs extends DataConnectorDataTypeCommon { + /** + * Creates an instance of OfficePowerBIConnectorDataTypesLogs class. + */ + public OfficePowerBIConnectorDataTypesLogs() { + } + + /** + * {@inheritDoc} + */ + @Override + public OfficePowerBIConnectorDataTypesLogs withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model OfficePowerBIConnectorDataTypesLogs")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfficePowerBIConnectorDataTypesLogs.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficePowerBIConnectorDataTypesLogs from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficePowerBIConnectorDataTypesLogs if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficePowerBIConnectorDataTypesLogs. + */ + public static OfficePowerBIConnectorDataTypesLogs fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficePowerBIConnectorDataTypesLogs deserializedOfficePowerBIConnectorDataTypesLogs + = new OfficePowerBIConnectorDataTypesLogs(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedOfficePowerBIConnectorDataTypesLogs + .withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficePowerBIConnectorDataTypesLogs; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIDataConnector.java new file mode 100644 index 000000000000..92919b0a10b7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OfficePowerBIDataConnector.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.OfficePowerBIDataConnectorProperties; +import java.io.IOException; + +/** + * Represents Office Microsoft PowerBI data connector. + */ +@Fluent +public final class OfficePowerBIDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.OFFICE_POWER_BI; + + /* + * Office Microsoft PowerBI data connector properties. + */ + private OfficePowerBIDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OfficePowerBIDataConnector class. + */ + public OfficePowerBIDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Office Microsoft PowerBI data connector properties. + * + * @return the innerProperties value. + */ + private OfficePowerBIDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public OfficePowerBIDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public OfficePowerBIConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the OfficePowerBIDataConnector object itself. + */ + public OfficePowerBIDataConnector withDataTypes(OfficePowerBIConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficePowerBIDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the OfficePowerBIDataConnector object itself. + */ + public OfficePowerBIDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new OfficePowerBIDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfficePowerBIDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfficePowerBIDataConnector if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfficePowerBIDataConnector. + */ + public static OfficePowerBIDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfficePowerBIDataConnector deserializedOfficePowerBIDataConnector = new OfficePowerBIDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOfficePowerBIDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOfficePowerBIDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOfficePowerBIDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedOfficePowerBIDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedOfficePowerBIDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedOfficePowerBIDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedOfficePowerBIDataConnector.innerProperties + = OfficePowerBIDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfficePowerBIDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Operator.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Operator.java new file mode 100644 index 000000000000..5c314b0ca9c1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Operator.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents an operator in a ConditionClause. + */ +public final class Operator extends ExpandableStringEnum { + /** + * Static value Equals for Operator. + */ + public static final Operator EQUALS = fromString("Equals"); + + /** + * Static value NotEquals for Operator. + */ + public static final Operator NOT_EQUALS = fromString("NotEquals"); + + /** + * Static value LessThan for Operator. + */ + public static final Operator LESS_THAN = fromString("LessThan"); + + /** + * Static value LessThanEqual for Operator. + */ + public static final Operator LESS_THAN_EQUAL = fromString("LessThanEqual"); + + /** + * Static value GreaterThan for Operator. + */ + public static final Operator GREATER_THAN = fromString("GreaterThan"); + + /** + * Static value GreaterThanEqual for Operator. + */ + public static final Operator GREATER_THAN_EQUAL = fromString("GreaterThanEqual"); + + /** + * Static value StringContains for Operator. + */ + public static final Operator STRING_CONTAINS = fromString("StringContains"); + + /** + * Static value StringNotContains for Operator. + */ + public static final Operator STRING_NOT_CONTAINS = fromString("StringNotContains"); + + /** + * Static value StringStartsWith for Operator. + */ + public static final Operator STRING_STARTS_WITH = fromString("StringStartsWith"); + + /** + * Static value StringNotStartsWith for Operator. + */ + public static final Operator STRING_NOT_STARTS_WITH = fromString("StringNotStartsWith"); + + /** + * Static value StringEndsWith for Operator. + */ + public static final Operator STRING_ENDS_WITH = fromString("StringEndsWith"); + + /** + * Static value StringNotEndsWith for Operator. + */ + public static final Operator STRING_NOT_ENDS_WITH = fromString("StringNotEndsWith"); + + /** + * Static value StringIsEmpty for Operator. + */ + public static final Operator STRING_IS_EMPTY = fromString("StringIsEmpty"); + + /** + * Static value IsNull for Operator. + */ + public static final Operator IS_NULL = fromString("IsNull"); + + /** + * Static value IsTrue for Operator. + */ + public static final Operator IS_TRUE = fromString("IsTrue"); + + /** + * Static value IsFalse for Operator. + */ + public static final Operator IS_FALSE = fromString("IsFalse"); + + /** + * Static value ArrayContains for Operator. + */ + public static final Operator ARRAY_CONTAINS = fromString("ArrayContains"); + + /** + * Static value ArrayNotContains for Operator. + */ + public static final Operator ARRAY_NOT_CONTAINS = fromString("ArrayNotContains"); + + /** + * Static value OnOrAfterRelative for Operator. + */ + public static final Operator ON_OR_AFTER_RELATIVE = fromString("OnOrAfterRelative"); + + /** + * Static value AfterRelative for Operator. + */ + public static final Operator AFTER_RELATIVE = fromString("AfterRelative"); + + /** + * Static value OnOrBeforeRelative for Operator. + */ + public static final Operator ON_OR_BEFORE_RELATIVE = fromString("OnOrBeforeRelative"); + + /** + * Static value BeforeRelative for Operator. + */ + public static final Operator BEFORE_RELATIVE = fromString("BeforeRelative"); + + /** + * Static value OnOrAfterAbsolute for Operator. + */ + public static final Operator ON_OR_AFTER_ABSOLUTE = fromString("OnOrAfterAbsolute"); + + /** + * Static value AfterAbsolute for Operator. + */ + public static final Operator AFTER_ABSOLUTE = fromString("AfterAbsolute"); + + /** + * Static value OnOrBeforeAbsolute for Operator. + */ + public static final Operator ON_OR_BEFORE_ABSOLUTE = fromString("OnOrBeforeAbsolute"); + + /** + * Static value BeforeAbsolute for Operator. + */ + public static final Operator BEFORE_ABSOLUTE = fromString("BeforeAbsolute"); + + /** + * Creates a new instance of Operator value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Operator() { + } + + /** + * Creates or finds a Operator from its string representation. + * + * @param name a name to look for. + * @return the corresponding Operator. + */ + public static Operator fromString(String name) { + return fromString(name, Operator.class); + } + + /** + * Gets known Operator values. + * + * @return known Operator values. + */ + public static Collection values() { + return values(Operator.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OracleAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OracleAuthModel.java new file mode 100644 index 000000000000..341a630beaa8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OracleAuthModel.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for API authentication for Oracle. + */ +@Fluent +public final class OracleAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.ORACLE; + + /* + * Oracle tenant ID + */ + private String tenantId; + + /* + * Oracle user ID + */ + private String userId; + + /* + * Public Fingerprint + */ + private String publicFingerprint; + + /* + * Content of the PRM file + */ + private String pemFile; + + /** + * Creates an instance of OracleAuthModel class. + */ + public OracleAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the tenantId property: Oracle tenant ID. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Oracle tenant ID. + * + * @param tenantId the tenantId value to set. + * @return the OracleAuthModel object itself. + */ + public OracleAuthModel withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the userId property: Oracle user ID. + * + * @return the userId value. + */ + public String userId() { + return this.userId; + } + + /** + * Set the userId property: Oracle user ID. + * + * @param userId the userId value to set. + * @return the OracleAuthModel object itself. + */ + public OracleAuthModel withUserId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get the publicFingerprint property: Public Fingerprint. + * + * @return the publicFingerprint value. + */ + public String publicFingerprint() { + return this.publicFingerprint; + } + + /** + * Set the publicFingerprint property: Public Fingerprint. + * + * @param publicFingerprint the publicFingerprint value to set. + * @return the OracleAuthModel object itself. + */ + public OracleAuthModel withPublicFingerprint(String publicFingerprint) { + this.publicFingerprint = publicFingerprint; + return this; + } + + /** + * Get the pemFile property: Content of the PRM file. + * + * @return the pemFile value. + */ + public String pemFile() { + return this.pemFile; + } + + /** + * Set the pemFile property: Content of the PRM file. + * + * @param pemFile the pemFile value to set. + * @return the OracleAuthModel object itself. + */ + public OracleAuthModel withPemFile(String pemFile) { + this.pemFile = pemFile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property tenantId in model OracleAuthModel")); + } + if (userId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property userId in model OracleAuthModel")); + } + if (publicFingerprint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property publicFingerprint in model OracleAuthModel")); + } + if (pemFile() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property pemFile in model OracleAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OracleAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", this.tenantId); + jsonWriter.writeStringField("userId", this.userId); + jsonWriter.writeStringField("publicFingerprint", this.publicFingerprint); + jsonWriter.writeStringField("pemFile", this.pemFile); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OracleAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OracleAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OracleAuthModel. + */ + public static OracleAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OracleAuthModel deserializedOracleAuthModel = new OracleAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedOracleAuthModel.tenantId = reader.getString(); + } else if ("userId".equals(fieldName)) { + deserializedOracleAuthModel.userId = reader.getString(); + } else if ("publicFingerprint".equals(fieldName)) { + deserializedOracleAuthModel.publicFingerprint = reader.getString(); + } else if ("pemFile".equals(fieldName)) { + deserializedOracleAuthModel.pemFile = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOracleAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOracleAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OutputType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OutputType.java new file mode 100644 index 000000000000..9c878d81a53d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OutputType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Insights Column type. + */ +public final class OutputType extends ExpandableStringEnum { + /** + * Static value Number for OutputType. + */ + public static final OutputType NUMBER = fromString("Number"); + + /** + * Static value String for OutputType. + */ + public static final OutputType STRING = fromString("String"); + + /** + * Static value Date for OutputType. + */ + public static final OutputType DATE = fromString("Date"); + + /** + * Static value Entity for OutputType. + */ + public static final OutputType ENTITY = fromString("Entity"); + + /** + * Creates a new instance of OutputType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OutputType() { + } + + /** + * Creates or finds a OutputType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OutputType. + */ + public static OutputType fromString(String name) { + return fromString(name, OutputType.class); + } + + /** + * Gets known OutputType values. + * + * @return known OutputType values. + */ + public static Collection values() { + return values(OutputType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OwnerType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OwnerType.java index fcbd03c30ede..d0319485f630 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OwnerType.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/OwnerType.java @@ -8,7 +8,7 @@ import java.util.Collection; /** - * The type of the owner the incident is assigned to. + * The type of the owner the hunt is assigned to. */ public final class OwnerType extends ExpandableStringEnum { /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageBaseProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageBaseProperties.java new file mode 100644 index 000000000000..9c5006f6b48d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageBaseProperties.java @@ -0,0 +1,739 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Describes package properties. + */ +@Fluent +public class PackageBaseProperties implements JsonSerializable { + /* + * The content id of the package + */ + private String contentId; + + /* + * Unique ID for the content. It should be generated based on the contentId, contentKind and the contentVersion of + * the package + */ + private String contentProductId; + + /* + * The package kind + */ + private PackageKind contentKind; + + /* + * The version of the content schema. + */ + private String contentSchemaVersion; + + /* + * Flag indicates if this is a newly published package. + */ + private Flag isNew; + + /* + * Flag indicates if this package is in preview. + */ + private Flag isPreview; + + /* + * Flag indicates if this package is among the featured list. + */ + private Flag isFeatured; + + /* + * Flag indicates if this template is deprecated + */ + private Flag isDeprecated; + + /* + * the latest version number of the package + */ + private String version; + + /* + * The display name of the package + */ + private String displayName; + + /* + * The description of the package + */ + private String description; + + /* + * The publisher display name of the package + */ + private String publisherDisplayName; + + /* + * The source of the package + */ + private MetadataSource source; + + /* + * The author of the package + */ + private MetadataAuthor author; + + /* + * The support tier of the package + */ + private MetadataSupport support; + + /* + * The support tier of the package + */ + private MetadataDependencies dependencies; + + /* + * Providers for the package item + */ + private List providers; + + /* + * first publish date package item + */ + private LocalDate firstPublishDate; + + /* + * last publish date for the package item + */ + private LocalDate lastPublishDate; + + /* + * The categories of the package + */ + private MetadataCategories categories; + + /* + * the tactics the resource covers + */ + private List threatAnalysisTactics; + + /* + * the techniques the resource covers, these have to be aligned with the tactics being used + */ + private List threatAnalysisTechniques; + + /* + * the icon identifier. this id can later be fetched from the content metadata + */ + private String icon; + + /** + * Creates an instance of PackageBaseProperties class. + */ + public PackageBaseProperties() { + } + + /** + * Get the contentId property: The content id of the package. + * + * @return the contentId value. + */ + public String contentId() { + return this.contentId; + } + + /** + * Set the contentId property: The content id of the package. + * + * @param contentId the contentId value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withContentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Get the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @return the contentProductId value. + */ + public String contentProductId() { + return this.contentProductId; + } + + /** + * Set the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @param contentProductId the contentProductId value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withContentProductId(String contentProductId) { + this.contentProductId = contentProductId; + return this; + } + + /** + * Get the contentKind property: The package kind. + * + * @return the contentKind value. + */ + public PackageKind contentKind() { + return this.contentKind; + } + + /** + * Set the contentKind property: The package kind. + * + * @param contentKind the contentKind value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withContentKind(PackageKind contentKind) { + this.contentKind = contentKind; + return this; + } + + /** + * Get the contentSchemaVersion property: The version of the content schema. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.contentSchemaVersion; + } + + /** + * Set the contentSchemaVersion property: The version of the content schema. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withContentSchemaVersion(String contentSchemaVersion) { + this.contentSchemaVersion = contentSchemaVersion; + return this; + } + + /** + * Get the isNew property: Flag indicates if this is a newly published package. + * + * @return the isNew value. + */ + public Flag isNew() { + return this.isNew; + } + + /** + * Set the isNew property: Flag indicates if this is a newly published package. + * + * @param isNew the isNew value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withIsNew(Flag isNew) { + this.isNew = isNew; + return this; + } + + /** + * Get the isPreview property: Flag indicates if this package is in preview. + * + * @return the isPreview value. + */ + public Flag isPreview() { + return this.isPreview; + } + + /** + * Set the isPreview property: Flag indicates if this package is in preview. + * + * @param isPreview the isPreview value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withIsPreview(Flag isPreview) { + this.isPreview = isPreview; + return this; + } + + /** + * Get the isFeatured property: Flag indicates if this package is among the featured list. + * + * @return the isFeatured value. + */ + public Flag isFeatured() { + return this.isFeatured; + } + + /** + * Set the isFeatured property: Flag indicates if this package is among the featured list. + * + * @param isFeatured the isFeatured value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withIsFeatured(Flag isFeatured) { + this.isFeatured = isFeatured; + return this; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + public Flag isDeprecated() { + return this.isDeprecated; + } + + /** + * Set the isDeprecated property: Flag indicates if this template is deprecated. + * + * @param isDeprecated the isDeprecated value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withIsDeprecated(Flag isDeprecated) { + this.isDeprecated = isDeprecated; + return this; + } + + /** + * Get the version property: the latest version number of the package. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: the latest version number of the package. + * + * @param version the version value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the displayName property: The display name of the package. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the package. + * + * @param displayName the displayName value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The description of the package. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the package. + * + * @param description the description value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the publisherDisplayName property: The publisher display name of the package. + * + * @return the publisherDisplayName value. + */ + public String publisherDisplayName() { + return this.publisherDisplayName; + } + + /** + * Set the publisherDisplayName property: The publisher display name of the package. + * + * @param publisherDisplayName the publisherDisplayName value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withPublisherDisplayName(String publisherDisplayName) { + this.publisherDisplayName = publisherDisplayName; + return this; + } + + /** + * Get the source property: The source of the package. + * + * @return the source value. + */ + public MetadataSource source() { + return this.source; + } + + /** + * Set the source property: The source of the package. + * + * @param source the source value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withSource(MetadataSource source) { + this.source = source; + return this; + } + + /** + * Get the author property: The author of the package. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.author; + } + + /** + * Set the author property: The author of the package. + * + * @param author the author value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withAuthor(MetadataAuthor author) { + this.author = author; + return this; + } + + /** + * Get the support property: The support tier of the package. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.support; + } + + /** + * Set the support property: The support tier of the package. + * + * @param support the support value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withSupport(MetadataSupport support) { + this.support = support; + return this; + } + + /** + * Get the dependencies property: The support tier of the package. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.dependencies; + } + + /** + * Set the dependencies property: The support tier of the package. + * + * @param dependencies the dependencies value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withDependencies(MetadataDependencies dependencies) { + this.dependencies = dependencies; + return this; + } + + /** + * Get the providers property: Providers for the package item. + * + * @return the providers value. + */ + public List providers() { + return this.providers; + } + + /** + * Set the providers property: Providers for the package item. + * + * @param providers the providers value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withProviders(List providers) { + this.providers = providers; + return this; + } + + /** + * Get the firstPublishDate property: first publish date package item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.firstPublishDate; + } + + /** + * Set the firstPublishDate property: first publish date package item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withFirstPublishDate(LocalDate firstPublishDate) { + this.firstPublishDate = firstPublishDate; + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the package item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.lastPublishDate; + } + + /** + * Set the lastPublishDate property: last publish date for the package item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withLastPublishDate(LocalDate lastPublishDate) { + this.lastPublishDate = lastPublishDate; + return this; + } + + /** + * Get the categories property: The categories of the package. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.categories; + } + + /** + * Set the categories property: The categories of the package. + * + * @param categories the categories value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withCategories(MetadataCategories categories) { + this.categories = categories; + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.threatAnalysisTactics; + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withThreatAnalysisTactics(List threatAnalysisTactics) { + this.threatAnalysisTactics = threatAnalysisTactics; + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.threatAnalysisTechniques; + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withThreatAnalysisTechniques(List threatAnalysisTechniques) { + this.threatAnalysisTechniques = threatAnalysisTechniques; + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + public String icon() { + return this.icon; + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon value to set. + * @return the PackageBaseProperties object itself. + */ + public PackageBaseProperties withIcon(String icon) { + this.icon = icon; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", this.contentId); + jsonWriter.writeStringField("contentProductId", this.contentProductId); + jsonWriter.writeStringField("contentKind", this.contentKind == null ? null : this.contentKind.toString()); + jsonWriter.writeStringField("contentSchemaVersion", this.contentSchemaVersion); + jsonWriter.writeStringField("isNew", this.isNew == null ? null : this.isNew.toString()); + jsonWriter.writeStringField("isPreview", this.isPreview == null ? null : this.isPreview.toString()); + jsonWriter.writeStringField("isFeatured", this.isFeatured == null ? null : this.isFeatured.toString()); + jsonWriter.writeStringField("isDeprecated", this.isDeprecated == null ? null : this.isDeprecated.toString()); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("publisherDisplayName", this.publisherDisplayName); + jsonWriter.writeJsonField("source", this.source); + jsonWriter.writeJsonField("author", this.author); + jsonWriter.writeJsonField("support", this.support); + jsonWriter.writeJsonField("dependencies", this.dependencies); + jsonWriter.writeArrayField("providers", this.providers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(this.firstPublishDate, null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(this.lastPublishDate, null)); + jsonWriter.writeJsonField("categories", this.categories); + jsonWriter.writeArrayField("threatAnalysisTactics", this.threatAnalysisTactics, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", this.threatAnalysisTechniques, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("icon", this.icon); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PackageBaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PackageBaseProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PackageBaseProperties. + */ + public static PackageBaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PackageBaseProperties deserializedPackageBaseProperties = new PackageBaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedPackageBaseProperties.contentId = reader.getString(); + } else if ("contentProductId".equals(fieldName)) { + deserializedPackageBaseProperties.contentProductId = reader.getString(); + } else if ("contentKind".equals(fieldName)) { + deserializedPackageBaseProperties.contentKind = PackageKind.fromString(reader.getString()); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedPackageBaseProperties.contentSchemaVersion = reader.getString(); + } else if ("isNew".equals(fieldName)) { + deserializedPackageBaseProperties.isNew = Flag.fromString(reader.getString()); + } else if ("isPreview".equals(fieldName)) { + deserializedPackageBaseProperties.isPreview = Flag.fromString(reader.getString()); + } else if ("isFeatured".equals(fieldName)) { + deserializedPackageBaseProperties.isFeatured = Flag.fromString(reader.getString()); + } else if ("isDeprecated".equals(fieldName)) { + deserializedPackageBaseProperties.isDeprecated = Flag.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedPackageBaseProperties.version = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedPackageBaseProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedPackageBaseProperties.description = reader.getString(); + } else if ("publisherDisplayName".equals(fieldName)) { + deserializedPackageBaseProperties.publisherDisplayName = reader.getString(); + } else if ("source".equals(fieldName)) { + deserializedPackageBaseProperties.source = MetadataSource.fromJson(reader); + } else if ("author".equals(fieldName)) { + deserializedPackageBaseProperties.author = MetadataAuthor.fromJson(reader); + } else if ("support".equals(fieldName)) { + deserializedPackageBaseProperties.support = MetadataSupport.fromJson(reader); + } else if ("dependencies".equals(fieldName)) { + deserializedPackageBaseProperties.dependencies = MetadataDependencies.fromJson(reader); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedPackageBaseProperties.providers = providers; + } else if ("firstPublishDate".equals(fieldName)) { + deserializedPackageBaseProperties.firstPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedPackageBaseProperties.lastPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("categories".equals(fieldName)) { + deserializedPackageBaseProperties.categories = MetadataCategories.fromJson(reader); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedPackageBaseProperties.threatAnalysisTactics = threatAnalysisTactics; + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedPackageBaseProperties.threatAnalysisTechniques = threatAnalysisTechniques; + } else if ("icon".equals(fieldName)) { + deserializedPackageBaseProperties.icon = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPackageBaseProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageKind.java new file mode 100644 index 000000000000..142fbf48eb03 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageKind.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The package kind. + */ +public final class PackageKind extends ExpandableStringEnum { + /** + * Static value Solution for PackageKind. + */ + public static final PackageKind SOLUTION = fromString("Solution"); + + /** + * Static value Standalone for PackageKind. + */ + public static final PackageKind STANDALONE = fromString("Standalone"); + + /** + * Creates a new instance of PackageKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PackageKind() { + } + + /** + * Creates or finds a PackageKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding PackageKind. + */ + public static PackageKind fromString(String name) { + return fromString(name, PackageKind.class); + } + + /** + * Gets known PackageKind values. + * + * @return known PackageKind values. + */ + public static Collection values() { + return values(PackageKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageList.java new file mode 100644 index 000000000000..4d7bb46e6089 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; +import java.io.IOException; +import java.util.List; + +/** + * List available packages. + */ +@Fluent +public final class PackageList implements JsonSerializable { + /* + * URL to fetch the next set of packages. + */ + private String nextLink; + + /* + * Array of packages. + */ + private List value; + + /** + * Creates an instance of PackageList class. + */ + public PackageList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of packages. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of packages. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of packages. + * + * @param value the value value to set. + * @return the PackageList object itself. + */ + public PackageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model PackageList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PackageList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PackageList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PackageList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PackageList. + */ + public static PackageList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PackageList deserializedPackageList = new PackageList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> PackageModelInner.fromJson(reader1)); + deserializedPackageList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPackageList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPackageList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageModel.java new file mode 100644 index 000000000000..eae436700459 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PackageModel.java @@ -0,0 +1,961 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner; +import java.time.LocalDate; +import java.util.List; + +/** + * An immutable client-side representation of PackageModel. + */ +public interface PackageModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the contentId property: The content id of the package. + * + * @return the contentId value. + */ + String contentId(); + + /** + * Gets the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @return the contentProductId value. + */ + String contentProductId(); + + /** + * Gets the contentKind property: The package kind. + * + * @return the contentKind value. + */ + PackageKind contentKind(); + + /** + * Gets the contentSchemaVersion property: The version of the content schema. + * + * @return the contentSchemaVersion value. + */ + String contentSchemaVersion(); + + /** + * Gets the isNew property: Flag indicates if this is a newly published package. + * + * @return the isNew value. + */ + Flag isNew(); + + /** + * Gets the isPreview property: Flag indicates if this package is in preview. + * + * @return the isPreview value. + */ + Flag isPreview(); + + /** + * Gets the isFeatured property: Flag indicates if this package is among the featured list. + * + * @return the isFeatured value. + */ + Flag isFeatured(); + + /** + * Gets the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + Flag isDeprecated(); + + /** + * Gets the version property: the latest version number of the package. + * + * @return the version value. + */ + String version(); + + /** + * Gets the displayName property: The display name of the package. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: The description of the package. + * + * @return the description value. + */ + String description(); + + /** + * Gets the publisherDisplayName property: The publisher display name of the package. + * + * @return the publisherDisplayName value. + */ + String publisherDisplayName(); + + /** + * Gets the source property: The source of the package. + * + * @return the source value. + */ + MetadataSource source(); + + /** + * Gets the author property: The author of the package. + * + * @return the author value. + */ + MetadataAuthor author(); + + /** + * Gets the support property: The support tier of the package. + * + * @return the support value. + */ + MetadataSupport support(); + + /** + * Gets the dependencies property: The support tier of the package. + * + * @return the dependencies value. + */ + MetadataDependencies dependencies(); + + /** + * Gets the providers property: Providers for the package item. + * + * @return the providers value. + */ + List providers(); + + /** + * Gets the firstPublishDate property: first publish date package item. + * + * @return the firstPublishDate value. + */ + LocalDate firstPublishDate(); + + /** + * Gets the lastPublishDate property: last publish date for the package item. + * + * @return the lastPublishDate value. + */ + LocalDate lastPublishDate(); + + /** + * Gets the categories property: The categories of the package. + * + * @return the categories value. + */ + MetadataCategories categories(); + + /** + * Gets the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + List threatAnalysisTactics(); + + /** + * Gets the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + List threatAnalysisTechniques(); + + /** + * Gets the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.PackageModelInner object. + * + * @return the inner object. + */ + PackageModelInner innerModel(); + + /** + * The entirety of the PackageModel definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The PackageModel definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PackageModel definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the PackageModel definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the PackageModel definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithEtag, DefinitionStages.WithContentId, DefinitionStages.WithContentProductId, + DefinitionStages.WithContentKind, DefinitionStages.WithContentSchemaVersion, DefinitionStages.WithIsNew, + DefinitionStages.WithIsPreview, DefinitionStages.WithIsFeatured, DefinitionStages.WithIsDeprecated, + DefinitionStages.WithVersion, DefinitionStages.WithDisplayName, DefinitionStages.WithDescription, + DefinitionStages.WithPublisherDisplayName, DefinitionStages.WithSource, DefinitionStages.WithAuthor, + DefinitionStages.WithSupport, DefinitionStages.WithDependencies, DefinitionStages.WithProviders, + DefinitionStages.WithFirstPublishDate, DefinitionStages.WithLastPublishDate, + DefinitionStages.WithCategories, DefinitionStages.WithThreatAnalysisTactics, + DefinitionStages.WithThreatAnalysisTechniques, DefinitionStages.WithIcon { + /** + * Executes the create request. + * + * @return the created resource. + */ + PackageModel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PackageModel create(Context context); + } + + /** + * The stage of the PackageModel definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the PackageModel definition allowing to specify contentId. + */ + interface WithContentId { + /** + * Specifies the contentId property: The content id of the package. + * + * @param contentId The content id of the package. + * @return the next definition stage. + */ + WithCreate withContentId(String contentId); + } + + /** + * The stage of the PackageModel definition allowing to specify contentProductId. + */ + interface WithContentProductId { + /** + * Specifies the contentProductId property: Unique ID for the content. It should be generated based on the + * contentId, contentKind and the contentVersion of the package. + * + * @param contentProductId Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * @return the next definition stage. + */ + WithCreate withContentProductId(String contentProductId); + } + + /** + * The stage of the PackageModel definition allowing to specify contentKind. + */ + interface WithContentKind { + /** + * Specifies the contentKind property: The package kind. + * + * @param contentKind The package kind. + * @return the next definition stage. + */ + WithCreate withContentKind(PackageKind contentKind); + } + + /** + * The stage of the PackageModel definition allowing to specify contentSchemaVersion. + */ + interface WithContentSchemaVersion { + /** + * Specifies the contentSchemaVersion property: The version of the content schema.. + * + * @param contentSchemaVersion The version of the content schema. + * @return the next definition stage. + */ + WithCreate withContentSchemaVersion(String contentSchemaVersion); + } + + /** + * The stage of the PackageModel definition allowing to specify isNew. + */ + interface WithIsNew { + /** + * Specifies the isNew property: Flag indicates if this is a newly published package.. + * + * @param isNew Flag indicates if this is a newly published package. + * @return the next definition stage. + */ + WithCreate withIsNew(Flag isNew); + } + + /** + * The stage of the PackageModel definition allowing to specify isPreview. + */ + interface WithIsPreview { + /** + * Specifies the isPreview property: Flag indicates if this package is in preview.. + * + * @param isPreview Flag indicates if this package is in preview. + * @return the next definition stage. + */ + WithCreate withIsPreview(Flag isPreview); + } + + /** + * The stage of the PackageModel definition allowing to specify isFeatured. + */ + interface WithIsFeatured { + /** + * Specifies the isFeatured property: Flag indicates if this package is among the featured list.. + * + * @param isFeatured Flag indicates if this package is among the featured list. + * @return the next definition stage. + */ + WithCreate withIsFeatured(Flag isFeatured); + } + + /** + * The stage of the PackageModel definition allowing to specify isDeprecated. + */ + interface WithIsDeprecated { + /** + * Specifies the isDeprecated property: Flag indicates if this template is deprecated. + * + * @param isDeprecated Flag indicates if this template is deprecated. + * @return the next definition stage. + */ + WithCreate withIsDeprecated(Flag isDeprecated); + } + + /** + * The stage of the PackageModel definition allowing to specify version. + */ + interface WithVersion { + /** + * Specifies the version property: the latest version number of the package. + * + * @param version the latest version number of the package. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + + /** + * The stage of the PackageModel definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the package. + * + * @param displayName The display name of the package. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the PackageModel definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the package. + * + * @param description The description of the package. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the PackageModel definition allowing to specify publisherDisplayName. + */ + interface WithPublisherDisplayName { + /** + * Specifies the publisherDisplayName property: The publisher display name of the package. + * + * @param publisherDisplayName The publisher display name of the package. + * @return the next definition stage. + */ + WithCreate withPublisherDisplayName(String publisherDisplayName); + } + + /** + * The stage of the PackageModel definition allowing to specify source. + */ + interface WithSource { + /** + * Specifies the source property: The source of the package. + * + * @param source The source of the package. + * @return the next definition stage. + */ + WithCreate withSource(MetadataSource source); + } + + /** + * The stage of the PackageModel definition allowing to specify author. + */ + interface WithAuthor { + /** + * Specifies the author property: The author of the package. + * + * @param author The author of the package. + * @return the next definition stage. + */ + WithCreate withAuthor(MetadataAuthor author); + } + + /** + * The stage of the PackageModel definition allowing to specify support. + */ + interface WithSupport { + /** + * Specifies the support property: The support tier of the package. + * + * @param support The support tier of the package. + * @return the next definition stage. + */ + WithCreate withSupport(MetadataSupport support); + } + + /** + * The stage of the PackageModel definition allowing to specify dependencies. + */ + interface WithDependencies { + /** + * Specifies the dependencies property: The support tier of the package. + * + * @param dependencies The support tier of the package. + * @return the next definition stage. + */ + WithCreate withDependencies(MetadataDependencies dependencies); + } + + /** + * The stage of the PackageModel definition allowing to specify providers. + */ + interface WithProviders { + /** + * Specifies the providers property: Providers for the package item. + * + * @param providers Providers for the package item. + * @return the next definition stage. + */ + WithCreate withProviders(List providers); + } + + /** + * The stage of the PackageModel definition allowing to specify firstPublishDate. + */ + interface WithFirstPublishDate { + /** + * Specifies the firstPublishDate property: first publish date package item. + * + * @param firstPublishDate first publish date package item. + * @return the next definition stage. + */ + WithCreate withFirstPublishDate(LocalDate firstPublishDate); + } + + /** + * The stage of the PackageModel definition allowing to specify lastPublishDate. + */ + interface WithLastPublishDate { + /** + * Specifies the lastPublishDate property: last publish date for the package item. + * + * @param lastPublishDate last publish date for the package item. + * @return the next definition stage. + */ + WithCreate withLastPublishDate(LocalDate lastPublishDate); + } + + /** + * The stage of the PackageModel definition allowing to specify categories. + */ + interface WithCategories { + /** + * Specifies the categories property: The categories of the package. + * + * @param categories The categories of the package. + * @return the next definition stage. + */ + WithCreate withCategories(MetadataCategories categories); + } + + /** + * The stage of the PackageModel definition allowing to specify threatAnalysisTactics. + */ + interface WithThreatAnalysisTactics { + /** + * Specifies the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the tactics the resource covers. + * @return the next definition stage. + */ + WithCreate withThreatAnalysisTactics(List threatAnalysisTactics); + } + + /** + * The stage of the PackageModel definition allowing to specify threatAnalysisTechniques. + */ + interface WithThreatAnalysisTechniques { + /** + * Specifies the threatAnalysisTechniques property: the techniques the resource covers, these have to be + * aligned with the tactics being used. + * + * @param threatAnalysisTechniques the techniques the resource covers, these have to be aligned with the + * tactics being used. + * @return the next definition stage. + */ + WithCreate withThreatAnalysisTechniques(List threatAnalysisTechniques); + } + + /** + * The stage of the PackageModel definition allowing to specify icon. + */ + interface WithIcon { + /** + * Specifies the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon identifier. this id can later be fetched from the content metadata. + * @return the next definition stage. + */ + WithCreate withIcon(String icon); + } + } + + /** + * Begins update for the PackageModel resource. + * + * @return the stage of resource update. + */ + PackageModel.Update update(); + + /** + * The template for PackageModel update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithContentId, UpdateStages.WithContentProductId, + UpdateStages.WithContentKind, UpdateStages.WithContentSchemaVersion, UpdateStages.WithIsNew, + UpdateStages.WithIsPreview, UpdateStages.WithIsFeatured, UpdateStages.WithIsDeprecated, + UpdateStages.WithVersion, UpdateStages.WithDisplayName, UpdateStages.WithDescription, + UpdateStages.WithPublisherDisplayName, UpdateStages.WithSource, UpdateStages.WithAuthor, + UpdateStages.WithSupport, UpdateStages.WithDependencies, UpdateStages.WithProviders, + UpdateStages.WithFirstPublishDate, UpdateStages.WithLastPublishDate, UpdateStages.WithCategories, + UpdateStages.WithThreatAnalysisTactics, UpdateStages.WithThreatAnalysisTechniques, UpdateStages.WithIcon { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PackageModel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PackageModel apply(Context context); + } + + /** + * The PackageModel update stages. + */ + interface UpdateStages { + /** + * The stage of the PackageModel update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the PackageModel update allowing to specify contentId. + */ + interface WithContentId { + /** + * Specifies the contentId property: The content id of the package. + * + * @param contentId The content id of the package. + * @return the next definition stage. + */ + Update withContentId(String contentId); + } + + /** + * The stage of the PackageModel update allowing to specify contentProductId. + */ + interface WithContentProductId { + /** + * Specifies the contentProductId property: Unique ID for the content. It should be generated based on the + * contentId, contentKind and the contentVersion of the package. + * + * @param contentProductId Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * @return the next definition stage. + */ + Update withContentProductId(String contentProductId); + } + + /** + * The stage of the PackageModel update allowing to specify contentKind. + */ + interface WithContentKind { + /** + * Specifies the contentKind property: The package kind. + * + * @param contentKind The package kind. + * @return the next definition stage. + */ + Update withContentKind(PackageKind contentKind); + } + + /** + * The stage of the PackageModel update allowing to specify contentSchemaVersion. + */ + interface WithContentSchemaVersion { + /** + * Specifies the contentSchemaVersion property: The version of the content schema.. + * + * @param contentSchemaVersion The version of the content schema. + * @return the next definition stage. + */ + Update withContentSchemaVersion(String contentSchemaVersion); + } + + /** + * The stage of the PackageModel update allowing to specify isNew. + */ + interface WithIsNew { + /** + * Specifies the isNew property: Flag indicates if this is a newly published package.. + * + * @param isNew Flag indicates if this is a newly published package. + * @return the next definition stage. + */ + Update withIsNew(Flag isNew); + } + + /** + * The stage of the PackageModel update allowing to specify isPreview. + */ + interface WithIsPreview { + /** + * Specifies the isPreview property: Flag indicates if this package is in preview.. + * + * @param isPreview Flag indicates if this package is in preview. + * @return the next definition stage. + */ + Update withIsPreview(Flag isPreview); + } + + /** + * The stage of the PackageModel update allowing to specify isFeatured. + */ + interface WithIsFeatured { + /** + * Specifies the isFeatured property: Flag indicates if this package is among the featured list.. + * + * @param isFeatured Flag indicates if this package is among the featured list. + * @return the next definition stage. + */ + Update withIsFeatured(Flag isFeatured); + } + + /** + * The stage of the PackageModel update allowing to specify isDeprecated. + */ + interface WithIsDeprecated { + /** + * Specifies the isDeprecated property: Flag indicates if this template is deprecated. + * + * @param isDeprecated Flag indicates if this template is deprecated. + * @return the next definition stage. + */ + Update withIsDeprecated(Flag isDeprecated); + } + + /** + * The stage of the PackageModel update allowing to specify version. + */ + interface WithVersion { + /** + * Specifies the version property: the latest version number of the package. + * + * @param version the latest version number of the package. + * @return the next definition stage. + */ + Update withVersion(String version); + } + + /** + * The stage of the PackageModel update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the package. + * + * @param displayName The display name of the package. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the PackageModel update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the package. + * + * @param description The description of the package. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the PackageModel update allowing to specify publisherDisplayName. + */ + interface WithPublisherDisplayName { + /** + * Specifies the publisherDisplayName property: The publisher display name of the package. + * + * @param publisherDisplayName The publisher display name of the package. + * @return the next definition stage. + */ + Update withPublisherDisplayName(String publisherDisplayName); + } + + /** + * The stage of the PackageModel update allowing to specify source. + */ + interface WithSource { + /** + * Specifies the source property: The source of the package. + * + * @param source The source of the package. + * @return the next definition stage. + */ + Update withSource(MetadataSource source); + } + + /** + * The stage of the PackageModel update allowing to specify author. + */ + interface WithAuthor { + /** + * Specifies the author property: The author of the package. + * + * @param author The author of the package. + * @return the next definition stage. + */ + Update withAuthor(MetadataAuthor author); + } + + /** + * The stage of the PackageModel update allowing to specify support. + */ + interface WithSupport { + /** + * Specifies the support property: The support tier of the package. + * + * @param support The support tier of the package. + * @return the next definition stage. + */ + Update withSupport(MetadataSupport support); + } + + /** + * The stage of the PackageModel update allowing to specify dependencies. + */ + interface WithDependencies { + /** + * Specifies the dependencies property: The support tier of the package. + * + * @param dependencies The support tier of the package. + * @return the next definition stage. + */ + Update withDependencies(MetadataDependencies dependencies); + } + + /** + * The stage of the PackageModel update allowing to specify providers. + */ + interface WithProviders { + /** + * Specifies the providers property: Providers for the package item. + * + * @param providers Providers for the package item. + * @return the next definition stage. + */ + Update withProviders(List providers); + } + + /** + * The stage of the PackageModel update allowing to specify firstPublishDate. + */ + interface WithFirstPublishDate { + /** + * Specifies the firstPublishDate property: first publish date package item. + * + * @param firstPublishDate first publish date package item. + * @return the next definition stage. + */ + Update withFirstPublishDate(LocalDate firstPublishDate); + } + + /** + * The stage of the PackageModel update allowing to specify lastPublishDate. + */ + interface WithLastPublishDate { + /** + * Specifies the lastPublishDate property: last publish date for the package item. + * + * @param lastPublishDate last publish date for the package item. + * @return the next definition stage. + */ + Update withLastPublishDate(LocalDate lastPublishDate); + } + + /** + * The stage of the PackageModel update allowing to specify categories. + */ + interface WithCategories { + /** + * Specifies the categories property: The categories of the package. + * + * @param categories The categories of the package. + * @return the next definition stage. + */ + Update withCategories(MetadataCategories categories); + } + + /** + * The stage of the PackageModel update allowing to specify threatAnalysisTactics. + */ + interface WithThreatAnalysisTactics { + /** + * Specifies the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the tactics the resource covers. + * @return the next definition stage. + */ + Update withThreatAnalysisTactics(List threatAnalysisTactics); + } + + /** + * The stage of the PackageModel update allowing to specify threatAnalysisTechniques. + */ + interface WithThreatAnalysisTechniques { + /** + * Specifies the threatAnalysisTechniques property: the techniques the resource covers, these have to be + * aligned with the tactics being used. + * + * @param threatAnalysisTechniques the techniques the resource covers, these have to be aligned with the + * tactics being used. + * @return the next definition stage. + */ + Update withThreatAnalysisTechniques(List threatAnalysisTechniques); + } + + /** + * The stage of the PackageModel update allowing to specify icon. + */ + interface WithIcon { + /** + * Specifies the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon identifier. this id can later be fetched from the content metadata. + * @return the next definition stage. + */ + Update withIcon(String icon); + } + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionProviderScope.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionProviderScope.java new file mode 100644 index 000000000000..401b2f62ef3d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionProviderScope.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Permission provider scope. + */ +public final class PermissionProviderScope extends ExpandableStringEnum { + /** + * Static value ResourceGroup for PermissionProviderScope. + */ + public static final PermissionProviderScope RESOURCE_GROUP = fromString("ResourceGroup"); + + /** + * Static value Subscription for PermissionProviderScope. + */ + public static final PermissionProviderScope SUBSCRIPTION = fromString("Subscription"); + + /** + * Static value Workspace for PermissionProviderScope. + */ + public static final PermissionProviderScope WORKSPACE = fromString("Workspace"); + + /** + * Creates a new instance of PermissionProviderScope value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PermissionProviderScope() { + } + + /** + * Creates or finds a PermissionProviderScope from its string representation. + * + * @param name a name to look for. + * @return the corresponding PermissionProviderScope. + */ + public static PermissionProviderScope fromString(String name) { + return fromString(name, PermissionProviderScope.class); + } + + /** + * Gets known PermissionProviderScope values. + * + * @return known PermissionProviderScope values. + */ + public static Collection values() { + return values(PermissionProviderScope.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Permissions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Permissions.java new file mode 100644 index 000000000000..a7887b966ac1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Permissions.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Permissions required for the connector. + */ +@Fluent +public final class Permissions implements JsonSerializable { + /* + * Resource provider permissions required for the connector + */ + private List resourceProvider; + + /* + * Customs permissions required for the connector + */ + private List customs; + + /** + * Creates an instance of Permissions class. + */ + public Permissions() { + } + + /** + * Get the resourceProvider property: Resource provider permissions required for the connector. + * + * @return the resourceProvider value. + */ + public List resourceProvider() { + return this.resourceProvider; + } + + /** + * Set the resourceProvider property: Resource provider permissions required for the connector. + * + * @param resourceProvider the resourceProvider value to set. + * @return the Permissions object itself. + */ + public Permissions withResourceProvider(List resourceProvider) { + this.resourceProvider = resourceProvider; + return this; + } + + /** + * Get the customs property: Customs permissions required for the connector. + * + * @return the customs value. + */ + public List customs() { + return this.customs; + } + + /** + * Set the customs property: Customs permissions required for the connector. + * + * @param customs the customs value to set. + * @return the Permissions object itself. + */ + public Permissions withCustoms(List customs) { + this.customs = customs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceProvider() != null) { + resourceProvider().forEach(e -> e.validate()); + } + if (customs() != null) { + customs().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceProvider", this.resourceProvider, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("customs", this.customs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Permissions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Permissions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Permissions. + */ + public static Permissions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Permissions deserializedPermissions = new Permissions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceProvider".equals(fieldName)) { + List resourceProvider + = reader.readArray(reader1 -> PermissionsResourceProviderItem.fromJson(reader1)); + deserializedPermissions.resourceProvider = resourceProvider; + } else if ("customs".equals(fieldName)) { + List customs + = reader.readArray(reader1 -> PermissionsCustomsItem.fromJson(reader1)); + deserializedPermissions.customs = customs; + } else { + reader.skipChildren(); + } + } + + return deserializedPermissions; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionsCustomsItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionsCustomsItem.java new file mode 100644 index 000000000000..50a605bd3e2b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionsCustomsItem.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PermissionsCustomsItem model. + */ +@Fluent +public final class PermissionsCustomsItem extends Customs { + /** + * Creates an instance of PermissionsCustomsItem class. + */ + public PermissionsCustomsItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public PermissionsCustomsItem withName(String name) { + super.withName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PermissionsCustomsItem withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("description", description()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PermissionsCustomsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PermissionsCustomsItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PermissionsCustomsItem. + */ + public static PermissionsCustomsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PermissionsCustomsItem deserializedPermissionsCustomsItem = new PermissionsCustomsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPermissionsCustomsItem.withName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPermissionsCustomsItem.withDescription(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPermissionsCustomsItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionsResourceProviderItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionsResourceProviderItem.java new file mode 100644 index 000000000000..5d8578e85c40 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PermissionsResourceProviderItem.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PermissionsResourceProviderItem model. + */ +@Fluent +public final class PermissionsResourceProviderItem extends ResourceProvider { + /** + * Creates an instance of PermissionsResourceProviderItem class. + */ + public PermissionsResourceProviderItem() { + } + + /** + * {@inheritDoc} + */ + @Override + public PermissionsResourceProviderItem withProvider(ProviderName provider) { + super.withProvider(provider); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PermissionsResourceProviderItem withPermissionsDisplayText(String permissionsDisplayText) { + super.withPermissionsDisplayText(permissionsDisplayText); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PermissionsResourceProviderItem withProviderDisplayName(String providerDisplayName) { + super.withProviderDisplayName(providerDisplayName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PermissionsResourceProviderItem withScope(PermissionProviderScope scope) { + super.withScope(scope); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PermissionsResourceProviderItem withRequiredPermissions(RequiredPermissions requiredPermissions) { + super.withRequiredPermissions(requiredPermissions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (requiredPermissions() != null) { + requiredPermissions().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", provider() == null ? null : provider().toString()); + jsonWriter.writeStringField("permissionsDisplayText", permissionsDisplayText()); + jsonWriter.writeStringField("providerDisplayName", providerDisplayName()); + jsonWriter.writeStringField("scope", scope() == null ? null : scope().toString()); + jsonWriter.writeJsonField("requiredPermissions", requiredPermissions()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PermissionsResourceProviderItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PermissionsResourceProviderItem if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PermissionsResourceProviderItem. + */ + public static PermissionsResourceProviderItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PermissionsResourceProviderItem deserializedPermissionsResourceProviderItem + = new PermissionsResourceProviderItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedPermissionsResourceProviderItem + .withProvider(ProviderName.fromString(reader.getString())); + } else if ("permissionsDisplayText".equals(fieldName)) { + deserializedPermissionsResourceProviderItem.withPermissionsDisplayText(reader.getString()); + } else if ("providerDisplayName".equals(fieldName)) { + deserializedPermissionsResourceProviderItem.withProviderDisplayName(reader.getString()); + } else if ("scope".equals(fieldName)) { + deserializedPermissionsResourceProviderItem + .withScope(PermissionProviderScope.fromString(reader.getString())); + } else if ("requiredPermissions".equals(fieldName)) { + deserializedPermissionsResourceProviderItem + .withRequiredPermissions(RequiredPermissions.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedPermissionsResourceProviderItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PollingFrequency.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PollingFrequency.java new file mode 100644 index 000000000000..7c8a4354d604 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PollingFrequency.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The polling frequency for the TAXII server. + */ +public final class PollingFrequency extends ExpandableStringEnum { + /** + * Static value OnceAMinute for PollingFrequency. + */ + public static final PollingFrequency ONCE_AMINUTE = fromString("OnceAMinute"); + + /** + * Static value OnceAnHour for PollingFrequency. + */ + public static final PollingFrequency ONCE_AN_HOUR = fromString("OnceAnHour"); + + /** + * Static value OnceADay for PollingFrequency. + */ + public static final PollingFrequency ONCE_ADAY = fromString("OnceADay"); + + /** + * Creates a new instance of PollingFrequency value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PollingFrequency() { + } + + /** + * Creates or finds a PollingFrequency from its string representation. + * + * @param name a name to look for. + * @return the corresponding PollingFrequency. + */ + public static PollingFrequency fromString(String name) { + return fromString(name, PollingFrequency.class); + } + + /** + * Gets known PollingFrequency values. + * + * @return known PollingFrequency values. + */ + public static Collection values() { + return values(PollingFrequency.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProcessEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProcessEntity.java index d70f30c172e2..9ea4fc5aab2d 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProcessEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProcessEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.ProcessEntityProperties; import java.io.IOException; import java.time.OffsetDateTime; @@ -18,7 +19,7 @@ * Represents a process entity. */ @Fluent -public final class ProcessEntity extends Entity { +public final class ProcessEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageAdditionalProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageAdditionalProperties.java new file mode 100644 index 000000000000..4da791d71a9b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageAdditionalProperties.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * product package additional properties. + */ +@Fluent +public class ProductPackageAdditionalProperties implements JsonSerializable { + /* + * The version of the installed package, null or absent means not installed. + */ + private String installedVersion; + + /* + * The metadata resource id. + */ + private String metadataResourceId; + + /* + * The json of the ARM template to deploy. Expandable. + */ + private Object packagedContent; + + /** + * Creates an instance of ProductPackageAdditionalProperties class. + */ + public ProductPackageAdditionalProperties() { + } + + /** + * Get the installedVersion property: The version of the installed package, null or absent means not installed. + * + * @return the installedVersion value. + */ + public String installedVersion() { + return this.installedVersion; + } + + /** + * Set the installedVersion property: The version of the installed package, null or absent means not installed. + * + * @param installedVersion the installedVersion value to set. + * @return the ProductPackageAdditionalProperties object itself. + */ + public ProductPackageAdditionalProperties withInstalledVersion(String installedVersion) { + this.installedVersion = installedVersion; + return this; + } + + /** + * Get the metadataResourceId property: The metadata resource id. + * + * @return the metadataResourceId value. + */ + public String metadataResourceId() { + return this.metadataResourceId; + } + + /** + * Set the metadataResourceId property: The metadata resource id. + * + * @param metadataResourceId the metadataResourceId value to set. + * @return the ProductPackageAdditionalProperties object itself. + */ + public ProductPackageAdditionalProperties withMetadataResourceId(String metadataResourceId) { + this.metadataResourceId = metadataResourceId; + return this; + } + + /** + * Get the packagedContent property: The json of the ARM template to deploy. Expandable. + * + * @return the packagedContent value. + */ + public Object packagedContent() { + return this.packagedContent; + } + + /** + * Set the packagedContent property: The json of the ARM template to deploy. Expandable. + * + * @param packagedContent the packagedContent value to set. + * @return the ProductPackageAdditionalProperties object itself. + */ + public ProductPackageAdditionalProperties withPackagedContent(Object packagedContent) { + this.packagedContent = packagedContent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("installedVersion", this.installedVersion); + jsonWriter.writeStringField("metadataResourceId", this.metadataResourceId); + jsonWriter.writeUntypedField("packagedContent", this.packagedContent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductPackageAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductPackageAdditionalProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProductPackageAdditionalProperties. + */ + public static ProductPackageAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductPackageAdditionalProperties deserializedProductPackageAdditionalProperties + = new ProductPackageAdditionalProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("installedVersion".equals(fieldName)) { + deserializedProductPackageAdditionalProperties.installedVersion = reader.getString(); + } else if ("metadataResourceId".equals(fieldName)) { + deserializedProductPackageAdditionalProperties.metadataResourceId = reader.getString(); + } else if ("packagedContent".equals(fieldName)) { + deserializedProductPackageAdditionalProperties.packagedContent = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductPackageAdditionalProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageList.java new file mode 100644 index 000000000000..c23ada5a4001 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageList.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; +import java.io.IOException; +import java.util.List; + +/** + * List available packages. + */ +@Fluent +public final class ProductPackageList implements JsonSerializable { + /* + * URL to fetch the next set of packages. + */ + private String nextLink; + + /* + * Array of packages. + */ + private List value; + + /** + * Creates an instance of ProductPackageList class. + */ + public ProductPackageList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of packages. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of packages. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of packages. + * + * @param value the value value to set. + * @return the ProductPackageList object itself. + */ + public ProductPackageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ProductPackageList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ProductPackageList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductPackageList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductPackageList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProductPackageList. + */ + public static ProductPackageList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductPackageList deserializedProductPackageList = new ProductPackageList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProductPackageModelInner.fromJson(reader1)); + deserializedProductPackageList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedProductPackageList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductPackageList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageModel.java new file mode 100644 index 000000000000..c220653449d2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageModel.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner; +import java.time.LocalDate; +import java.util.List; + +/** + * An immutable client-side representation of ProductPackageModel. + */ +public interface ProductPackageModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the installedVersion property: The version of the installed package, null or absent means not installed. + * + * @return the installedVersion value. + */ + String installedVersion(); + + /** + * Gets the metadataResourceId property: The metadata resource id. + * + * @return the metadataResourceId value. + */ + String metadataResourceId(); + + /** + * Gets the packagedContent property: The json of the ARM template to deploy. Expandable. + * + * @return the packagedContent value. + */ + Object packagedContent(); + + /** + * Gets the contentId property: The content id of the package. + * + * @return the contentId value. + */ + String contentId(); + + /** + * Gets the contentProductId property: Unique ID for the content. It should be generated based on the contentId, + * contentKind and the contentVersion of the package. + * + * @return the contentProductId value. + */ + String contentProductId(); + + /** + * Gets the contentKind property: The package kind. + * + * @return the contentKind value. + */ + PackageKind contentKind(); + + /** + * Gets the contentSchemaVersion property: The version of the content schema. + * + * @return the contentSchemaVersion value. + */ + String contentSchemaVersion(); + + /** + * Gets the isNew property: Flag indicates if this is a newly published package. + * + * @return the isNew value. + */ + Flag isNew(); + + /** + * Gets the isPreview property: Flag indicates if this package is in preview. + * + * @return the isPreview value. + */ + Flag isPreview(); + + /** + * Gets the isFeatured property: Flag indicates if this package is among the featured list. + * + * @return the isFeatured value. + */ + Flag isFeatured(); + + /** + * Gets the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + Flag isDeprecated(); + + /** + * Gets the version property: the latest version number of the package. + * + * @return the version value. + */ + String version(); + + /** + * Gets the displayName property: The display name of the package. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: The description of the package. + * + * @return the description value. + */ + String description(); + + /** + * Gets the publisherDisplayName property: The publisher display name of the package. + * + * @return the publisherDisplayName value. + */ + String publisherDisplayName(); + + /** + * Gets the source property: The source of the package. + * + * @return the source value. + */ + MetadataSource source(); + + /** + * Gets the author property: The author of the package. + * + * @return the author value. + */ + MetadataAuthor author(); + + /** + * Gets the support property: The support tier of the package. + * + * @return the support value. + */ + MetadataSupport support(); + + /** + * Gets the dependencies property: The support tier of the package. + * + * @return the dependencies value. + */ + MetadataDependencies dependencies(); + + /** + * Gets the providers property: Providers for the package item. + * + * @return the providers value. + */ + List providers(); + + /** + * Gets the firstPublishDate property: first publish date package item. + * + * @return the firstPublishDate value. + */ + LocalDate firstPublishDate(); + + /** + * Gets the lastPublishDate property: last publish date for the package item. + * + * @return the lastPublishDate value. + */ + LocalDate lastPublishDate(); + + /** + * Gets the categories property: The categories of the package. + * + * @return the categories value. + */ + MetadataCategories categories(); + + /** + * Gets the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + List threatAnalysisTactics(); + + /** + * Gets the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + List threatAnalysisTechniques(); + + /** + * Gets the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.ProductPackageModelInner object. + * + * @return the inner object. + */ + ProductPackageModelInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageOperations.java new file mode 100644 index 000000000000..ba71acc841ed --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackageOperations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ProductPackageOperations. + */ +public interface ProductPackageOperations { + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String packageId, + Context context); + + /** + * Gets a package by its identifier from the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param packageId package Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a package by its identifier from the catalog. + */ + ProductPackageModel get(String resourceGroupName, String workspaceName, String packageId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackages.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackages.java new file mode 100644 index 000000000000..ab8867c2ac59 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductPackages.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of ProductPackages. + */ +public interface ProductPackages { + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param search Searches for a substring in the response. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all packages from the catalog. + * Expandable properties: + * - properties/installed + * - properties/packagedContent as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, Integer top, String skipToken, String search, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductSettings.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductSettings.java new file mode 100644 index 000000000000..d2a29f896a0b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductSettings.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; + +/** + * Resource collection API of ProductSettings. + */ +public interface ProductSettings { + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * List of all the settings. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of all the settings as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context); + + /** + * Gets a setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a setting. + */ + Settings get(String resourceGroupName, String workspaceName, String settingsName); + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String settingsName, + Context context); + + /** + * Delete setting of the product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String settingsName); + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting along with {@link Response}. + */ + Response updateWithResponse(String resourceGroupName, String workspaceName, String settingsName, + SettingsInner settings, Context context); + + /** + * Updates setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param settingsName The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba. + * @param settings The setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Setting. + */ + Settings update(String resourceGroupName, String workspaceName, String settingsName, SettingsInner settings); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateAdditionalProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateAdditionalProperties.java new file mode 100644 index 000000000000..64b8c67399e0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateAdditionalProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * additional properties of product template. + */ +@Fluent +public class ProductTemplateAdditionalProperties implements JsonSerializable { + /* + * The json of the ARM template to deploy + */ + private Object packagedContent; + + /** + * Creates an instance of ProductTemplateAdditionalProperties class. + */ + public ProductTemplateAdditionalProperties() { + } + + /** + * Get the packagedContent property: The json of the ARM template to deploy. + * + * @return the packagedContent value. + */ + public Object packagedContent() { + return this.packagedContent; + } + + /** + * Set the packagedContent property: The json of the ARM template to deploy. + * + * @param packagedContent the packagedContent value to set. + * @return the ProductTemplateAdditionalProperties object itself. + */ + public ProductTemplateAdditionalProperties withPackagedContent(Object packagedContent) { + this.packagedContent = packagedContent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeUntypedField("packagedContent", this.packagedContent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductTemplateAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductTemplateAdditionalProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProductTemplateAdditionalProperties. + */ + public static ProductTemplateAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductTemplateAdditionalProperties deserializedProductTemplateAdditionalProperties + = new ProductTemplateAdditionalProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("packagedContent".equals(fieldName)) { + deserializedProductTemplateAdditionalProperties.packagedContent = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductTemplateAdditionalProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateList.java new file mode 100644 index 000000000000..41f3da96c998 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateList.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the template. + */ +@Fluent +public final class ProductTemplateList implements JsonSerializable { + /* + * Array of templates. + */ + private List value; + + /* + * URL to fetch the next page of template. + */ + private String nextLink; + + /** + * Creates an instance of ProductTemplateList class. + */ + public ProductTemplateList() { + } + + /** + * Get the value property: Array of templates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of templates. + * + * @param value the value value to set. + * @return the ProductTemplateList object itself. + */ + public ProductTemplateList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to fetch the next page of template. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ProductTemplateList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ProductTemplateList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProductTemplateList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProductTemplateList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProductTemplateList. + */ + public static ProductTemplateList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProductTemplateList deserializedProductTemplateList = new ProductTemplateList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ProductTemplateModelInner.fromJson(reader1)); + deserializedProductTemplateList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedProductTemplateList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProductTemplateList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateModel.java new file mode 100644 index 000000000000..b170063131d0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateModel.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner; +import java.time.LocalDate; +import java.util.List; + +/** + * An immutable client-side representation of ProductTemplateModel. + */ +public interface ProductTemplateModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the packagedContent property: The json of the ARM template to deploy. + * + * @return the packagedContent value. + */ + Object packagedContent(); + + /** + * Gets the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + String contentId(); + + /** + * Gets the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @return the contentProductId value. + */ + String contentProductId(); + + /** + * Gets the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @return the packageVersion value. + */ + String packageVersion(); + + /** + * Gets the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + String version(); + + /** + * Gets the displayName property: The display name of the template. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the contentKind property: The kind of content the template is for. + * + * @return the contentKind value. + */ + Kind contentKind(); + + /** + * Gets the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + MetadataSource source(); + + /** + * Gets the author property: The creator of the content item. + * + * @return the author value. + */ + MetadataAuthor author(); + + /** + * Gets the support property: Support information for the template - type, name, contact information. + * + * @return the support value. + */ + MetadataSupport support(); + + /** + * Gets the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + MetadataDependencies dependencies(); + + /** + * Gets the categories property: Categories for the item. + * + * @return the categories value. + */ + MetadataCategories categories(); + + /** + * Gets the providers property: Providers for the content item. + * + * @return the providers value. + */ + List providers(); + + /** + * Gets the firstPublishDate property: first publish date content item. + * + * @return the firstPublishDate value. + */ + LocalDate firstPublishDate(); + + /** + * Gets the lastPublishDate property: last publish date for the content item. + * + * @return the lastPublishDate value. + */ + LocalDate lastPublishDate(); + + /** + * Gets the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + String customVersion(); + + /** + * Gets the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + String contentSchemaVersion(); + + /** + * Gets the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + List threatAnalysisTactics(); + + /** + * Gets the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + List threatAnalysisTechniques(); + + /** + * Gets the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + List previewImages(); + + /** + * Gets the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + List previewImagesDark(); + + /** + * Gets the packageId property: the package Id contains this template. + * + * @return the packageId value. + */ + String packageId(); + + /** + * Gets the packageKind property: the packageKind of the package contains this template. + * + * @return the packageKind value. + */ + PackageKind packageKind(); + + /** + * Gets the packageName property: the name of the package contains this template. + * + * @return the packageName value. + */ + String packageName(); + + /** + * Gets the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + Flag isDeprecated(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.ProductTemplateModelInner object. + * + * @return the inner object. + */ + ProductTemplateModelInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateOperations.java new file mode 100644 index 000000000000..48589ed54c9b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplateOperations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ProductTemplateOperations. + */ +public interface ProductTemplateOperations { + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String templateId, + Context context); + + /** + * Gets a template by its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param templateId template Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a template by its identifier. + */ + ProductTemplateModel get(String resourceGroupName, String workspaceName, String templateId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplates.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplates.java new file mode 100644 index 000000000000..bc97d127f467 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProductTemplates.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of ProductTemplates. + */ +public interface ProductTemplates { + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all templates in the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param orderby Sorts the results. Optional. + * @param search Searches for a substring in the response. Optional. + * @param count Instructs the server to return only object count without actual body. Optional. + * @param top Returns only the first n results. Optional. + * @param skip Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results + * if there are any left. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all templates in the catalog as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String filter, + String orderby, String search, Boolean count, Integer top, Integer skip, String skipToken, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PropertyArrayConditionProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PropertyArrayConditionProperties.java new file mode 100644 index 000000000000..de1d8cd412b9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PropertyArrayConditionProperties.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes an automation rule condition that evaluates an array property's value. + */ +@Fluent +public final class PropertyArrayConditionProperties extends AutomationRuleCondition { + /* + * The conditionType property. + */ + private ConditionType conditionType = ConditionType.PROPERTY_ARRAY; + + /* + * The conditionProperties property. + */ + private AutomationRulePropertyArrayValuesCondition conditionProperties; + + /** + * Creates an instance of PropertyArrayConditionProperties class. + */ + public PropertyArrayConditionProperties() { + } + + /** + * Get the conditionType property: The conditionType property. + * + * @return the conditionType value. + */ + @Override + public ConditionType conditionType() { + return this.conditionType; + } + + /** + * Get the conditionProperties property: The conditionProperties property. + * + * @return the conditionProperties value. + */ + public AutomationRulePropertyArrayValuesCondition conditionProperties() { + return this.conditionProperties; + } + + /** + * Set the conditionProperties property: The conditionProperties property. + * + * @param conditionProperties the conditionProperties value to set. + * @return the PropertyArrayConditionProperties object itself. + */ + public PropertyArrayConditionProperties + withConditionProperties(AutomationRulePropertyArrayValuesCondition conditionProperties) { + this.conditionProperties = conditionProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (conditionProperties() != null) { + conditionProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("conditionType", this.conditionType == null ? null : this.conditionType.toString()); + jsonWriter.writeJsonField("conditionProperties", this.conditionProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyArrayConditionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyArrayConditionProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PropertyArrayConditionProperties. + */ + public static PropertyArrayConditionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertyArrayConditionProperties deserializedPropertyArrayConditionProperties + = new PropertyArrayConditionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("conditionType".equals(fieldName)) { + deserializedPropertyArrayConditionProperties.conditionType + = ConditionType.fromString(reader.getString()); + } else if ("conditionProperties".equals(fieldName)) { + deserializedPropertyArrayConditionProperties.conditionProperties + = AutomationRulePropertyArrayValuesCondition.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPropertyArrayConditionProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProviderName.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProviderName.java new file mode 100644 index 000000000000..72d7e6b4c751 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProviderName.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provider name. + */ +public final class ProviderName extends ExpandableStringEnum { + /** + * Static value Microsoft.OperationalInsights/solutions for ProviderName. + */ + public static final ProviderName MICROSOFT_OPERATIONAL_INSIGHTS_SOLUTIONS + = fromString("Microsoft.OperationalInsights/solutions"); + + /** + * Static value Microsoft.OperationalInsights/workspaces for ProviderName. + */ + public static final ProviderName MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES + = fromString("Microsoft.OperationalInsights/workspaces"); + + /** + * Static value Microsoft.OperationalInsights/workspaces/datasources for ProviderName. + */ + public static final ProviderName MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES_DATASOURCES + = fromString("Microsoft.OperationalInsights/workspaces/datasources"); + + /** + * Static value microsoft.aadiam/diagnosticSettings for ProviderName. + */ + public static final ProviderName MICROSOFT_AADIAM_DIAGNOSTIC_SETTINGS + = fromString("microsoft.aadiam/diagnosticSettings"); + + /** + * Static value Microsoft.OperationalInsights/workspaces/sharedKeys for ProviderName. + */ + public static final ProviderName MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES_SHARED_KEYS + = fromString("Microsoft.OperationalInsights/workspaces/sharedKeys"); + + /** + * Static value Microsoft.Authorization/policyAssignments for ProviderName. + */ + public static final ProviderName MICROSOFT_AUTHORIZATION_POLICY_ASSIGNMENTS + = fromString("Microsoft.Authorization/policyAssignments"); + + /** + * Creates a new instance of ProviderName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProviderName() { + } + + /** + * Creates or finds a ProviderName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProviderName. + */ + public static ProviderName fromString(String name) { + return fromString(name, ProviderName.class); + } + + /** + * Gets known ProviderName values. + * + * @return known ProviderName values. + */ + public static Collection values() { + return values(ProviderName.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProviderPermissionsScope.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProviderPermissionsScope.java new file mode 100644 index 000000000000..52296187ce0d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProviderPermissionsScope.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The scope on which the user should have permissions, in order to be able to create connections. + */ +public final class ProviderPermissionsScope extends ExpandableStringEnum { + /** + * Static value Subscription for ProviderPermissionsScope. + */ + public static final ProviderPermissionsScope SUBSCRIPTION = fromString("Subscription"); + + /** + * Static value ResourceGroup for ProviderPermissionsScope. + */ + public static final ProviderPermissionsScope RESOURCE_GROUP = fromString("ResourceGroup"); + + /** + * Static value Workspace for ProviderPermissionsScope. + */ + public static final ProviderPermissionsScope WORKSPACE = fromString("Workspace"); + + /** + * Creates a new instance of ProviderPermissionsScope value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProviderPermissionsScope() { + } + + /** + * Creates or finds a ProviderPermissionsScope from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProviderPermissionsScope. + */ + public static ProviderPermissionsScope fromString(String name) { + return fromString(name, ProviderPermissionsScope.class); + } + + /** + * Gets known ProviderPermissionsScope values. + * + * @return known ProviderPermissionsScope values. + */ + public static Collection values() { + return values(ProviderPermissionsScope.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProvisioningState.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProvisioningState.java new file mode 100644 index 000000000000..29663ef8c9ce --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ProvisioningState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The triggered analytics rule run provisioning state. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Static value InProgress for ProvisioningState. + */ + public static final ProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PullRequest.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PullRequest.java new file mode 100644 index 000000000000..44e302658f7b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PullRequest.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information regarding pull request for protected branches. + */ +@Immutable +public final class PullRequest implements JsonSerializable { + /* + * URL of pull request + */ + private String url; + + /* + * State of the pull request + */ + private State state; + + /** + * Creates an instance of PullRequest class. + */ + public PullRequest() { + } + + /** + * Get the url property: URL of pull request. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Get the state property: State of the pull request. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PullRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PullRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PullRequest. + */ + public static PullRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PullRequest deserializedPullRequest = new PullRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("url".equals(fieldName)) { + deserializedPullRequest.url = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedPullRequest.state = State.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPullRequest; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditCheckRequirements.java new file mode 100644 index 000000000000..4dab14fe7ed6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditCheckRequirements.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.PurviewAuditCheckRequirementsProperties; +import java.io.IOException; + +/** + * Represents PurviewAudit requirements check request. + */ +@Fluent +public final class PurviewAuditCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.PURVIEW_AUDIT; + + /* + * PurviewAudit requirements check properties. + */ + private PurviewAuditCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of PurviewAuditCheckRequirements class. + */ + public PurviewAuditCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: PurviewAudit requirements check properties. + * + * @return the innerProperties value. + */ + PurviewAuditCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the PurviewAuditCheckRequirements object itself. + */ + public PurviewAuditCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new PurviewAuditCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PurviewAuditCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PurviewAuditCheckRequirements if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PurviewAuditCheckRequirements. + */ + public static PurviewAuditCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PurviewAuditCheckRequirements deserializedPurviewAuditCheckRequirements + = new PurviewAuditCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedPurviewAuditCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedPurviewAuditCheckRequirements.innerProperties + = PurviewAuditCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPurviewAuditCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditConnectorDataTypes.java new file mode 100644 index 000000000000..897a0bd84344 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditConnectorDataTypes.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for PurviewAudit data connector. + */ +@Fluent +public final class PurviewAuditConnectorDataTypes implements JsonSerializable { + /* + * Logs data type. + */ + private PurviewAuditConnectorDataTypesLogs logs; + + /** + * Creates an instance of PurviewAuditConnectorDataTypes class. + */ + public PurviewAuditConnectorDataTypes() { + } + + /** + * Get the logs property: Logs data type. + * + * @return the logs value. + */ + public PurviewAuditConnectorDataTypesLogs logs() { + return this.logs; + } + + /** + * Set the logs property: Logs data type. + * + * @param logs the logs value to set. + * @return the PurviewAuditConnectorDataTypes object itself. + */ + public PurviewAuditConnectorDataTypes withLogs(PurviewAuditConnectorDataTypesLogs logs) { + this.logs = logs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logs() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property logs in model PurviewAuditConnectorDataTypes")); + } else { + logs().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PurviewAuditConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("logs", this.logs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PurviewAuditConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PurviewAuditConnectorDataTypes if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PurviewAuditConnectorDataTypes. + */ + public static PurviewAuditConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PurviewAuditConnectorDataTypes deserializedPurviewAuditConnectorDataTypes + = new PurviewAuditConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logs".equals(fieldName)) { + deserializedPurviewAuditConnectorDataTypes.logs + = PurviewAuditConnectorDataTypesLogs.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPurviewAuditConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditConnectorDataTypesLogs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditConnectorDataTypesLogs.java new file mode 100644 index 000000000000..acb2b6779e1d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditConnectorDataTypesLogs.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Logs data type. + */ +@Fluent +public final class PurviewAuditConnectorDataTypesLogs extends DataConnectorDataTypeCommon { + /** + * Creates an instance of PurviewAuditConnectorDataTypesLogs class. + */ + public PurviewAuditConnectorDataTypesLogs() { + } + + /** + * {@inheritDoc} + */ + @Override + public PurviewAuditConnectorDataTypesLogs withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model PurviewAuditConnectorDataTypesLogs")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PurviewAuditConnectorDataTypesLogs.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PurviewAuditConnectorDataTypesLogs from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PurviewAuditConnectorDataTypesLogs if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PurviewAuditConnectorDataTypesLogs. + */ + public static PurviewAuditConnectorDataTypesLogs fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PurviewAuditConnectorDataTypesLogs deserializedPurviewAuditConnectorDataTypesLogs + = new PurviewAuditConnectorDataTypesLogs(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedPurviewAuditConnectorDataTypesLogs + .withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedPurviewAuditConnectorDataTypesLogs; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditDataConnector.java new file mode 100644 index 000000000000..2c9b4b0a055d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/PurviewAuditDataConnector.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.PurviewAuditDataConnectorProperties; +import java.io.IOException; + +/** + * Represents PurviewAudit data connector. + */ +@Fluent +public final class PurviewAuditDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.PURVIEW_AUDIT; + + /* + * PurviewAudit data connector properties. + */ + private PurviewAuditDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PurviewAuditDataConnector class. + */ + public PurviewAuditDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: PurviewAudit data connector properties. + * + * @return the innerProperties value. + */ + private PurviewAuditDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public PurviewAuditDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @return the connectorDefinitionName value. + */ + public String connectorDefinitionName() { + return this.innerProperties() == null ? null : this.innerProperties().connectorDefinitionName(); + } + + /** + * Set the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @param connectorDefinitionName the connectorDefinitionName value to set. + * @return the PurviewAuditDataConnector object itself. + */ + public PurviewAuditDataConnector withConnectorDefinitionName(String connectorDefinitionName) { + if (this.innerProperties() == null) { + this.innerProperties = new PurviewAuditDataConnectorProperties(); + } + this.innerProperties().withConnectorDefinitionName(connectorDefinitionName); + return this; + } + + /** + * Get the sourceType property: The source type indicates which kind of data is relevant for this connector. + * + * @return the sourceType value. + */ + public String sourceType() { + return this.innerProperties() == null ? null : this.innerProperties().sourceType(); + } + + /** + * Set the sourceType property: The source type indicates which kind of data is relevant for this connector. + * + * @param sourceType the sourceType value to set. + * @return the PurviewAuditDataConnector object itself. + */ + public PurviewAuditDataConnector withSourceType(String sourceType) { + if (this.innerProperties() == null) { + this.innerProperties = new PurviewAuditDataConnectorProperties(); + } + this.innerProperties().withSourceType(sourceType); + return this; + } + + /** + * Get the dcrConfig property: The DCR related properties. + * + * @return the dcrConfig value. + */ + public DcrConfiguration dcrConfig() { + return this.innerProperties() == null ? null : this.innerProperties().dcrConfig(); + } + + /** + * Set the dcrConfig property: The DCR related properties. + * + * @param dcrConfig the dcrConfig value to set. + * @return the PurviewAuditDataConnector object itself. + */ + public PurviewAuditDataConnector withDcrConfig(DcrConfiguration dcrConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new PurviewAuditDataConnectorProperties(); + } + this.innerProperties().withDcrConfig(dcrConfig); + return this; + } + + /** + * Get the dataTypes property: The available data types for the connector. + * + * @return the dataTypes value. + */ + public PurviewAuditConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for the connector. + * + * @param dataTypes the dataTypes value to set. + * @return the PurviewAuditDataConnector object itself. + */ + public PurviewAuditDataConnector withDataTypes(PurviewAuditConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new PurviewAuditDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the PurviewAuditDataConnector object itself. + */ + public PurviewAuditDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new PurviewAuditDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PurviewAuditDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PurviewAuditDataConnector if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PurviewAuditDataConnector. + */ + public static PurviewAuditDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PurviewAuditDataConnector deserializedPurviewAuditDataConnector = new PurviewAuditDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPurviewAuditDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPurviewAuditDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPurviewAuditDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedPurviewAuditDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedPurviewAuditDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedPurviewAuditDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedPurviewAuditDataConnector.innerProperties + = PurviewAuditDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPurviewAuditDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Query.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Query.java new file mode 100644 index 000000000000..81fe5d1f08f1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Query.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a query to run on the TI objects in the workspace. + */ +@Fluent +public final class Query implements JsonSerializable { + /* + * Represents a condition used to query for TI objects. + */ + private QueryCondition condition; + + /* + * Specifies how to sort the query results. + */ + private QuerySortBy sortBy; + + /* + * Represents the maximum size of the page that will be returned from the query API. + */ + private Integer maxPageSize; + + /* + * Represents the minimum size of the page that will be returned from the query API. + */ + private Integer minPageSize; + + /** + * Creates an instance of Query class. + */ + public Query() { + } + + /** + * Get the condition property: Represents a condition used to query for TI objects. + * + * @return the condition value. + */ + public QueryCondition condition() { + return this.condition; + } + + /** + * Set the condition property: Represents a condition used to query for TI objects. + * + * @param condition the condition value to set. + * @return the Query object itself. + */ + public Query withCondition(QueryCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the sortBy property: Specifies how to sort the query results. + * + * @return the sortBy value. + */ + public QuerySortBy sortBy() { + return this.sortBy; + } + + /** + * Set the sortBy property: Specifies how to sort the query results. + * + * @param sortBy the sortBy value to set. + * @return the Query object itself. + */ + public Query withSortBy(QuerySortBy sortBy) { + this.sortBy = sortBy; + return this; + } + + /** + * Get the maxPageSize property: Represents the maximum size of the page that will be returned from the query API. + * + * @return the maxPageSize value. + */ + public Integer maxPageSize() { + return this.maxPageSize; + } + + /** + * Set the maxPageSize property: Represents the maximum size of the page that will be returned from the query API. + * + * @param maxPageSize the maxPageSize value to set. + * @return the Query object itself. + */ + public Query withMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + return this; + } + + /** + * Get the minPageSize property: Represents the minimum size of the page that will be returned from the query API. + * + * @return the minPageSize value. + */ + public Integer minPageSize() { + return this.minPageSize; + } + + /** + * Set the minPageSize property: Represents the minimum size of the page that will be returned from the query API. + * + * @param minPageSize the minPageSize value to set. + * @return the Query object itself. + */ + public Query withMinPageSize(Integer minPageSize) { + this.minPageSize = minPageSize; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (condition() != null) { + condition().validate(); + } + if (sortBy() != null) { + sortBy().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("condition", this.condition); + jsonWriter.writeJsonField("sortBy", this.sortBy); + jsonWriter.writeNumberField("maxPageSize", this.maxPageSize); + jsonWriter.writeNumberField("minPageSize", this.minPageSize); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Query from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Query if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Query. + */ + public static Query fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Query deserializedQuery = new Query(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("condition".equals(fieldName)) { + deserializedQuery.condition = QueryCondition.fromJson(reader); + } else if ("sortBy".equals(fieldName)) { + deserializedQuery.sortBy = QuerySortBy.fromJson(reader); + } else if ("maxPageSize".equals(fieldName)) { + deserializedQuery.maxPageSize = reader.getNullable(JsonReader::getInt); + } else if ("minPageSize".equals(fieldName)) { + deserializedQuery.minPageSize = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedQuery; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QueryBasedAlertRuleTemplateProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QueryBasedAlertRuleTemplateProperties.java new file mode 100644 index 000000000000..b8980c4f88da --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QueryBasedAlertRuleTemplateProperties.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Query based alert rule template base property bag. + */ +@Fluent +public class QueryBasedAlertRuleTemplateProperties implements JsonSerializable { + /* + * The query that creates alerts for this rule. + */ + private String query; + + /* + * The severity for alerts created by this alert rule. + */ + private AlertSeverity severity; + + /* + * The version of this template - in format , where all are numbers. For example <1.0.2>. + */ + private String version; + + /* + * Dictionary of string key-value pairs of columns to be attached to the alert + */ + private Map customDetails; + + /* + * Array of the entity mappings of the alert rule + */ + private List entityMappings; + + /* + * The alert details override settings + */ + private AlertDetailsOverride alertDetailsOverride; + + /* + * The event grouping settings. + */ + private EventGroupingSettings eventGroupingSettings; + + /* + * Array of the sentinel entity mappings of the alert rule + */ + private List sentinelEntitiesMappings; + + /** + * Creates an instance of QueryBasedAlertRuleTemplateProperties class. + */ + public QueryBasedAlertRuleTemplateProperties() { + } + + /** + * Get the query property: The query that creates alerts for this rule. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The query that creates alerts for this rule. + * + * @param query the query value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the version property: The version of this template - in format <a.b.c>, where all are numbers. For + * example <1.0.2>. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of this template - in format <a.b.c>, where all are numbers. For + * example <1.0.2>. + * + * @param version the version value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @return the customDetails value. + */ + public Map customDetails() { + return this.customDetails; + } + + /** + * Set the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert. + * + * @param customDetails the customDetails value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties withCustomDetails(Map customDetails) { + this.customDetails = customDetails; + return this; + } + + /** + * Get the entityMappings property: Array of the entity mappings of the alert rule. + * + * @return the entityMappings value. + */ + public List entityMappings() { + return this.entityMappings; + } + + /** + * Set the entityMappings property: Array of the entity mappings of the alert rule. + * + * @param entityMappings the entityMappings value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties withEntityMappings(List entityMappings) { + this.entityMappings = entityMappings; + return this; + } + + /** + * Get the alertDetailsOverride property: The alert details override settings. + * + * @return the alertDetailsOverride value. + */ + public AlertDetailsOverride alertDetailsOverride() { + return this.alertDetailsOverride; + } + + /** + * Set the alertDetailsOverride property: The alert details override settings. + * + * @param alertDetailsOverride the alertDetailsOverride value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties withAlertDetailsOverride(AlertDetailsOverride alertDetailsOverride) { + this.alertDetailsOverride = alertDetailsOverride; + return this; + } + + /** + * Get the eventGroupingSettings property: The event grouping settings. + * + * @return the eventGroupingSettings value. + */ + public EventGroupingSettings eventGroupingSettings() { + return this.eventGroupingSettings; + } + + /** + * Set the eventGroupingSettings property: The event grouping settings. + * + * @param eventGroupingSettings the eventGroupingSettings value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties + withEventGroupingSettings(EventGroupingSettings eventGroupingSettings) { + this.eventGroupingSettings = eventGroupingSettings; + return this; + } + + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.sentinelEntitiesMappings; + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the QueryBasedAlertRuleTemplateProperties object itself. + */ + public QueryBasedAlertRuleTemplateProperties + withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + this.sentinelEntitiesMappings = sentinelEntitiesMappings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (entityMappings() != null) { + entityMappings().forEach(e -> e.validate()); + } + if (alertDetailsOverride() != null) { + alertDetailsOverride().validate(); + } + if (eventGroupingSettings() != null) { + eventGroupingSettings().validate(); + } + if (sentinelEntitiesMappings() != null) { + sentinelEntitiesMappings().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeMapField("customDetails", this.customDetails, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("entityMappings", this.entityMappings, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("alertDetailsOverride", this.alertDetailsOverride); + jsonWriter.writeJsonField("eventGroupingSettings", this.eventGroupingSettings); + jsonWriter.writeArrayField("sentinelEntitiesMappings", this.sentinelEntitiesMappings, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryBasedAlertRuleTemplateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryBasedAlertRuleTemplateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the QueryBasedAlertRuleTemplateProperties. + */ + public static QueryBasedAlertRuleTemplateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryBasedAlertRuleTemplateProperties deserializedQueryBasedAlertRuleTemplateProperties + = new QueryBasedAlertRuleTemplateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("query".equals(fieldName)) { + deserializedQueryBasedAlertRuleTemplateProperties.query = reader.getString(); + } else if ("severity".equals(fieldName)) { + deserializedQueryBasedAlertRuleTemplateProperties.severity + = AlertSeverity.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedQueryBasedAlertRuleTemplateProperties.version = reader.getString(); + } else if ("customDetails".equals(fieldName)) { + Map customDetails = reader.readMap(reader1 -> reader1.getString()); + deserializedQueryBasedAlertRuleTemplateProperties.customDetails = customDetails; + } else if ("entityMappings".equals(fieldName)) { + List entityMappings = reader.readArray(reader1 -> EntityMapping.fromJson(reader1)); + deserializedQueryBasedAlertRuleTemplateProperties.entityMappings = entityMappings; + } else if ("alertDetailsOverride".equals(fieldName)) { + deserializedQueryBasedAlertRuleTemplateProperties.alertDetailsOverride + = AlertDetailsOverride.fromJson(reader); + } else if ("eventGroupingSettings".equals(fieldName)) { + deserializedQueryBasedAlertRuleTemplateProperties.eventGroupingSettings + = EventGroupingSettings.fromJson(reader); + } else if ("sentinelEntitiesMappings".equals(fieldName)) { + List sentinelEntitiesMappings + = reader.readArray(reader1 -> SentinelEntityMapping.fromJson(reader1)); + deserializedQueryBasedAlertRuleTemplateProperties.sentinelEntitiesMappings + = sentinelEntitiesMappings; + } else { + reader.skipChildren(); + } + } + + return deserializedQueryBasedAlertRuleTemplateProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QueryCondition.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QueryCondition.java new file mode 100644 index 000000000000..2d8258aebed4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QueryCondition.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a condition used to query for TI objects. + */ +@Fluent +public final class QueryCondition implements JsonSerializable { + /* + * The STIX type for the objects returned by this query. + */ + private String stixObjectType; + + /* + * The list of clauses to be evaluated in disjunction or conjunction base on the specified top level connective + * operator. + */ + private List clauses; + + /* + * The top level connective operator for this condition. + */ + private Connective conditionConnective; + + /** + * Creates an instance of QueryCondition class. + */ + public QueryCondition() { + } + + /** + * Get the stixObjectType property: The STIX type for the objects returned by this query. + * + * @return the stixObjectType value. + */ + public String stixObjectType() { + return this.stixObjectType; + } + + /** + * Set the stixObjectType property: The STIX type for the objects returned by this query. + * + * @param stixObjectType the stixObjectType value to set. + * @return the QueryCondition object itself. + */ + public QueryCondition withStixObjectType(String stixObjectType) { + this.stixObjectType = stixObjectType; + return this; + } + + /** + * Get the clauses property: The list of clauses to be evaluated in disjunction or conjunction base on the specified + * top level connective operator. + * + * @return the clauses value. + */ + public List clauses() { + return this.clauses; + } + + /** + * Set the clauses property: The list of clauses to be evaluated in disjunction or conjunction base on the specified + * top level connective operator. + * + * @param clauses the clauses value to set. + * @return the QueryCondition object itself. + */ + public QueryCondition withClauses(List clauses) { + this.clauses = clauses; + return this; + } + + /** + * Get the conditionConnective property: The top level connective operator for this condition. + * + * @return the conditionConnective value. + */ + public Connective conditionConnective() { + return this.conditionConnective; + } + + /** + * Set the conditionConnective property: The top level connective operator for this condition. + * + * @param conditionConnective the conditionConnective value to set. + * @return the QueryCondition object itself. + */ + public QueryCondition withConditionConnective(Connective conditionConnective) { + this.conditionConnective = conditionConnective; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (clauses() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property clauses in model QueryCondition")); + } else { + clauses().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(QueryCondition.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("clauses", this.clauses, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("stixObjectType", this.stixObjectType); + jsonWriter.writeStringField("conditionConnective", + this.conditionConnective == null ? null : this.conditionConnective.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QueryCondition from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QueryCondition if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the QueryCondition. + */ + public static QueryCondition fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QueryCondition deserializedQueryCondition = new QueryCondition(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clauses".equals(fieldName)) { + List clauses = reader.readArray(reader1 -> ConditionClause.fromJson(reader1)); + deserializedQueryCondition.clauses = clauses; + } else if ("stixObjectType".equals(fieldName)) { + deserializedQueryCondition.stixObjectType = reader.getString(); + } else if ("conditionConnective".equals(fieldName)) { + deserializedQueryCondition.conditionConnective = Connective.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedQueryCondition; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QuerySortBy.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QuerySortBy.java new file mode 100644 index 000000000000..321ca9d12524 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/QuerySortBy.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies how to sort the query results. + */ +@Fluent +public final class QuerySortBy implements JsonSerializable { + /* + * The direction to sort the results by. + */ + private SortingDirection direction; + + /* + * Represents the field to sort the results by. + */ + private String field; + + /** + * Creates an instance of QuerySortBy class. + */ + public QuerySortBy() { + } + + /** + * Get the direction property: The direction to sort the results by. + * + * @return the direction value. + */ + public SortingDirection direction() { + return this.direction; + } + + /** + * Set the direction property: The direction to sort the results by. + * + * @param direction the direction value to set. + * @return the QuerySortBy object itself. + */ + public QuerySortBy withDirection(SortingDirection direction) { + this.direction = direction; + return this; + } + + /** + * Get the field property: Represents the field to sort the results by. + * + * @return the field value. + */ + public String field() { + return this.field; + } + + /** + * Set the field property: Represents the field to sort the results by. + * + * @param field the field value to set. + * @return the QuerySortBy object itself. + */ + public QuerySortBy withField(String field) { + this.field = field; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("direction", this.direction == null ? null : this.direction.toString()); + jsonWriter.writeStringField("field", this.field); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QuerySortBy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuerySortBy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the QuerySortBy. + */ + public static QuerySortBy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuerySortBy deserializedQuerySortBy = new QuerySortBy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("direction".equals(fieldName)) { + deserializedQuerySortBy.direction = SortingDirection.fromString(reader.getString()); + } else if ("field".equals(fieldName)) { + deserializedQuerySortBy.field = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedQuerySortBy; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Recommendation.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Recommendation.java new file mode 100644 index 000000000000..a4e1cf43660d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Recommendation.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * An immutable client-side representation of Recommendation. + */ +public interface Recommendation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the recommendationTypeId property: Id of the recommendation type. + * + * @return the recommendationTypeId value. + */ + String recommendationTypeId(); + + /** + * Gets the state property: State of the recommendation. + * + * @return the state value. + */ + State state(); + + /** + * Gets the title property: Title of the recommendation. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: Description of the recommendation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the creationTimeUtc property: The time stamp (UTC) when the recommendation was created. + * + * @return the creationTimeUtc value. + */ + OffsetDateTime creationTimeUtc(); + + /** + * Gets the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @return the lastEvaluatedTimeUtc value. + */ + OffsetDateTime lastEvaluatedTimeUtc(); + + /** + * Gets the lastModifiedTimeUtc property: The time stamp (UTC) when the recommendation was last modified. + * + * @return the lastModifiedTimeUtc value. + */ + OffsetDateTime lastModifiedTimeUtc(); + + /** + * Gets the suggestions property: List of suggestions to take for this recommendation. + * + * @return the suggestions value. + */ + List suggestions(); + + /** + * Gets the resourceId property: Id of the resource this recommendation refers to. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the additionalProperties property: Collection of additional properties for the recommendation. + * + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner object. + * + * @return the inner object. + */ + RecommendationInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationList.java new file mode 100644 index 000000000000..f733409e5711 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationList.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.RecommendationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of recommendations. + */ +@Fluent +public final class RecommendationList implements JsonSerializable { + /* + * An list of recommendations + */ + private List value; + + /* + * Link to next page of resources. + */ + private String nextLink; + + /** + * Creates an instance of RecommendationList class. + */ + public RecommendationList() { + } + + /** + * Get the value property: An list of recommendations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An list of recommendations. + * + * @param value the value value to set. + * @return the RecommendationList object itself. + */ + public RecommendationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model RecommendationList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendationList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecommendationList. + */ + public static RecommendationList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationList deserializedRecommendationList = new RecommendationList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RecommendationInner.fromJson(reader1)); + deserializedRecommendationList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRecommendationList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationPatch.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationPatch.java new file mode 100644 index 000000000000..fa064f2440d5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationPatch.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Recommendation Fields to update. + */ +@Fluent +public final class RecommendationPatch implements JsonSerializable { + /* + * Recommendation Fields Properties to update. + */ + private RecommendationPatchProperties properties; + + /** + * Creates an instance of RecommendationPatch class. + */ + public RecommendationPatch() { + } + + /** + * Get the properties property: Recommendation Fields Properties to update. + * + * @return the properties value. + */ + public RecommendationPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Recommendation Fields Properties to update. + * + * @param properties the properties value to set. + * @return the RecommendationPatch object itself. + */ + public RecommendationPatch withProperties(RecommendationPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationPatch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RecommendationPatch. + */ + public static RecommendationPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationPatch deserializedRecommendationPatch = new RecommendationPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRecommendationPatch.properties = RecommendationPatchProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationPatch; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationPatchProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationPatchProperties.java new file mode 100644 index 000000000000..c2baee5f6c3b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendationPatchProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Recommendation Fields Properties to update. + */ +@Fluent +public final class RecommendationPatchProperties implements JsonSerializable { + /* + * State of the recommendation. + */ + private State state; + + /** + * Creates an instance of RecommendationPatchProperties class. + */ + public RecommendationPatchProperties() { + } + + /** + * Get the state property: State of the recommendation. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: State of the recommendation. + * + * @param state the state value to set. + * @return the RecommendationPatchProperties object itself. + */ + public RecommendationPatchProperties withState(State state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationPatchProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecommendationPatchProperties. + */ + public static RecommendationPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationPatchProperties deserializedRecommendationPatchProperties + = new RecommendationPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedRecommendationPatchProperties.state = State.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationPatchProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendedSuggestion.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendedSuggestion.java new file mode 100644 index 000000000000..e9091b94fe5e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RecommendedSuggestion.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * What suggestions should be taken to complete the recommendation. + */ +@Fluent +public final class RecommendedSuggestion implements JsonSerializable { + /* + * Id of the suggestion type. + */ + private String suggestionTypeId; + + /* + * Title of the suggestion. + */ + private String title; + + /* + * Description of the suggestion. + */ + private String description; + + /* + * Action of the suggestion. + */ + private String action; + + /* + * Collection of additional properties for the suggestion. + */ + private Map additionalProperties; + + /** + * Creates an instance of RecommendedSuggestion class. + */ + public RecommendedSuggestion() { + } + + /** + * Get the suggestionTypeId property: Id of the suggestion type. + * + * @return the suggestionTypeId value. + */ + public String suggestionTypeId() { + return this.suggestionTypeId; + } + + /** + * Set the suggestionTypeId property: Id of the suggestion type. + * + * @param suggestionTypeId the suggestionTypeId value to set. + * @return the RecommendedSuggestion object itself. + */ + public RecommendedSuggestion withSuggestionTypeId(String suggestionTypeId) { + this.suggestionTypeId = suggestionTypeId; + return this; + } + + /** + * Get the title property: Title of the suggestion. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Title of the suggestion. + * + * @param title the title value to set. + * @return the RecommendedSuggestion object itself. + */ + public RecommendedSuggestion withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Description of the suggestion. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the suggestion. + * + * @param description the description value to set. + * @return the RecommendedSuggestion object itself. + */ + public RecommendedSuggestion withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the action property: Action of the suggestion. + * + * @return the action value. + */ + public String action() { + return this.action; + } + + /** + * Set the action property: Action of the suggestion. + * + * @param action the action value to set. + * @return the RecommendedSuggestion object itself. + */ + public RecommendedSuggestion withAction(String action) { + this.action = action; + return this; + } + + /** + * Get the additionalProperties property: Collection of additional properties for the suggestion. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Collection of additional properties for the suggestion. + * + * @param additionalProperties the additionalProperties value to set. + * @return the RecommendedSuggestion object itself. + */ + public RecommendedSuggestion withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (suggestionTypeId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property suggestionTypeId in model RecommendedSuggestion")); + } + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property title in model RecommendedSuggestion")); + } + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model RecommendedSuggestion")); + } + if (action() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property action in model RecommendedSuggestion")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendedSuggestion.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("suggestionTypeId", this.suggestionTypeId); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("action", this.action); + jsonWriter.writeMapField("additionalProperties", this.additionalProperties, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendedSuggestion from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendedSuggestion if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecommendedSuggestion. + */ + public static RecommendedSuggestion fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendedSuggestion deserializedRecommendedSuggestion = new RecommendedSuggestion(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("suggestionTypeId".equals(fieldName)) { + deserializedRecommendedSuggestion.suggestionTypeId = reader.getString(); + } else if ("title".equals(fieldName)) { + deserializedRecommendedSuggestion.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedRecommendedSuggestion.description = reader.getString(); + } else if ("action".equals(fieldName)) { + deserializedRecommendedSuggestion.action = reader.getString(); + } else if ("additionalProperties".equals(fieldName)) { + Map additionalProperties = reader.readMap(reader1 -> reader1.getString()); + deserializedRecommendedSuggestion.additionalProperties = additionalProperties; + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendedSuggestion; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ReevaluateResponse.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ReevaluateResponse.java new file mode 100644 index 000000000000..c7aa042c6a7b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ReevaluateResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.ReevaluateResponseInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of ReevaluateResponse. + */ +public interface ReevaluateResponse { + /** + * Gets the lastEvaluatedTimeUtc property: The time stamp (UTC) when the recommendation was last evaluated. + * + * @return the lastEvaluatedTimeUtc value. + */ + OffsetDateTime lastEvaluatedTimeUtc(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.ReevaluateResponseInner object. + * + * @return the inner object. + */ + ReevaluateResponseInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Reevaluates.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Reevaluates.java new file mode 100644 index 000000000000..47e5620309a4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Reevaluates.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of Reevaluates. + */ +public interface Reevaluates { + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object along with {@link Response}. + */ + Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, Context context); + + /** + * Reevaluate a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return reevaluate response object. + */ + ReevaluateResponse recommendation(String resourceGroupName, String workspaceName, UUID recommendationId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryKeyEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryKeyEntity.java index 0b69e96c3018..c2029ccc3cc2 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryKeyEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryKeyEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.RegistryKeyEntityProperties; import java.io.IOException; import java.util.Map; @@ -17,7 +18,7 @@ * Represents a registry key entity. */ @Immutable -public final class RegistryKeyEntity extends Entity { +public final class RegistryKeyEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryValueEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryValueEntity.java index e42000be1a60..715f3332ff30 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryValueEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RegistryValueEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.RegistryValueEntityProperties; import java.io.IOException; import java.util.Map; @@ -17,7 +18,7 @@ * Represents a registry value entity. */ @Immutable -public final class RegistryValueEntity extends Entity { +public final class RegistryValueEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Relation.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Relation.java index df89699fb98f..d3761d34913e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Relation.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Relation.java @@ -111,14 +111,14 @@ interface Blank extends WithParentResource { */ interface WithParentResource { /** - * Specifies resourceGroupName, workspaceName, incidentId. + * Specifies resourceGroupName, workspaceName, bookmarkId. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param incidentId Incident ID. + * @param bookmarkId Bookmark ID. * @return the next definition stage. */ - WithCreate withExistingIncident(String resourceGroupName, String workspaceName, String incidentId); + WithCreate withExistingBookmark(String resourceGroupName, String workspaceName, String bookmarkId); } /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Relationship.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Relationship.java new file mode 100644 index 000000000000..95698ff56833 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Relationship.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectCommonProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Represents a relationship in Azure Security Insights. + */ +@Immutable +public final class Relationship extends TIObjectInner { + /* + * The kind of the TI object + */ + private TIObjectKind kind = TIObjectKind.RELATIONSHIP; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The properties of the TI object + */ + private TIObjectCommonProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of Relationship class. + */ + public Relationship() { + } + + /** + * Get the kind property: The kind of the TI object. + * + * @return the kind value. + */ + @Override + public TIObjectKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of the TI object. + * + * @return the innerProperties value. + */ + private TIObjectCommonProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + public Map data() { + return this.innerProperties() == null ? null : this.innerProperties().data(); + } + + /** + * Get the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the source property: The source name for this TI object. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Get the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + public OffsetDateTime firstIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().firstIngestedTimeUtc(); + } + + /** + * Get the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + public OffsetDateTime lastIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastIngestedTimeUtc(); + } + + /** + * Get the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + public UUID ingestionRulesVersion() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionRulesVersion(); + } + + /** + * Get the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + public String lastUpdateMethod() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateMethod(); + } + + /** + * Get the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + public UserInfo lastModifiedBy() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy(); + } + + /** + * Get the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateTimeUtc(); + } + + /** + * Get the relationshipHints property: A dictionary used to help follow relationships from this object to other STIX + * objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of sources + * that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + public List relationshipHints() { + return this.innerProperties() == null ? null : this.innerProperties().relationshipHints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Relationship from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Relationship if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Relationship. + */ + public static Relationship fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Relationship deserializedRelationship = new Relationship(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRelationship.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRelationship.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRelationship.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRelationship.innerProperties = TIObjectCommonProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedRelationship.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedRelationship.kind = TIObjectKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRelationship; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RelationshipHint.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RelationshipHint.java new file mode 100644 index 000000000000..4de014c6e07a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RelationshipHint.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An object used to help follow relationships from this object to other STIX objects. + */ +@Fluent +public final class RelationshipHint implements JsonSerializable { + /* + * The fieldName property. + */ + private String fieldName; + + /* + * The source property. + */ + private String source; + + /** + * Creates an instance of RelationshipHint class. + */ + public RelationshipHint() { + } + + /** + * Get the fieldName property: The fieldName property. + * + * @return the fieldName value. + */ + public String fieldName() { + return this.fieldName; + } + + /** + * Set the fieldName property: The fieldName property. + * + * @param fieldName the fieldName value to set. + * @return the RelationshipHint object itself. + */ + public RelationshipHint withFieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + /** + * Get the source property: The source property. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: The source property. + * + * @param source the source value to set. + * @return the RelationshipHint object itself. + */ + public RelationshipHint withSource(String source) { + this.source = source; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fieldName", this.fieldName); + jsonWriter.writeStringField("source", this.source); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RelationshipHint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RelationshipHint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RelationshipHint. + */ + public static RelationshipHint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RelationshipHint deserializedRelationshipHint = new RelationshipHint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String jsonFieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fieldName".equals(jsonFieldName)) { + deserializedRelationshipHint.fieldName = reader.getString(); + } else if ("source".equals(jsonFieldName)) { + deserializedRelationshipHint.source = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRelationshipHint; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Repo.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Repo.java new file mode 100644 index 000000000000..bb24a0b70167 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Repo.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.RepoInner; +import java.util.List; + +/** + * An immutable client-side representation of Repo. + */ +public interface Repo { + /** + * Gets the url property: The url to access the repository. + * + * @return the url value. + */ + String url(); + + /** + * Gets the fullName property: The name of the repository. + * + * @return the fullName value. + */ + String fullName(); + + /** + * Gets the installationId property: The installation id of the repository. + * + * @return the installationId value. + */ + Long installationId(); + + /** + * Gets the branches property: Array of branches. + * + * @return the branches value. + */ + List branches(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.RepoInner object. + * + * @return the inner object. + */ + RepoInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepoList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepoList.java new file mode 100644 index 000000000000..075ec88fc849 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepoList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.RepoInner; +import java.io.IOException; +import java.util.List; + +/** + * List all the source controls. + */ +@Fluent +public final class RepoList implements JsonSerializable { + /* + * URL to fetch the next set of repositories. + */ + private String nextLink; + + /* + * Array of repositories. + */ + private List value; + + /** + * Creates an instance of RepoList class. + */ + public RepoList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of repositories. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of repositories. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of repositories. + * + * @param value the value value to set. + * @return the RepoList object itself. + */ + public RepoList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model RepoList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RepoList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RepoList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RepoList if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RepoList. + */ + public static RepoList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RepoList deserializedRepoList = new RepoList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RepoInner.fromJson(reader1)); + deserializedRepoList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRepoList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRepoList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepoType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepoType.java new file mode 100644 index 000000000000..637fb6f5fdd3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepoType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of repository. + */ +public final class RepoType extends ExpandableStringEnum { + /** + * Static value Github for RepoType. + */ + public static final RepoType GITHUB = fromString("Github"); + + /** + * Static value AzureDevOps for RepoType. + */ + public static final RepoType AZURE_DEV_OPS = fromString("AzureDevOps"); + + /** + * Creates a new instance of RepoType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RepoType() { + } + + /** + * Creates or finds a RepoType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RepoType. + */ + public static RepoType fromString(String name) { + return fromString(name, RepoType.class); + } + + /** + * Gets known RepoType values. + * + * @return known RepoType values. + */ + public static Collection values() { + return values(RepoType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ReportActionStatusPayload.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ReportActionStatusPayload.java new file mode 100644 index 000000000000..0f723dbfcb58 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ReportActionStatusPayload.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Report the status of an action that was performed by the agent. + */ +@Fluent +public final class ReportActionStatusPayload implements JsonSerializable { + /* + * The action ID to perform + */ + private String actionId; + + /* + * The status of the action that was performed by the agent + */ + private String actionStatus; + + /* + * The reason of the failure of the action. Empty if the action is successful. + */ + private String failureReason; + + /** + * Creates an instance of ReportActionStatusPayload class. + */ + public ReportActionStatusPayload() { + } + + /** + * Get the actionId property: The action ID to perform. + * + * @return the actionId value. + */ + public String actionId() { + return this.actionId; + } + + /** + * Set the actionId property: The action ID to perform. + * + * @param actionId the actionId value to set. + * @return the ReportActionStatusPayload object itself. + */ + public ReportActionStatusPayload withActionId(String actionId) { + this.actionId = actionId; + return this; + } + + /** + * Get the actionStatus property: The status of the action that was performed by the agent. + * + * @return the actionStatus value. + */ + public String actionStatus() { + return this.actionStatus; + } + + /** + * Set the actionStatus property: The status of the action that was performed by the agent. + * + * @param actionStatus the actionStatus value to set. + * @return the ReportActionStatusPayload object itself. + */ + public ReportActionStatusPayload withActionStatus(String actionStatus) { + this.actionStatus = actionStatus; + return this; + } + + /** + * Get the failureReason property: The reason of the failure of the action. Empty if the action is successful. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Set the failureReason property: The reason of the failure of the action. Empty if the action is successful. + * + * @param failureReason the failureReason value to set. + * @return the ReportActionStatusPayload object itself. + */ + public ReportActionStatusPayload withFailureReason(String failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionId", this.actionId); + jsonWriter.writeStringField("actionStatus", this.actionStatus); + jsonWriter.writeStringField("failureReason", this.failureReason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReportActionStatusPayload from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReportActionStatusPayload if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ReportActionStatusPayload. + */ + public static ReportActionStatusPayload fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ReportActionStatusPayload deserializedReportActionStatusPayload = new ReportActionStatusPayload(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionId".equals(fieldName)) { + deserializedReportActionStatusPayload.actionId = reader.getString(); + } else if ("actionStatus".equals(fieldName)) { + deserializedReportActionStatusPayload.actionStatus = reader.getString(); + } else if ("failureReason".equals(fieldName)) { + deserializedReportActionStatusPayload.failureReason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedReportActionStatusPayload; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Repository.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Repository.java new file mode 100644 index 000000000000..1f34d9f1baa5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Repository.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * metadata of a repository. + */ +@Fluent +public final class Repository implements JsonSerializable { + /* + * Url of repository. + */ + private String url; + + /* + * Branch name of repository. + */ + private String branch; + + /* + * Display url of repository. + */ + private String displayUrl; + + /* + * Url to access repository action logs. + */ + private String deploymentLogsUrl; + + /** + * Creates an instance of Repository class. + */ + public Repository() { + } + + /** + * Get the url property: Url of repository. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: Url of repository. + * + * @param url the url value to set. + * @return the Repository object itself. + */ + public Repository withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the branch property: Branch name of repository. + * + * @return the branch value. + */ + public String branch() { + return this.branch; + } + + /** + * Set the branch property: Branch name of repository. + * + * @param branch the branch value to set. + * @return the Repository object itself. + */ + public Repository withBranch(String branch) { + this.branch = branch; + return this; + } + + /** + * Get the displayUrl property: Display url of repository. + * + * @return the displayUrl value. + */ + public String displayUrl() { + return this.displayUrl; + } + + /** + * Set the displayUrl property: Display url of repository. + * + * @param displayUrl the displayUrl value to set. + * @return the Repository object itself. + */ + public Repository withDisplayUrl(String displayUrl) { + this.displayUrl = displayUrl; + return this; + } + + /** + * Get the deploymentLogsUrl property: Url to access repository action logs. + * + * @return the deploymentLogsUrl value. + */ + public String deploymentLogsUrl() { + return this.deploymentLogsUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (url() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property url in model Repository")); + } + if (branch() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property branch in model Repository")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Repository.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeStringField("branch", this.branch); + jsonWriter.writeStringField("displayUrl", this.displayUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Repository from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Repository if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Repository. + */ + public static Repository fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Repository deserializedRepository = new Repository(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("url".equals(fieldName)) { + deserializedRepository.url = reader.getString(); + } else if ("branch".equals(fieldName)) { + deserializedRepository.branch = reader.getString(); + } else if ("displayUrl".equals(fieldName)) { + deserializedRepository.displayUrl = reader.getString(); + } else if ("deploymentLogsUrl".equals(fieldName)) { + deserializedRepository.deploymentLogsUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRepository; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryAccessKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryAccessKind.java new file mode 100644 index 000000000000..431f332bc059 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryAccessKind.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of repository access credentials. + */ +public final class RepositoryAccessKind extends ExpandableStringEnum { + /** + * Static value OAuth for RepositoryAccessKind. + */ + public static final RepositoryAccessKind OAUTH = fromString("OAuth"); + + /** + * Static value PAT for RepositoryAccessKind. + */ + public static final RepositoryAccessKind PAT = fromString("PAT"); + + /** + * Static value App for RepositoryAccessKind. + */ + public static final RepositoryAccessKind APP = fromString("App"); + + /** + * Creates a new instance of RepositoryAccessKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RepositoryAccessKind() { + } + + /** + * Creates or finds a RepositoryAccessKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding RepositoryAccessKind. + */ + public static RepositoryAccessKind fromString(String name) { + return fromString(name, RepositoryAccessKind.class); + } + + /** + * Gets known RepositoryAccessKind values. + * + * @return known RepositoryAccessKind values. + */ + public static Collection values() { + return values(RepositoryAccessKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryAccessProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryAccessProperties.java new file mode 100644 index 000000000000..7349afb9c404 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryAccessProperties.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.RepositoryAccessObject; +import java.io.IOException; + +/** + * Credentials to access repository. + */ +@Fluent +public final class RepositoryAccessProperties implements JsonSerializable { + /* + * RepositoryAccess properties + */ + private RepositoryAccessObject innerProperties = new RepositoryAccessObject(); + + /** + * Creates an instance of RepositoryAccessProperties class. + */ + public RepositoryAccessProperties() { + } + + /** + * Get the innerProperties property: RepositoryAccess properties. + * + * @return the innerProperties value. + */ + private RepositoryAccessObject innerProperties() { + return this.innerProperties; + } + + /** + * Get the kind property: The kind of repository access credentials. + * + * @return the kind value. + */ + public RepositoryAccessKind kind() { + return this.innerProperties() == null ? null : this.innerProperties().kind(); + } + + /** + * Set the kind property: The kind of repository access credentials. + * + * @param kind the kind value to set. + * @return the RepositoryAccessProperties object itself. + */ + public RepositoryAccessProperties withKind(RepositoryAccessKind kind) { + if (this.innerProperties() == null) { + this.innerProperties = new RepositoryAccessObject(); + } + this.innerProperties().withKind(kind); + return this; + } + + /** + * Get the code property: OAuth Code. Required when `kind` is `OAuth`. + * + * @return the code value. + */ + public String code() { + return this.innerProperties() == null ? null : this.innerProperties().code(); + } + + /** + * Set the code property: OAuth Code. Required when `kind` is `OAuth`. + * + * @param code the code value to set. + * @return the RepositoryAccessProperties object itself. + */ + public RepositoryAccessProperties withCode(String code) { + if (this.innerProperties() == null) { + this.innerProperties = new RepositoryAccessObject(); + } + this.innerProperties().withCode(code); + return this; + } + + /** + * Get the state property: OAuth State. Required when `kind` is `OAuth`. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: OAuth State. Required when `kind` is `OAuth`. + * + * @param state the state value to set. + * @return the RepositoryAccessProperties object itself. + */ + public RepositoryAccessProperties withState(String state) { + if (this.innerProperties() == null) { + this.innerProperties = new RepositoryAccessObject(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the clientId property: OAuth ClientId. Required when `kind` is `OAuth`. + * + * @return the clientId value. + */ + public String clientId() { + return this.innerProperties() == null ? null : this.innerProperties().clientId(); + } + + /** + * Set the clientId property: OAuth ClientId. Required when `kind` is `OAuth`. + * + * @param clientId the clientId value to set. + * @return the RepositoryAccessProperties object itself. + */ + public RepositoryAccessProperties withClientId(String clientId) { + if (this.innerProperties() == null) { + this.innerProperties = new RepositoryAccessObject(); + } + this.innerProperties().withClientId(clientId); + return this; + } + + /** + * Get the token property: Personal Access Token. Required when `kind` is `PAT`. + * + * @return the token value. + */ + public String token() { + return this.innerProperties() == null ? null : this.innerProperties().token(); + } + + /** + * Set the token property: Personal Access Token. Required when `kind` is `PAT`. + * + * @param token the token value to set. + * @return the RepositoryAccessProperties object itself. + */ + public RepositoryAccessProperties withToken(String token) { + if (this.innerProperties() == null) { + this.innerProperties = new RepositoryAccessObject(); + } + this.innerProperties().withToken(token); + return this; + } + + /** + * Get the installationId property: Application installation ID. Required when `kind` is `App`. Supported by + * `GitHub` only. + * + * @return the installationId value. + */ + public String installationId() { + return this.innerProperties() == null ? null : this.innerProperties().installationId(); + } + + /** + * Set the installationId property: Application installation ID. Required when `kind` is `App`. Supported by + * `GitHub` only. + * + * @param installationId the installationId value to set. + * @return the RepositoryAccessProperties object itself. + */ + public RepositoryAccessProperties withInstallationId(String installationId) { + if (this.innerProperties() == null) { + this.innerProperties = new RepositoryAccessObject(); + } + this.innerProperties().withInstallationId(installationId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model RepositoryAccessProperties")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RepositoryAccessProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RepositoryAccessProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RepositoryAccessProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RepositoryAccessProperties. + */ + public static RepositoryAccessProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RepositoryAccessProperties deserializedRepositoryAccessProperties = new RepositoryAccessProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRepositoryAccessProperties.innerProperties = RepositoryAccessObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRepositoryAccessProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryResourceInfo.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryResourceInfo.java new file mode 100644 index 000000000000..c06933919db1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RepositoryResourceInfo.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resources created in user's repository for the source-control. + */ +@Fluent +public final class RepositoryResourceInfo implements JsonSerializable { + /* + * The webhook object created for the source-control. + */ + private Webhook webhook; + + /* + * Resources created in GitHub for this source-control. + */ + private GitHubResourceInfo gitHubResourceInfo; + + /* + * Resources created in Azure DevOps for this source-control. + */ + private AzureDevOpsResourceInfo azureDevOpsResourceInfo; + + /** + * Creates an instance of RepositoryResourceInfo class. + */ + public RepositoryResourceInfo() { + } + + /** + * Get the webhook property: The webhook object created for the source-control. + * + * @return the webhook value. + */ + public Webhook webhook() { + return this.webhook; + } + + /** + * Set the webhook property: The webhook object created for the source-control. + * + * @param webhook the webhook value to set. + * @return the RepositoryResourceInfo object itself. + */ + public RepositoryResourceInfo withWebhook(Webhook webhook) { + this.webhook = webhook; + return this; + } + + /** + * Get the gitHubResourceInfo property: Resources created in GitHub for this source-control. + * + * @return the gitHubResourceInfo value. + */ + public GitHubResourceInfo gitHubResourceInfo() { + return this.gitHubResourceInfo; + } + + /** + * Get the azureDevOpsResourceInfo property: Resources created in Azure DevOps for this source-control. + * + * @return the azureDevOpsResourceInfo value. + */ + public AzureDevOpsResourceInfo azureDevOpsResourceInfo() { + return this.azureDevOpsResourceInfo; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (webhook() != null) { + webhook().validate(); + } + if (gitHubResourceInfo() != null) { + gitHubResourceInfo().validate(); + } + if (azureDevOpsResourceInfo() != null) { + azureDevOpsResourceInfo().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("webhook", this.webhook); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RepositoryResourceInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RepositoryResourceInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RepositoryResourceInfo. + */ + public static RepositoryResourceInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RepositoryResourceInfo deserializedRepositoryResourceInfo = new RepositoryResourceInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("webhook".equals(fieldName)) { + deserializedRepositoryResourceInfo.webhook = Webhook.fromJson(reader); + } else if ("gitHubResourceInfo".equals(fieldName)) { + deserializedRepositoryResourceInfo.gitHubResourceInfo = GitHubResourceInfo.fromJson(reader); + } else if ("azureDevOpsResourceInfo".equals(fieldName)) { + deserializedRepositoryResourceInfo.azureDevOpsResourceInfo + = AzureDevOpsResourceInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRepositoryResourceInfo; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RequiredPermissions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RequiredPermissions.java new file mode 100644 index 000000000000..46a09d32a8b5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RequiredPermissions.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Required permissions for the connector. + */ +@Fluent +public final class RequiredPermissions implements JsonSerializable { + /* + * action permission + */ + private Boolean action; + + /* + * write permission + */ + private Boolean write; + + /* + * read permission + */ + private Boolean read; + + /* + * delete permission + */ + private Boolean delete; + + /** + * Creates an instance of RequiredPermissions class. + */ + public RequiredPermissions() { + } + + /** + * Get the action property: action permission. + * + * @return the action value. + */ + public Boolean action() { + return this.action; + } + + /** + * Set the action property: action permission. + * + * @param action the action value to set. + * @return the RequiredPermissions object itself. + */ + public RequiredPermissions withAction(Boolean action) { + this.action = action; + return this; + } + + /** + * Get the write property: write permission. + * + * @return the write value. + */ + public Boolean write() { + return this.write; + } + + /** + * Set the write property: write permission. + * + * @param write the write value to set. + * @return the RequiredPermissions object itself. + */ + public RequiredPermissions withWrite(Boolean write) { + this.write = write; + return this; + } + + /** + * Get the read property: read permission. + * + * @return the read value. + */ + public Boolean read() { + return this.read; + } + + /** + * Set the read property: read permission. + * + * @param read the read value to set. + * @return the RequiredPermissions object itself. + */ + public RequiredPermissions withRead(Boolean read) { + this.read = read; + return this; + } + + /** + * Get the delete property: delete permission. + * + * @return the delete value. + */ + public Boolean delete() { + return this.delete; + } + + /** + * Set the delete property: delete permission. + * + * @param delete the delete value to set. + * @return the RequiredPermissions object itself. + */ + public RequiredPermissions withDelete(Boolean delete) { + this.delete = delete; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("action", this.action); + jsonWriter.writeBooleanField("write", this.write); + jsonWriter.writeBooleanField("read", this.read); + jsonWriter.writeBooleanField("delete", this.delete); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequiredPermissions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequiredPermissions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RequiredPermissions. + */ + public static RequiredPermissions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequiredPermissions deserializedRequiredPermissions = new RequiredPermissions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("action".equals(fieldName)) { + deserializedRequiredPermissions.action = reader.getNullable(JsonReader::getBoolean); + } else if ("write".equals(fieldName)) { + deserializedRequiredPermissions.write = reader.getNullable(JsonReader::getBoolean); + } else if ("read".equals(fieldName)) { + deserializedRequiredPermissions.read = reader.getNullable(JsonReader::getBoolean); + } else if ("delete".equals(fieldName)) { + deserializedRequiredPermissions.delete = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedRequiredPermissions; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProvider.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProvider.java new file mode 100644 index 000000000000..0bd13dea22fe --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProvider.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Resource provider permissions required for the connector. + */ +@Fluent +public class ResourceProvider implements JsonSerializable { + /* + * Provider name + */ + private ProviderName provider; + + /* + * Permission description text + */ + private String permissionsDisplayText; + + /* + * Permission provider display name + */ + private String providerDisplayName; + + /* + * Permission provider scope + */ + private PermissionProviderScope scope; + + /* + * Required permissions for the connector + */ + private RequiredPermissions requiredPermissions; + + /** + * Creates an instance of ResourceProvider class. + */ + public ResourceProvider() { + } + + /** + * Get the provider property: Provider name. + * + * @return the provider value. + */ + public ProviderName provider() { + return this.provider; + } + + /** + * Set the provider property: Provider name. + * + * @param provider the provider value to set. + * @return the ResourceProvider object itself. + */ + public ResourceProvider withProvider(ProviderName provider) { + this.provider = provider; + return this; + } + + /** + * Get the permissionsDisplayText property: Permission description text. + * + * @return the permissionsDisplayText value. + */ + public String permissionsDisplayText() { + return this.permissionsDisplayText; + } + + /** + * Set the permissionsDisplayText property: Permission description text. + * + * @param permissionsDisplayText the permissionsDisplayText value to set. + * @return the ResourceProvider object itself. + */ + public ResourceProvider withPermissionsDisplayText(String permissionsDisplayText) { + this.permissionsDisplayText = permissionsDisplayText; + return this; + } + + /** + * Get the providerDisplayName property: Permission provider display name. + * + * @return the providerDisplayName value. + */ + public String providerDisplayName() { + return this.providerDisplayName; + } + + /** + * Set the providerDisplayName property: Permission provider display name. + * + * @param providerDisplayName the providerDisplayName value to set. + * @return the ResourceProvider object itself. + */ + public ResourceProvider withProviderDisplayName(String providerDisplayName) { + this.providerDisplayName = providerDisplayName; + return this; + } + + /** + * Get the scope property: Permission provider scope. + * + * @return the scope value. + */ + public PermissionProviderScope scope() { + return this.scope; + } + + /** + * Set the scope property: Permission provider scope. + * + * @param scope the scope value to set. + * @return the ResourceProvider object itself. + */ + public ResourceProvider withScope(PermissionProviderScope scope) { + this.scope = scope; + return this; + } + + /** + * Get the requiredPermissions property: Required permissions for the connector. + * + * @return the requiredPermissions value. + */ + public RequiredPermissions requiredPermissions() { + return this.requiredPermissions; + } + + /** + * Set the requiredPermissions property: Required permissions for the connector. + * + * @param requiredPermissions the requiredPermissions value to set. + * @return the ResourceProvider object itself. + */ + public ResourceProvider withRequiredPermissions(RequiredPermissions requiredPermissions) { + this.requiredPermissions = requiredPermissions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requiredPermissions() != null) { + requiredPermissions().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", this.provider == null ? null : this.provider.toString()); + jsonWriter.writeStringField("permissionsDisplayText", this.permissionsDisplayText); + jsonWriter.writeStringField("providerDisplayName", this.providerDisplayName); + jsonWriter.writeStringField("scope", this.scope == null ? null : this.scope.toString()); + jsonWriter.writeJsonField("requiredPermissions", this.requiredPermissions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceProvider from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceProvider if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceProvider. + */ + public static ResourceProvider fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceProvider deserializedResourceProvider = new ResourceProvider(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedResourceProvider.provider = ProviderName.fromString(reader.getString()); + } else if ("permissionsDisplayText".equals(fieldName)) { + deserializedResourceProvider.permissionsDisplayText = reader.getString(); + } else if ("providerDisplayName".equals(fieldName)) { + deserializedResourceProvider.providerDisplayName = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedResourceProvider.scope = PermissionProviderScope.fromString(reader.getString()); + } else if ("requiredPermissions".equals(fieldName)) { + deserializedResourceProvider.requiredPermissions = RequiredPermissions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceProvider; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProviderRequiredPermissions.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProviderRequiredPermissions.java new file mode 100644 index 000000000000..5fe92714a55a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProviderRequiredPermissions.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Required permissions for the connector resource provider that define in ResourceProviders. + * For more information about the permissions see <see + * href="https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#actions-format">here</see>. + */ +@Fluent +public final class ResourceProviderRequiredPermissions + implements JsonSerializable { + /* + * Gets or sets a value indicating whether the permission is read action (GET). + */ + private Boolean read; + + /* + * Gets or sets a value indicating whether the permission is write action (PUT or PATCH). + */ + private Boolean write; + + /* + * Gets or sets a value indicating whether the permission is delete action (DELETE). + */ + private Boolean delete; + + /* + * Gets or sets a value indicating whether the permission is custom actions (POST). + */ + private Boolean action; + + /** + * Creates an instance of ResourceProviderRequiredPermissions class. + */ + public ResourceProviderRequiredPermissions() { + } + + /** + * Get the read property: Gets or sets a value indicating whether the permission is read action (GET). + * + * @return the read value. + */ + public Boolean read() { + return this.read; + } + + /** + * Set the read property: Gets or sets a value indicating whether the permission is read action (GET). + * + * @param read the read value to set. + * @return the ResourceProviderRequiredPermissions object itself. + */ + public ResourceProviderRequiredPermissions withRead(Boolean read) { + this.read = read; + return this; + } + + /** + * Get the write property: Gets or sets a value indicating whether the permission is write action (PUT or PATCH). + * + * @return the write value. + */ + public Boolean write() { + return this.write; + } + + /** + * Set the write property: Gets or sets a value indicating whether the permission is write action (PUT or PATCH). + * + * @param write the write value to set. + * @return the ResourceProviderRequiredPermissions object itself. + */ + public ResourceProviderRequiredPermissions withWrite(Boolean write) { + this.write = write; + return this; + } + + /** + * Get the delete property: Gets or sets a value indicating whether the permission is delete action (DELETE). + * + * @return the delete value. + */ + public Boolean delete() { + return this.delete; + } + + /** + * Set the delete property: Gets or sets a value indicating whether the permission is delete action (DELETE). + * + * @param delete the delete value to set. + * @return the ResourceProviderRequiredPermissions object itself. + */ + public ResourceProviderRequiredPermissions withDelete(Boolean delete) { + this.delete = delete; + return this; + } + + /** + * Get the action property: Gets or sets a value indicating whether the permission is custom actions (POST). + * + * @return the action value. + */ + public Boolean action() { + return this.action; + } + + /** + * Set the action property: Gets or sets a value indicating whether the permission is custom actions (POST). + * + * @param action the action value to set. + * @return the ResourceProviderRequiredPermissions object itself. + */ + public ResourceProviderRequiredPermissions withAction(Boolean action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("read", this.read); + jsonWriter.writeBooleanField("write", this.write); + jsonWriter.writeBooleanField("delete", this.delete); + jsonWriter.writeBooleanField("action", this.action); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceProviderRequiredPermissions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceProviderRequiredPermissions if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceProviderRequiredPermissions. + */ + public static ResourceProviderRequiredPermissions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceProviderRequiredPermissions deserializedResourceProviderRequiredPermissions + = new ResourceProviderRequiredPermissions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("read".equals(fieldName)) { + deserializedResourceProviderRequiredPermissions.read = reader.getNullable(JsonReader::getBoolean); + } else if ("write".equals(fieldName)) { + deserializedResourceProviderRequiredPermissions.write = reader.getNullable(JsonReader::getBoolean); + } else if ("delete".equals(fieldName)) { + deserializedResourceProviderRequiredPermissions.delete = reader.getNullable(JsonReader::getBoolean); + } else if ("action".equals(fieldName)) { + deserializedResourceProviderRequiredPermissions.action = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceProviderRequiredPermissions; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProviders.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProviders.java new file mode 100644 index 000000000000..6f6c0d30ec55 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ResourceProviders.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ResourceProviders. + */ +public interface ResourceProviders { + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address along with {@link Response}. + */ + Response listGeodataByIpWithResponse(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentIpAddressBody ipAddressBody, Context context); + + /** + * Get geodata for a single IP address. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param ipAddressBody IP address (v4 or v6) to be enriched. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return geodata for a single IP address. + */ + EnrichmentIpGeodata listGeodataByIp(String resourceGroupName, String workspaceName, EnrichmentType enrichmentType, + EnrichmentIpAddressBody ipAddressBody); + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name along with {@link Response}. + */ + Response listWhoisByDomainWithResponse(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody, Context context); + + /** + * Get whois information for a single domain name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param enrichmentType Enrichment type. + * @param domainBody Domain name to be enriched. Only domain name is accepted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whois information for a single domain name. + */ + EnrichmentDomainWhois listWhoisByDomain(String resourceGroupName, String workspaceName, + EnrichmentType enrichmentType, EnrichmentDomainBody domainBody); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerDataConnector.java new file mode 100644 index 000000000000..77c9a8efed70 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerDataConnector.java @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.RestApiPollerDataConnectorProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Represents Rest Api Poller data connector. + */ +@Fluent +public final class RestApiPollerDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.REST_API_POLLER; + + /* + * Rest Api Poller data connector properties. + */ + private RestApiPollerDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RestApiPollerDataConnector class. + */ + public RestApiPollerDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Rest Api Poller data connector properties. + * + * @return the innerProperties value. + */ + private RestApiPollerDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @return the connectorDefinitionName value. + */ + public String connectorDefinitionName() { + return this.innerProperties() == null ? null : this.innerProperties().connectorDefinitionName(); + } + + /** + * Set the connectorDefinitionName property: The connector definition name (the dataConnectorDefinition resource + * id). + * + * @param connectorDefinitionName the connectorDefinitionName value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withConnectorDefinitionName(String connectorDefinitionName) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withConnectorDefinitionName(connectorDefinitionName); + return this; + } + + /** + * Get the auth property: The a authentication model. + * + * @return the auth value. + */ + public CcpAuthConfig auth() { + return this.innerProperties() == null ? null : this.innerProperties().auth(); + } + + /** + * Set the auth property: The a authentication model. + * + * @param auth the auth value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withAuth(CcpAuthConfig auth) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withAuth(auth); + return this; + } + + /** + * Get the request property: The request configuration. + * + * @return the request value. + */ + public RestApiPollerRequestConfig request() { + return this.innerProperties() == null ? null : this.innerProperties().request(); + } + + /** + * Set the request property: The request configuration. + * + * @param request the request value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withRequest(RestApiPollerRequestConfig request) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withRequest(request); + return this; + } + + /** + * Get the dcrConfig property: The DCR related properties. + * + * @return the dcrConfig value. + */ + public DcrConfiguration dcrConfig() { + return this.innerProperties() == null ? null : this.innerProperties().dcrConfig(); + } + + /** + * Set the dcrConfig property: The DCR related properties. + * + * @param dcrConfig the dcrConfig value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withDcrConfig(DcrConfiguration dcrConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withDcrConfig(dcrConfig); + return this; + } + + /** + * Get the isActive property: Indicates whether the connector is active or not. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.innerProperties() == null ? null : this.innerProperties().isActive(); + } + + /** + * Set the isActive property: Indicates whether the connector is active or not. + * + * @param isActive the isActive value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withIsActive(Boolean isActive) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withIsActive(isActive); + return this; + } + + /** + * Get the dataType property: The Log Analytics table destination. + * + * @return the dataType value. + */ + public String dataType() { + return this.innerProperties() == null ? null : this.innerProperties().dataType(); + } + + /** + * Set the dataType property: The Log Analytics table destination. + * + * @param dataType the dataType value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withDataType(String dataType) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withDataType(dataType); + return this; + } + + /** + * Get the response property: The response configuration. + * + * @return the response value. + */ + public CcpResponseConfig response() { + return this.innerProperties() == null ? null : this.innerProperties().response(); + } + + /** + * Set the response property: The response configuration. + * + * @param response the response value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withResponse(CcpResponseConfig response) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withResponse(response); + return this; + } + + /** + * Get the paging property: The paging configuration. + * + * @return the paging value. + */ + public RestApiPollerRequestPagingConfig paging() { + return this.innerProperties() == null ? null : this.innerProperties().paging(); + } + + /** + * Set the paging property: The paging configuration. + * + * @param paging the paging value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withPaging(RestApiPollerRequestPagingConfig paging) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withPaging(paging); + return this; + } + + /** + * Get the addOnAttributes property: The add on attributes. The key name will become attribute name (a column) and + * the value will become the attribute value in the payload. + * + * @return the addOnAttributes value. + */ + public Map addOnAttributes() { + return this.innerProperties() == null ? null : this.innerProperties().addOnAttributes(); + } + + /** + * Set the addOnAttributes property: The add on attributes. The key name will become attribute name (a column) and + * the value will become the attribute value in the payload. + * + * @param addOnAttributes the addOnAttributes value to set. + * @return the RestApiPollerDataConnector object itself. + */ + public RestApiPollerDataConnector withAddOnAttributes(Map addOnAttributes) { + if (this.innerProperties() == null) { + this.innerProperties = new RestApiPollerDataConnectorProperties(); + } + this.innerProperties().withAddOnAttributes(addOnAttributes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerDataConnector if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerDataConnector. + */ + public static RestApiPollerDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerDataConnector deserializedRestApiPollerDataConnector = new RestApiPollerDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRestApiPollerDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRestApiPollerDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRestApiPollerDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedRestApiPollerDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedRestApiPollerDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedRestApiPollerDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedRestApiPollerDataConnector.innerProperties + = RestApiPollerDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestConfig.java new file mode 100644 index 000000000000..69cb4b5791e7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestConfig.java @@ -0,0 +1,546 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The request configuration. + */ +@Fluent +public final class RestApiPollerRequestConfig implements JsonSerializable { + /* + * The API endpoint. + */ + private String apiEndpoint; + + /* + * The Rate limit queries per second for the request.. + */ + private Integer rateLimitQps; + + /* + * The query window in minutes for the request. + */ + private Integer queryWindowInMin; + + /* + * The HTTP method, default value GET. + */ + private HttpMethodVerb httpMethod; + + /* + * The query time format. A remote server can have a query to pull data from range 'start' to 'end'. This property + * indicate what is the expected time format the remote server know to parse. + */ + private String queryTimeFormat; + + /* + * The retry count. + */ + private Integer retryCount; + + /* + * The timeout in seconds. + */ + private Integer timeoutInSeconds; + + /* + * Flag to indicate if HTTP POST payload is in JSON format (vs form-urlencoded). + */ + private Boolean isPostPayloadJson; + + /* + * The header for the request for the remote server. + */ + private Map headers; + + /* + * The HTTP query parameters to RESTful API. + */ + private Map queryParameters; + + /* + * the query parameters template. Defines the query parameters template to use when passing query parameters in + * advanced scenarios. + */ + private String queryParametersTemplate; + + /* + * The query parameter name which the remote server expect to start query. This property goes hand to hand with + * `endTimeAttributeName`. + */ + private String startTimeAttributeName; + + /* + * The query parameter name which the remote server expect to end query. This property goes hand to hand with + * `startTimeAttributeName` + */ + private String endTimeAttributeName; + + /* + * The query parameter name which we need to send the server for query logs in time interval. Should be defined with + * `queryTimeIntervalPrepend` and `queryTimeIntervalDelimiter` + */ + private String queryTimeIntervalAttributeName; + + /* + * The string prepend to the value of the query parameter in `queryTimeIntervalAttributeName`. + */ + private String queryTimeIntervalPrepend; + + /* + * The delimiter string between 2 QueryTimeFormat in the query parameter `queryTimeIntervalAttributeName`. + */ + private String queryTimeIntervalDelimiter; + + /** + * Creates an instance of RestApiPollerRequestConfig class. + */ + public RestApiPollerRequestConfig() { + } + + /** + * Get the apiEndpoint property: The API endpoint. + * + * @return the apiEndpoint value. + */ + public String apiEndpoint() { + return this.apiEndpoint; + } + + /** + * Set the apiEndpoint property: The API endpoint. + * + * @param apiEndpoint the apiEndpoint value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withApiEndpoint(String apiEndpoint) { + this.apiEndpoint = apiEndpoint; + return this; + } + + /** + * Get the rateLimitQps property: The Rate limit queries per second for the request.. + * + * @return the rateLimitQps value. + */ + public Integer rateLimitQps() { + return this.rateLimitQps; + } + + /** + * Set the rateLimitQps property: The Rate limit queries per second for the request.. + * + * @param rateLimitQps the rateLimitQps value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withRateLimitQps(Integer rateLimitQps) { + this.rateLimitQps = rateLimitQps; + return this; + } + + /** + * Get the queryWindowInMin property: The query window in minutes for the request. + * + * @return the queryWindowInMin value. + */ + public Integer queryWindowInMin() { + return this.queryWindowInMin; + } + + /** + * Set the queryWindowInMin property: The query window in minutes for the request. + * + * @param queryWindowInMin the queryWindowInMin value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withQueryWindowInMin(Integer queryWindowInMin) { + this.queryWindowInMin = queryWindowInMin; + return this; + } + + /** + * Get the httpMethod property: The HTTP method, default value GET. + * + * @return the httpMethod value. + */ + public HttpMethodVerb httpMethod() { + return this.httpMethod; + } + + /** + * Set the httpMethod property: The HTTP method, default value GET. + * + * @param httpMethod the httpMethod value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withHttpMethod(HttpMethodVerb httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + /** + * Get the queryTimeFormat property: The query time format. A remote server can have a query to pull data from range + * 'start' to 'end'. This property indicate what is the expected time format the remote server know to parse. + * + * @return the queryTimeFormat value. + */ + public String queryTimeFormat() { + return this.queryTimeFormat; + } + + /** + * Set the queryTimeFormat property: The query time format. A remote server can have a query to pull data from range + * 'start' to 'end'. This property indicate what is the expected time format the remote server know to parse. + * + * @param queryTimeFormat the queryTimeFormat value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withQueryTimeFormat(String queryTimeFormat) { + this.queryTimeFormat = queryTimeFormat; + return this; + } + + /** + * Get the retryCount property: The retry count. + * + * @return the retryCount value. + */ + public Integer retryCount() { + return this.retryCount; + } + + /** + * Set the retryCount property: The retry count. + * + * @param retryCount the retryCount value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withRetryCount(Integer retryCount) { + this.retryCount = retryCount; + return this; + } + + /** + * Get the timeoutInSeconds property: The timeout in seconds. + * + * @return the timeoutInSeconds value. + */ + public Integer timeoutInSeconds() { + return this.timeoutInSeconds; + } + + /** + * Set the timeoutInSeconds property: The timeout in seconds. + * + * @param timeoutInSeconds the timeoutInSeconds value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withTimeoutInSeconds(Integer timeoutInSeconds) { + this.timeoutInSeconds = timeoutInSeconds; + return this; + } + + /** + * Get the isPostPayloadJson property: Flag to indicate if HTTP POST payload is in JSON format (vs form-urlencoded). + * + * @return the isPostPayloadJson value. + */ + public Boolean isPostPayloadJson() { + return this.isPostPayloadJson; + } + + /** + * Set the isPostPayloadJson property: Flag to indicate if HTTP POST payload is in JSON format (vs form-urlencoded). + * + * @param isPostPayloadJson the isPostPayloadJson value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withIsPostPayloadJson(Boolean isPostPayloadJson) { + this.isPostPayloadJson = isPostPayloadJson; + return this; + } + + /** + * Get the headers property: The header for the request for the remote server. + * + * @return the headers value. + */ + public Map headers() { + return this.headers; + } + + /** + * Set the headers property: The header for the request for the remote server. + * + * @param headers the headers value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withHeaders(Map headers) { + this.headers = headers; + return this; + } + + /** + * Get the queryParameters property: The HTTP query parameters to RESTful API. + * + * @return the queryParameters value. + */ + public Map queryParameters() { + return this.queryParameters; + } + + /** + * Set the queryParameters property: The HTTP query parameters to RESTful API. + * + * @param queryParameters the queryParameters value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withQueryParameters(Map queryParameters) { + this.queryParameters = queryParameters; + return this; + } + + /** + * Get the queryParametersTemplate property: the query parameters template. Defines the query parameters template to + * use when passing query parameters in advanced scenarios. + * + * @return the queryParametersTemplate value. + */ + public String queryParametersTemplate() { + return this.queryParametersTemplate; + } + + /** + * Set the queryParametersTemplate property: the query parameters template. Defines the query parameters template to + * use when passing query parameters in advanced scenarios. + * + * @param queryParametersTemplate the queryParametersTemplate value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withQueryParametersTemplate(String queryParametersTemplate) { + this.queryParametersTemplate = queryParametersTemplate; + return this; + } + + /** + * Get the startTimeAttributeName property: The query parameter name which the remote server expect to start query. + * This property goes hand to hand with `endTimeAttributeName`. + * + * @return the startTimeAttributeName value. + */ + public String startTimeAttributeName() { + return this.startTimeAttributeName; + } + + /** + * Set the startTimeAttributeName property: The query parameter name which the remote server expect to start query. + * This property goes hand to hand with `endTimeAttributeName`. + * + * @param startTimeAttributeName the startTimeAttributeName value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withStartTimeAttributeName(String startTimeAttributeName) { + this.startTimeAttributeName = startTimeAttributeName; + return this; + } + + /** + * Get the endTimeAttributeName property: The query parameter name which the remote server expect to end query. This + * property goes hand to hand with `startTimeAttributeName`. + * + * @return the endTimeAttributeName value. + */ + public String endTimeAttributeName() { + return this.endTimeAttributeName; + } + + /** + * Set the endTimeAttributeName property: The query parameter name which the remote server expect to end query. This + * property goes hand to hand with `startTimeAttributeName`. + * + * @param endTimeAttributeName the endTimeAttributeName value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withEndTimeAttributeName(String endTimeAttributeName) { + this.endTimeAttributeName = endTimeAttributeName; + return this; + } + + /** + * Get the queryTimeIntervalAttributeName property: The query parameter name which we need to send the server for + * query logs in time interval. Should be defined with `queryTimeIntervalPrepend` and `queryTimeIntervalDelimiter`. + * + * @return the queryTimeIntervalAttributeName value. + */ + public String queryTimeIntervalAttributeName() { + return this.queryTimeIntervalAttributeName; + } + + /** + * Set the queryTimeIntervalAttributeName property: The query parameter name which we need to send the server for + * query logs in time interval. Should be defined with `queryTimeIntervalPrepend` and `queryTimeIntervalDelimiter`. + * + * @param queryTimeIntervalAttributeName the queryTimeIntervalAttributeName value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withQueryTimeIntervalAttributeName(String queryTimeIntervalAttributeName) { + this.queryTimeIntervalAttributeName = queryTimeIntervalAttributeName; + return this; + } + + /** + * Get the queryTimeIntervalPrepend property: The string prepend to the value of the query parameter in + * `queryTimeIntervalAttributeName`. + * + * @return the queryTimeIntervalPrepend value. + */ + public String queryTimeIntervalPrepend() { + return this.queryTimeIntervalPrepend; + } + + /** + * Set the queryTimeIntervalPrepend property: The string prepend to the value of the query parameter in + * `queryTimeIntervalAttributeName`. + * + * @param queryTimeIntervalPrepend the queryTimeIntervalPrepend value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withQueryTimeIntervalPrepend(String queryTimeIntervalPrepend) { + this.queryTimeIntervalPrepend = queryTimeIntervalPrepend; + return this; + } + + /** + * Get the queryTimeIntervalDelimiter property: The delimiter string between 2 QueryTimeFormat in the query + * parameter `queryTimeIntervalAttributeName`. + * + * @return the queryTimeIntervalDelimiter value. + */ + public String queryTimeIntervalDelimiter() { + return this.queryTimeIntervalDelimiter; + } + + /** + * Set the queryTimeIntervalDelimiter property: The delimiter string between 2 QueryTimeFormat in the query + * parameter `queryTimeIntervalAttributeName`. + * + * @param queryTimeIntervalDelimiter the queryTimeIntervalDelimiter value to set. + * @return the RestApiPollerRequestConfig object itself. + */ + public RestApiPollerRequestConfig withQueryTimeIntervalDelimiter(String queryTimeIntervalDelimiter) { + this.queryTimeIntervalDelimiter = queryTimeIntervalDelimiter; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (apiEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property apiEndpoint in model RestApiPollerRequestConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerRequestConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("apiEndpoint", this.apiEndpoint); + jsonWriter.writeNumberField("rateLimitQPS", this.rateLimitQps); + jsonWriter.writeNumberField("queryWindowInMin", this.queryWindowInMin); + jsonWriter.writeStringField("httpMethod", this.httpMethod == null ? null : this.httpMethod.toString()); + jsonWriter.writeStringField("queryTimeFormat", this.queryTimeFormat); + jsonWriter.writeNumberField("retryCount", this.retryCount); + jsonWriter.writeNumberField("timeoutInSeconds", this.timeoutInSeconds); + jsonWriter.writeBooleanField("isPostPayloadJson", this.isPostPayloadJson); + jsonWriter.writeMapField("headers", this.headers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("queryParameters", this.queryParameters, + (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeStringField("queryParametersTemplate", this.queryParametersTemplate); + jsonWriter.writeStringField("startTimeAttributeName", this.startTimeAttributeName); + jsonWriter.writeStringField("endTimeAttributeName", this.endTimeAttributeName); + jsonWriter.writeStringField("queryTimeIntervalAttributeName", this.queryTimeIntervalAttributeName); + jsonWriter.writeStringField("queryTimeIntervalPrepend", this.queryTimeIntervalPrepend); + jsonWriter.writeStringField("queryTimeIntervalDelimiter", this.queryTimeIntervalDelimiter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerRequestConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerRequestConfig if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerRequestConfig. + */ + public static RestApiPollerRequestConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerRequestConfig deserializedRestApiPollerRequestConfig = new RestApiPollerRequestConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("apiEndpoint".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.apiEndpoint = reader.getString(); + } else if ("rateLimitQPS".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.rateLimitQps = reader.getNullable(JsonReader::getInt); + } else if ("queryWindowInMin".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.queryWindowInMin = reader.getNullable(JsonReader::getInt); + } else if ("httpMethod".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.httpMethod = HttpMethodVerb.fromString(reader.getString()); + } else if ("queryTimeFormat".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.queryTimeFormat = reader.getString(); + } else if ("retryCount".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.retryCount = reader.getNullable(JsonReader::getInt); + } else if ("timeoutInSeconds".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.timeoutInSeconds = reader.getNullable(JsonReader::getInt); + } else if ("isPostPayloadJson".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.isPostPayloadJson + = reader.getNullable(JsonReader::getBoolean); + } else if ("headers".equals(fieldName)) { + Map headers = reader.readMap(reader1 -> reader1.getString()); + deserializedRestApiPollerRequestConfig.headers = headers; + } else if ("queryParameters".equals(fieldName)) { + Map queryParameters = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedRestApiPollerRequestConfig.queryParameters = queryParameters; + } else if ("queryParametersTemplate".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.queryParametersTemplate = reader.getString(); + } else if ("startTimeAttributeName".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.startTimeAttributeName = reader.getString(); + } else if ("endTimeAttributeName".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.endTimeAttributeName = reader.getString(); + } else if ("queryTimeIntervalAttributeName".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.queryTimeIntervalAttributeName = reader.getString(); + } else if ("queryTimeIntervalPrepend".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.queryTimeIntervalPrepend = reader.getString(); + } else if ("queryTimeIntervalDelimiter".equals(fieldName)) { + deserializedRestApiPollerRequestConfig.queryTimeIntervalDelimiter = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerRequestConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingConfig.java new file mode 100644 index 000000000000..d69bd3e50f2a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingConfig.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request paging configuration. + */ +@Fluent +public class RestApiPollerRequestPagingConfig implements JsonSerializable { + /* + * Type of paging + */ + private RestApiPollerRequestPagingKind pagingType; + + /* + * Page size + */ + private Integer pageSize; + + /* + * Page size parameter name + */ + private String pageSizeParameterName; + + /** + * Creates an instance of RestApiPollerRequestPagingConfig class. + */ + public RestApiPollerRequestPagingConfig() { + } + + /** + * Get the pagingType property: Type of paging. + * + * @return the pagingType value. + */ + public RestApiPollerRequestPagingKind pagingType() { + return this.pagingType; + } + + /** + * Set the pagingType property: Type of paging. + * + * @param pagingType the pagingType value to set. + * @return the RestApiPollerRequestPagingConfig object itself. + */ + public RestApiPollerRequestPagingConfig withPagingType(RestApiPollerRequestPagingKind pagingType) { + this.pagingType = pagingType; + return this; + } + + /** + * Get the pageSize property: Page size. + * + * @return the pageSize value. + */ + public Integer pageSize() { + return this.pageSize; + } + + /** + * Set the pageSize property: Page size. + * + * @param pageSize the pageSize value to set. + * @return the RestApiPollerRequestPagingConfig object itself. + */ + public RestApiPollerRequestPagingConfig withPageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get the pageSizeParameterName property: Page size parameter name. + * + * @return the pageSizeParameterName value. + */ + public String pageSizeParameterName() { + return this.pageSizeParameterName; + } + + /** + * Set the pageSizeParameterName property: Page size parameter name. + * + * @param pageSizeParameterName the pageSizeParameterName value to set. + * @return the RestApiPollerRequestPagingConfig object itself. + */ + public RestApiPollerRequestPagingConfig withPageSizeParameterName(String pageSizeParameterName) { + this.pageSizeParameterName = pageSizeParameterName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (pagingType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pagingType in model RestApiPollerRequestPagingConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerRequestPagingConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pagingType", this.pagingType == null ? null : this.pagingType.toString()); + jsonWriter.writeNumberField("pageSize", this.pageSize); + jsonWriter.writeStringField("pageSizeParameterName", this.pageSizeParameterName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerRequestPagingConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerRequestPagingConfig if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerRequestPagingConfig. + */ + public static RestApiPollerRequestPagingConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerRequestPagingConfig deserializedRestApiPollerRequestPagingConfig + = new RestApiPollerRequestPagingConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pagingType".equals(fieldName)) { + deserializedRestApiPollerRequestPagingConfig.pagingType + = RestApiPollerRequestPagingKind.fromString(reader.getString()); + } else if ("pageSize".equals(fieldName)) { + deserializedRestApiPollerRequestPagingConfig.pageSize = reader.getNullable(JsonReader::getInt); + } else if ("pageSizeParameterName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingConfig.pageSizeParameterName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerRequestPagingConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingCountBaseConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingCountBaseConfig.java new file mode 100644 index 000000000000..45506e8653ff --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingCountBaseConfig.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request paging configuration for Count base paging type parameters. + */ +@Fluent +public final class RestApiPollerRequestPagingCountBaseConfig extends RestApiPollerRequestPagingConfig { + /* + * Indicates whether the count is zero based + */ + private Boolean zeroBasedIndexing; + + /* + * JSON path of page count in HTTP response payload + */ + private String pageCountJsonPath; + + /* + * Parameter name of page number in HTTP request + */ + private String pageNumberParaName; + + /* + * JSON path of page number in HTTP response payload + */ + private String pageNumberJsonPath; + + /* + * JSON path of total number of results in HTTP response payload + */ + private String totalResultsJsonPath; + + /** + * Creates an instance of RestApiPollerRequestPagingCountBaseConfig class. + */ + public RestApiPollerRequestPagingCountBaseConfig() { + } + + /** + * Get the zeroBasedIndexing property: Indicates whether the count is zero based. + * + * @return the zeroBasedIndexing value. + */ + public Boolean zeroBasedIndexing() { + return this.zeroBasedIndexing; + } + + /** + * Set the zeroBasedIndexing property: Indicates whether the count is zero based. + * + * @param zeroBasedIndexing the zeroBasedIndexing value to set. + * @return the RestApiPollerRequestPagingCountBaseConfig object itself. + */ + public RestApiPollerRequestPagingCountBaseConfig withZeroBasedIndexing(Boolean zeroBasedIndexing) { + this.zeroBasedIndexing = zeroBasedIndexing; + return this; + } + + /** + * Get the pageCountJsonPath property: JSON path of page count in HTTP response payload. + * + * @return the pageCountJsonPath value. + */ + public String pageCountJsonPath() { + return this.pageCountJsonPath; + } + + /** + * Set the pageCountJsonPath property: JSON path of page count in HTTP response payload. + * + * @param pageCountJsonPath the pageCountJsonPath value to set. + * @return the RestApiPollerRequestPagingCountBaseConfig object itself. + */ + public RestApiPollerRequestPagingCountBaseConfig withPageCountJsonPath(String pageCountJsonPath) { + this.pageCountJsonPath = pageCountJsonPath; + return this; + } + + /** + * Get the pageNumberParaName property: Parameter name of page number in HTTP request. + * + * @return the pageNumberParaName value. + */ + public String pageNumberParaName() { + return this.pageNumberParaName; + } + + /** + * Set the pageNumberParaName property: Parameter name of page number in HTTP request. + * + * @param pageNumberParaName the pageNumberParaName value to set. + * @return the RestApiPollerRequestPagingCountBaseConfig object itself. + */ + public RestApiPollerRequestPagingCountBaseConfig withPageNumberParaName(String pageNumberParaName) { + this.pageNumberParaName = pageNumberParaName; + return this; + } + + /** + * Get the pageNumberJsonPath property: JSON path of page number in HTTP response payload. + * + * @return the pageNumberJsonPath value. + */ + public String pageNumberJsonPath() { + return this.pageNumberJsonPath; + } + + /** + * Set the pageNumberJsonPath property: JSON path of page number in HTTP response payload. + * + * @param pageNumberJsonPath the pageNumberJsonPath value to set. + * @return the RestApiPollerRequestPagingCountBaseConfig object itself. + */ + public RestApiPollerRequestPagingCountBaseConfig withPageNumberJsonPath(String pageNumberJsonPath) { + this.pageNumberJsonPath = pageNumberJsonPath; + return this; + } + + /** + * Get the totalResultsJsonPath property: JSON path of total number of results in HTTP response payload. + * + * @return the totalResultsJsonPath value. + */ + public String totalResultsJsonPath() { + return this.totalResultsJsonPath; + } + + /** + * Set the totalResultsJsonPath property: JSON path of total number of results in HTTP response payload. + * + * @param totalResultsJsonPath the totalResultsJsonPath value to set. + * @return the RestApiPollerRequestPagingCountBaseConfig object itself. + */ + public RestApiPollerRequestPagingCountBaseConfig withTotalResultsJsonPath(String totalResultsJsonPath) { + this.totalResultsJsonPath = totalResultsJsonPath; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingCountBaseConfig withPagingType(RestApiPollerRequestPagingKind pagingType) { + super.withPagingType(pagingType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingCountBaseConfig withPageSize(Integer pageSize) { + super.withPageSize(pageSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingCountBaseConfig withPageSizeParameterName(String pageSizeParameterName) { + super.withPageSizeParameterName(pageSizeParameterName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (pagingType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pagingType in model RestApiPollerRequestPagingCountBaseConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerRequestPagingCountBaseConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pagingType", pagingType() == null ? null : pagingType().toString()); + jsonWriter.writeNumberField("pageSize", pageSize()); + jsonWriter.writeStringField("pageSizeParameterName", pageSizeParameterName()); + jsonWriter.writeBooleanField("zeroBasedIndexing", this.zeroBasedIndexing); + jsonWriter.writeStringField("pageCountJsonPath", this.pageCountJsonPath); + jsonWriter.writeStringField("pageNumberParaName", this.pageNumberParaName); + jsonWriter.writeStringField("pageNumberJsonPath", this.pageNumberJsonPath); + jsonWriter.writeStringField("totalResultsJsonPath", this.totalResultsJsonPath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerRequestPagingCountBaseConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerRequestPagingCountBaseConfig if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerRequestPagingCountBaseConfig. + */ + public static RestApiPollerRequestPagingCountBaseConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerRequestPagingCountBaseConfig deserializedRestApiPollerRequestPagingCountBaseConfig + = new RestApiPollerRequestPagingCountBaseConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pagingType".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig + .withPagingType(RestApiPollerRequestPagingKind.fromString(reader.getString())); + } else if ("pageSize".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig + .withPageSize(reader.getNullable(JsonReader::getInt)); + } else if ("pageSizeParameterName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig.withPageSizeParameterName(reader.getString()); + } else if ("zeroBasedIndexing".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig.zeroBasedIndexing + = reader.getNullable(JsonReader::getBoolean); + } else if ("pageCountJsonPath".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig.pageCountJsonPath = reader.getString(); + } else if ("pageNumberParaName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig.pageNumberParaName = reader.getString(); + } else if ("pageNumberJsonPath".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig.pageNumberJsonPath = reader.getString(); + } else if ("totalResultsJsonPath".equals(fieldName)) { + deserializedRestApiPollerRequestPagingCountBaseConfig.totalResultsJsonPath = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerRequestPagingCountBaseConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingKind.java new file mode 100644 index 000000000000..eaae30c29c51 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingKind.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of paging. + */ +public final class RestApiPollerRequestPagingKind extends ExpandableStringEnum { + /** + * Static value LinkHeader for RestApiPollerRequestPagingKind. + */ + public static final RestApiPollerRequestPagingKind LINK_HEADER = fromString("LinkHeader"); + + /** + * Static value NextPageToken for RestApiPollerRequestPagingKind. + */ + public static final RestApiPollerRequestPagingKind NEXT_PAGE_TOKEN = fromString("NextPageToken"); + + /** + * Static value NextPageUrl for RestApiPollerRequestPagingKind. + */ + public static final RestApiPollerRequestPagingKind NEXT_PAGE_URL = fromString("NextPageUrl"); + + /** + * Static value PersistentToken for RestApiPollerRequestPagingKind. + */ + public static final RestApiPollerRequestPagingKind PERSISTENT_TOKEN = fromString("PersistentToken"); + + /** + * Static value PersistentLinkHeader for RestApiPollerRequestPagingKind. + */ + public static final RestApiPollerRequestPagingKind PERSISTENT_LINK_HEADER = fromString("PersistentLinkHeader"); + + /** + * Static value Offset for RestApiPollerRequestPagingKind. + */ + public static final RestApiPollerRequestPagingKind OFFSET = fromString("Offset"); + + /** + * Static value CountBasedPaging for RestApiPollerRequestPagingKind. + */ + public static final RestApiPollerRequestPagingKind COUNT_BASED_PAGING = fromString("CountBasedPaging"); + + /** + * Creates a new instance of RestApiPollerRequestPagingKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RestApiPollerRequestPagingKind() { + } + + /** + * Creates or finds a RestApiPollerRequestPagingKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestApiPollerRequestPagingKind. + */ + public static RestApiPollerRequestPagingKind fromString(String name) { + return fromString(name, RestApiPollerRequestPagingKind.class); + } + + /** + * Gets known RestApiPollerRequestPagingKind values. + * + * @return known RestApiPollerRequestPagingKind values. + */ + public static Collection values() { + return values(RestApiPollerRequestPagingKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingLinkHeaderConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingLinkHeaderConfig.java new file mode 100644 index 000000000000..59bdc7bdcbf6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingLinkHeaderConfig.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request paging configuration for LinkHeader and PersistentLinkHeader paging type parameters. + */ +@Fluent +public final class RestApiPollerRequestPagingLinkHeaderConfig extends RestApiPollerRequestPagingConfig { + /* + * JSON path of link header token in HTTP response payload + */ + private String linkHeaderTokenJsonPath; + + /* + * Rel link name from the link header + */ + private String linkHeaderRelLinkName; + + /** + * Creates an instance of RestApiPollerRequestPagingLinkHeaderConfig class. + */ + public RestApiPollerRequestPagingLinkHeaderConfig() { + } + + /** + * Get the linkHeaderTokenJsonPath property: JSON path of link header token in HTTP response payload. + * + * @return the linkHeaderTokenJsonPath value. + */ + public String linkHeaderTokenJsonPath() { + return this.linkHeaderTokenJsonPath; + } + + /** + * Set the linkHeaderTokenJsonPath property: JSON path of link header token in HTTP response payload. + * + * @param linkHeaderTokenJsonPath the linkHeaderTokenJsonPath value to set. + * @return the RestApiPollerRequestPagingLinkHeaderConfig object itself. + */ + public RestApiPollerRequestPagingLinkHeaderConfig withLinkHeaderTokenJsonPath(String linkHeaderTokenJsonPath) { + this.linkHeaderTokenJsonPath = linkHeaderTokenJsonPath; + return this; + } + + /** + * Get the linkHeaderRelLinkName property: Rel link name from the link header. + * + * @return the linkHeaderRelLinkName value. + */ + public String linkHeaderRelLinkName() { + return this.linkHeaderRelLinkName; + } + + /** + * Set the linkHeaderRelLinkName property: Rel link name from the link header. + * + * @param linkHeaderRelLinkName the linkHeaderRelLinkName value to set. + * @return the RestApiPollerRequestPagingLinkHeaderConfig object itself. + */ + public RestApiPollerRequestPagingLinkHeaderConfig withLinkHeaderRelLinkName(String linkHeaderRelLinkName) { + this.linkHeaderRelLinkName = linkHeaderRelLinkName; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingLinkHeaderConfig withPagingType(RestApiPollerRequestPagingKind pagingType) { + super.withPagingType(pagingType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingLinkHeaderConfig withPageSize(Integer pageSize) { + super.withPageSize(pageSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingLinkHeaderConfig withPageSizeParameterName(String pageSizeParameterName) { + super.withPageSizeParameterName(pageSizeParameterName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (pagingType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pagingType in model RestApiPollerRequestPagingLinkHeaderConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerRequestPagingLinkHeaderConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pagingType", pagingType() == null ? null : pagingType().toString()); + jsonWriter.writeNumberField("pageSize", pageSize()); + jsonWriter.writeStringField("pageSizeParameterName", pageSizeParameterName()); + jsonWriter.writeStringField("linkHeaderTokenJsonPath", this.linkHeaderTokenJsonPath); + jsonWriter.writeStringField("linkHeaderRelLinkName", this.linkHeaderRelLinkName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerRequestPagingLinkHeaderConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerRequestPagingLinkHeaderConfig if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerRequestPagingLinkHeaderConfig. + */ + public static RestApiPollerRequestPagingLinkHeaderConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerRequestPagingLinkHeaderConfig deserializedRestApiPollerRequestPagingLinkHeaderConfig + = new RestApiPollerRequestPagingLinkHeaderConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pagingType".equals(fieldName)) { + deserializedRestApiPollerRequestPagingLinkHeaderConfig + .withPagingType(RestApiPollerRequestPagingKind.fromString(reader.getString())); + } else if ("pageSize".equals(fieldName)) { + deserializedRestApiPollerRequestPagingLinkHeaderConfig + .withPageSize(reader.getNullable(JsonReader::getInt)); + } else if ("pageSizeParameterName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingLinkHeaderConfig + .withPageSizeParameterName(reader.getString()); + } else if ("linkHeaderTokenJsonPath".equals(fieldName)) { + deserializedRestApiPollerRequestPagingLinkHeaderConfig.linkHeaderTokenJsonPath = reader.getString(); + } else if ("linkHeaderRelLinkName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingLinkHeaderConfig.linkHeaderRelLinkName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerRequestPagingLinkHeaderConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingNextPageUrlConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingNextPageUrlConfig.java new file mode 100644 index 000000000000..9deae9bbbbcd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingNextPageUrlConfig.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The request paging configuration for NextPageUrl paging type parameters. + */ +@Fluent +public final class RestApiPollerRequestPagingNextPageUrlConfig extends RestApiPollerRequestPagingConfig { + /* + * Next page URL + */ + private String nextPageUrl; + + /* + * Query parameters of next page URL + */ + private Map nextPageUrlQueryParameters; + + /* + * Paging query parameters in string template format + */ + private String nextPageUrlQueryParametersTemplate; + + /* + * Next page parameter name in HTTP request + */ + private String nextPageParaName; + + /* + * Next page header name in the request + */ + private String nextPageRequestHeader; + + /* + * JSON path of flag in HTTP response payload to indicate more pages + */ + private String hasNextFlagJsonPath; + + /** + * Creates an instance of RestApiPollerRequestPagingNextPageUrlConfig class. + */ + public RestApiPollerRequestPagingNextPageUrlConfig() { + } + + /** + * Get the nextPageUrl property: Next page URL. + * + * @return the nextPageUrl value. + */ + public String nextPageUrl() { + return this.nextPageUrl; + } + + /** + * Set the nextPageUrl property: Next page URL. + * + * @param nextPageUrl the nextPageUrl value to set. + * @return the RestApiPollerRequestPagingNextPageUrlConfig object itself. + */ + public RestApiPollerRequestPagingNextPageUrlConfig withNextPageUrl(String nextPageUrl) { + this.nextPageUrl = nextPageUrl; + return this; + } + + /** + * Get the nextPageUrlQueryParameters property: Query parameters of next page URL. + * + * @return the nextPageUrlQueryParameters value. + */ + public Map nextPageUrlQueryParameters() { + return this.nextPageUrlQueryParameters; + } + + /** + * Set the nextPageUrlQueryParameters property: Query parameters of next page URL. + * + * @param nextPageUrlQueryParameters the nextPageUrlQueryParameters value to set. + * @return the RestApiPollerRequestPagingNextPageUrlConfig object itself. + */ + public RestApiPollerRequestPagingNextPageUrlConfig + withNextPageUrlQueryParameters(Map nextPageUrlQueryParameters) { + this.nextPageUrlQueryParameters = nextPageUrlQueryParameters; + return this; + } + + /** + * Get the nextPageUrlQueryParametersTemplate property: Paging query parameters in string template format. + * + * @return the nextPageUrlQueryParametersTemplate value. + */ + public String nextPageUrlQueryParametersTemplate() { + return this.nextPageUrlQueryParametersTemplate; + } + + /** + * Set the nextPageUrlQueryParametersTemplate property: Paging query parameters in string template format. + * + * @param nextPageUrlQueryParametersTemplate the nextPageUrlQueryParametersTemplate value to set. + * @return the RestApiPollerRequestPagingNextPageUrlConfig object itself. + */ + public RestApiPollerRequestPagingNextPageUrlConfig + withNextPageUrlQueryParametersTemplate(String nextPageUrlQueryParametersTemplate) { + this.nextPageUrlQueryParametersTemplate = nextPageUrlQueryParametersTemplate; + return this; + } + + /** + * Get the nextPageParaName property: Next page parameter name in HTTP request. + * + * @return the nextPageParaName value. + */ + public String nextPageParaName() { + return this.nextPageParaName; + } + + /** + * Set the nextPageParaName property: Next page parameter name in HTTP request. + * + * @param nextPageParaName the nextPageParaName value to set. + * @return the RestApiPollerRequestPagingNextPageUrlConfig object itself. + */ + public RestApiPollerRequestPagingNextPageUrlConfig withNextPageParaName(String nextPageParaName) { + this.nextPageParaName = nextPageParaName; + return this; + } + + /** + * Get the nextPageRequestHeader property: Next page header name in the request. + * + * @return the nextPageRequestHeader value. + */ + public String nextPageRequestHeader() { + return this.nextPageRequestHeader; + } + + /** + * Set the nextPageRequestHeader property: Next page header name in the request. + * + * @param nextPageRequestHeader the nextPageRequestHeader value to set. + * @return the RestApiPollerRequestPagingNextPageUrlConfig object itself. + */ + public RestApiPollerRequestPagingNextPageUrlConfig withNextPageRequestHeader(String nextPageRequestHeader) { + this.nextPageRequestHeader = nextPageRequestHeader; + return this; + } + + /** + * Get the hasNextFlagJsonPath property: JSON path of flag in HTTP response payload to indicate more pages. + * + * @return the hasNextFlagJsonPath value. + */ + public String hasNextFlagJsonPath() { + return this.hasNextFlagJsonPath; + } + + /** + * Set the hasNextFlagJsonPath property: JSON path of flag in HTTP response payload to indicate more pages. + * + * @param hasNextFlagJsonPath the hasNextFlagJsonPath value to set. + * @return the RestApiPollerRequestPagingNextPageUrlConfig object itself. + */ + public RestApiPollerRequestPagingNextPageUrlConfig withHasNextFlagJsonPath(String hasNextFlagJsonPath) { + this.hasNextFlagJsonPath = hasNextFlagJsonPath; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingNextPageUrlConfig withPagingType(RestApiPollerRequestPagingKind pagingType) { + super.withPagingType(pagingType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingNextPageUrlConfig withPageSize(Integer pageSize) { + super.withPageSize(pageSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingNextPageUrlConfig withPageSizeParameterName(String pageSizeParameterName) { + super.withPageSizeParameterName(pageSizeParameterName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (pagingType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pagingType in model RestApiPollerRequestPagingNextPageUrlConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerRequestPagingNextPageUrlConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pagingType", pagingType() == null ? null : pagingType().toString()); + jsonWriter.writeNumberField("pageSize", pageSize()); + jsonWriter.writeStringField("pageSizeParameterName", pageSizeParameterName()); + jsonWriter.writeStringField("nextPageUrl", this.nextPageUrl); + jsonWriter.writeMapField("nextPageUrlQueryParameters", this.nextPageUrlQueryParameters, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("nextPageUrlQueryParametersTemplate", this.nextPageUrlQueryParametersTemplate); + jsonWriter.writeStringField("nextPageParaName", this.nextPageParaName); + jsonWriter.writeStringField("nextPageRequestHeader", this.nextPageRequestHeader); + jsonWriter.writeStringField("hasNextFlagJsonPath", this.hasNextFlagJsonPath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerRequestPagingNextPageUrlConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerRequestPagingNextPageUrlConfig if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerRequestPagingNextPageUrlConfig. + */ + public static RestApiPollerRequestPagingNextPageUrlConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerRequestPagingNextPageUrlConfig deserializedRestApiPollerRequestPagingNextPageUrlConfig + = new RestApiPollerRequestPagingNextPageUrlConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pagingType".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig + .withPagingType(RestApiPollerRequestPagingKind.fromString(reader.getString())); + } else if ("pageSize".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig + .withPageSize(reader.getNullable(JsonReader::getInt)); + } else if ("pageSizeParameterName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig + .withPageSizeParameterName(reader.getString()); + } else if ("nextPageUrl".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig.nextPageUrl = reader.getString(); + } else if ("nextPageUrlQueryParameters".equals(fieldName)) { + Map nextPageUrlQueryParameters = reader.readMap(reader1 -> reader1.getString()); + deserializedRestApiPollerRequestPagingNextPageUrlConfig.nextPageUrlQueryParameters + = nextPageUrlQueryParameters; + } else if ("nextPageUrlQueryParametersTemplate".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig.nextPageUrlQueryParametersTemplate + = reader.getString(); + } else if ("nextPageParaName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig.nextPageParaName = reader.getString(); + } else if ("nextPageRequestHeader".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig.nextPageRequestHeader = reader.getString(); + } else if ("hasNextFlagJsonPath".equals(fieldName)) { + deserializedRestApiPollerRequestPagingNextPageUrlConfig.hasNextFlagJsonPath = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerRequestPagingNextPageUrlConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingOffsetConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingOffsetConfig.java new file mode 100644 index 000000000000..3e8374f3ca4c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingOffsetConfig.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request paging configuration for Offset paging type parameters. + */ +@Fluent +public final class RestApiPollerRequestPagingOffsetConfig extends RestApiPollerRequestPagingConfig { + /* + * Offset parameter name in HTTP request + */ + private String offsetParaName; + + /** + * Creates an instance of RestApiPollerRequestPagingOffsetConfig class. + */ + public RestApiPollerRequestPagingOffsetConfig() { + } + + /** + * Get the offsetParaName property: Offset parameter name in HTTP request. + * + * @return the offsetParaName value. + */ + public String offsetParaName() { + return this.offsetParaName; + } + + /** + * Set the offsetParaName property: Offset parameter name in HTTP request. + * + * @param offsetParaName the offsetParaName value to set. + * @return the RestApiPollerRequestPagingOffsetConfig object itself. + */ + public RestApiPollerRequestPagingOffsetConfig withOffsetParaName(String offsetParaName) { + this.offsetParaName = offsetParaName; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingOffsetConfig withPagingType(RestApiPollerRequestPagingKind pagingType) { + super.withPagingType(pagingType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingOffsetConfig withPageSize(Integer pageSize) { + super.withPageSize(pageSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingOffsetConfig withPageSizeParameterName(String pageSizeParameterName) { + super.withPageSizeParameterName(pageSizeParameterName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (pagingType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pagingType in model RestApiPollerRequestPagingOffsetConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerRequestPagingOffsetConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pagingType", pagingType() == null ? null : pagingType().toString()); + jsonWriter.writeNumberField("pageSize", pageSize()); + jsonWriter.writeStringField("pageSizeParameterName", pageSizeParameterName()); + jsonWriter.writeStringField("offsetParaName", this.offsetParaName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerRequestPagingOffsetConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerRequestPagingOffsetConfig if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerRequestPagingOffsetConfig. + */ + public static RestApiPollerRequestPagingOffsetConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerRequestPagingOffsetConfig deserializedRestApiPollerRequestPagingOffsetConfig + = new RestApiPollerRequestPagingOffsetConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pagingType".equals(fieldName)) { + deserializedRestApiPollerRequestPagingOffsetConfig + .withPagingType(RestApiPollerRequestPagingKind.fromString(reader.getString())); + } else if ("pageSize".equals(fieldName)) { + deserializedRestApiPollerRequestPagingOffsetConfig + .withPageSize(reader.getNullable(JsonReader::getInt)); + } else if ("pageSizeParameterName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingOffsetConfig.withPageSizeParameterName(reader.getString()); + } else if ("offsetParaName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingOffsetConfig.offsetParaName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerRequestPagingOffsetConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingTokenConfig.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingTokenConfig.java new file mode 100644 index 000000000000..6c5169984d7f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RestApiPollerRequestPagingTokenConfig.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request paging configuration for NextPageToken and PersistentToken paging type parameters. + */ +@Fluent +public final class RestApiPollerRequestPagingTokenConfig extends RestApiPollerRequestPagingConfig { + /* + * JSON path of next page token in HTTP response payload + */ + private String nextPageTokenJsonPath; + + /* + * JSON path of flag in HTTP response payload to indicate more pages + */ + private String hasNextFlagJsonPath; + + /* + * HTTP response header name of next page token + */ + private String nextPageTokenResponseHeader; + + /* + * Next page parameter name in HTTP request + */ + private String nextPageParaName; + + /* + * Next page header name in the request + */ + private String nextPageRequestHeader; + + /** + * Creates an instance of RestApiPollerRequestPagingTokenConfig class. + */ + public RestApiPollerRequestPagingTokenConfig() { + } + + /** + * Get the nextPageTokenJsonPath property: JSON path of next page token in HTTP response payload. + * + * @return the nextPageTokenJsonPath value. + */ + public String nextPageTokenJsonPath() { + return this.nextPageTokenJsonPath; + } + + /** + * Set the nextPageTokenJsonPath property: JSON path of next page token in HTTP response payload. + * + * @param nextPageTokenJsonPath the nextPageTokenJsonPath value to set. + * @return the RestApiPollerRequestPagingTokenConfig object itself. + */ + public RestApiPollerRequestPagingTokenConfig withNextPageTokenJsonPath(String nextPageTokenJsonPath) { + this.nextPageTokenJsonPath = nextPageTokenJsonPath; + return this; + } + + /** + * Get the hasNextFlagJsonPath property: JSON path of flag in HTTP response payload to indicate more pages. + * + * @return the hasNextFlagJsonPath value. + */ + public String hasNextFlagJsonPath() { + return this.hasNextFlagJsonPath; + } + + /** + * Set the hasNextFlagJsonPath property: JSON path of flag in HTTP response payload to indicate more pages. + * + * @param hasNextFlagJsonPath the hasNextFlagJsonPath value to set. + * @return the RestApiPollerRequestPagingTokenConfig object itself. + */ + public RestApiPollerRequestPagingTokenConfig withHasNextFlagJsonPath(String hasNextFlagJsonPath) { + this.hasNextFlagJsonPath = hasNextFlagJsonPath; + return this; + } + + /** + * Get the nextPageTokenResponseHeader property: HTTP response header name of next page token. + * + * @return the nextPageTokenResponseHeader value. + */ + public String nextPageTokenResponseHeader() { + return this.nextPageTokenResponseHeader; + } + + /** + * Set the nextPageTokenResponseHeader property: HTTP response header name of next page token. + * + * @param nextPageTokenResponseHeader the nextPageTokenResponseHeader value to set. + * @return the RestApiPollerRequestPagingTokenConfig object itself. + */ + public RestApiPollerRequestPagingTokenConfig withNextPageTokenResponseHeader(String nextPageTokenResponseHeader) { + this.nextPageTokenResponseHeader = nextPageTokenResponseHeader; + return this; + } + + /** + * Get the nextPageParaName property: Next page parameter name in HTTP request. + * + * @return the nextPageParaName value. + */ + public String nextPageParaName() { + return this.nextPageParaName; + } + + /** + * Set the nextPageParaName property: Next page parameter name in HTTP request. + * + * @param nextPageParaName the nextPageParaName value to set. + * @return the RestApiPollerRequestPagingTokenConfig object itself. + */ + public RestApiPollerRequestPagingTokenConfig withNextPageParaName(String nextPageParaName) { + this.nextPageParaName = nextPageParaName; + return this; + } + + /** + * Get the nextPageRequestHeader property: Next page header name in the request. + * + * @return the nextPageRequestHeader value. + */ + public String nextPageRequestHeader() { + return this.nextPageRequestHeader; + } + + /** + * Set the nextPageRequestHeader property: Next page header name in the request. + * + * @param nextPageRequestHeader the nextPageRequestHeader value to set. + * @return the RestApiPollerRequestPagingTokenConfig object itself. + */ + public RestApiPollerRequestPagingTokenConfig withNextPageRequestHeader(String nextPageRequestHeader) { + this.nextPageRequestHeader = nextPageRequestHeader; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingTokenConfig withPagingType(RestApiPollerRequestPagingKind pagingType) { + super.withPagingType(pagingType); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingTokenConfig withPageSize(Integer pageSize) { + super.withPageSize(pageSize); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestApiPollerRequestPagingTokenConfig withPageSizeParameterName(String pageSizeParameterName) { + super.withPageSizeParameterName(pageSizeParameterName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (pagingType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property pagingType in model RestApiPollerRequestPagingTokenConfig")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestApiPollerRequestPagingTokenConfig.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pagingType", pagingType() == null ? null : pagingType().toString()); + jsonWriter.writeNumberField("pageSize", pageSize()); + jsonWriter.writeStringField("pageSizeParameterName", pageSizeParameterName()); + jsonWriter.writeStringField("nextPageTokenJsonPath", this.nextPageTokenJsonPath); + jsonWriter.writeStringField("hasNextFlagJsonPath", this.hasNextFlagJsonPath); + jsonWriter.writeStringField("nextPageTokenResponseHeader", this.nextPageTokenResponseHeader); + jsonWriter.writeStringField("nextPageParaName", this.nextPageParaName); + jsonWriter.writeStringField("nextPageRequestHeader", this.nextPageRequestHeader); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestApiPollerRequestPagingTokenConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestApiPollerRequestPagingTokenConfig if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestApiPollerRequestPagingTokenConfig. + */ + public static RestApiPollerRequestPagingTokenConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestApiPollerRequestPagingTokenConfig deserializedRestApiPollerRequestPagingTokenConfig + = new RestApiPollerRequestPagingTokenConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pagingType".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig + .withPagingType(RestApiPollerRequestPagingKind.fromString(reader.getString())); + } else if ("pageSize".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig + .withPageSize(reader.getNullable(JsonReader::getInt)); + } else if ("pageSizeParameterName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig.withPageSizeParameterName(reader.getString()); + } else if ("nextPageTokenJsonPath".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig.nextPageTokenJsonPath = reader.getString(); + } else if ("hasNextFlagJsonPath".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig.hasNextFlagJsonPath = reader.getString(); + } else if ("nextPageTokenResponseHeader".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig.nextPageTokenResponseHeader = reader.getString(); + } else if ("nextPageParaName".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig.nextPageParaName = reader.getString(); + } else if ("nextPageRequestHeader".equals(fieldName)) { + deserializedRestApiPollerRequestPagingTokenConfig.nextPageRequestHeader = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestApiPollerRequestPagingTokenConfig; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RfcConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RfcConnector.java new file mode 100644 index 000000000000..c2ff5f183eb8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/RfcConnector.java @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the Rfc connector. + */ +@Fluent +public final class RfcConnector extends SystemsConfigurationConnector { + /* + * Represents the types of SAP systems. + */ + private SystemConfigurationConnectorType type = SystemConfigurationConnectorType.RFC; + + /* + * FQDN, hostname, or IP address of the ABAP server. + */ + private String abapServerHost; + + /* + * FQDN, hostname, or IP address of the Message server. + */ + private String messageServerHost; + + /* + * Logon group of the message server. + */ + private String group; + + /* + * Port number, or service name (from /etc/services) of the message server. + */ + private String messageServerService; + + /* + * SNC QOP. + * Options are 1, 2, 3, 8, 9. + */ + private String sncQop; + + /* + * The SAP code page used for character encoding. + * Example - 1100 + */ + private String codePage; + + /* + * System number of the ABAP server. + */ + private String systemNumber; + + /* + * System ID of the ABAP server. + * Example - A4H + */ + private String systemId; + + /* + * Client number of the ABAP server. + * Example - 001 + */ + private String client; + + /* + * The authentication type to SAP. + */ + private SapAuthenticationType authenticationType; + + /** + * Creates an instance of RfcConnector class. + */ + public RfcConnector() { + } + + /** + * Get the type property: Represents the types of SAP systems. + * + * @return the type value. + */ + @Override + public SystemConfigurationConnectorType type() { + return this.type; + } + + /** + * Get the abapServerHost property: FQDN, hostname, or IP address of the ABAP server. + * + * @return the abapServerHost value. + */ + public String abapServerHost() { + return this.abapServerHost; + } + + /** + * Set the abapServerHost property: FQDN, hostname, or IP address of the ABAP server. + * + * @param abapServerHost the abapServerHost value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withAbapServerHost(String abapServerHost) { + this.abapServerHost = abapServerHost; + return this; + } + + /** + * Get the messageServerHost property: FQDN, hostname, or IP address of the Message server. + * + * @return the messageServerHost value. + */ + public String messageServerHost() { + return this.messageServerHost; + } + + /** + * Set the messageServerHost property: FQDN, hostname, or IP address of the Message server. + * + * @param messageServerHost the messageServerHost value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withMessageServerHost(String messageServerHost) { + this.messageServerHost = messageServerHost; + return this; + } + + /** + * Get the group property: Logon group of the message server. + * + * @return the group value. + */ + public String group() { + return this.group; + } + + /** + * Set the group property: Logon group of the message server. + * + * @param group the group value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withGroup(String group) { + this.group = group; + return this; + } + + /** + * Get the messageServerService property: Port number, or service name (from /etc/services) of the message server. + * + * @return the messageServerService value. + */ + public String messageServerService() { + return this.messageServerService; + } + + /** + * Set the messageServerService property: Port number, or service name (from /etc/services) of the message server. + * + * @param messageServerService the messageServerService value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withMessageServerService(String messageServerService) { + this.messageServerService = messageServerService; + return this; + } + + /** + * Get the sncQop property: SNC QOP. + * Options are 1, 2, 3, 8, 9. + * + * @return the sncQop value. + */ + public String sncQop() { + return this.sncQop; + } + + /** + * Set the sncQop property: SNC QOP. + * Options are 1, 2, 3, 8, 9. + * + * @param sncQop the sncQop value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withSncQop(String sncQop) { + this.sncQop = sncQop; + return this; + } + + /** + * Get the codePage property: The SAP code page used for character encoding. + * Example - 1100. + * + * @return the codePage value. + */ + public String codePage() { + return this.codePage; + } + + /** + * Set the codePage property: The SAP code page used for character encoding. + * Example - 1100. + * + * @param codePage the codePage value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withCodePage(String codePage) { + this.codePage = codePage; + return this; + } + + /** + * Get the systemNumber property: System number of the ABAP server. + * + * @return the systemNumber value. + */ + public String systemNumber() { + return this.systemNumber; + } + + /** + * Set the systemNumber property: System number of the ABAP server. + * + * @param systemNumber the systemNumber value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withSystemNumber(String systemNumber) { + this.systemNumber = systemNumber; + return this; + } + + /** + * Get the systemId property: System ID of the ABAP server. + * Example - A4H. + * + * @return the systemId value. + */ + public String systemId() { + return this.systemId; + } + + /** + * Set the systemId property: System ID of the ABAP server. + * Example - A4H. + * + * @param systemId the systemId value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withSystemId(String systemId) { + this.systemId = systemId; + return this; + } + + /** + * Get the client property: Client number of the ABAP server. + * Example - 001. + * + * @return the client value. + */ + public String client() { + return this.client; + } + + /** + * Set the client property: Client number of the ABAP server. + * Example - 001. + * + * @param client the client value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withClient(String client) { + this.client = client; + return this; + } + + /** + * Get the authenticationType property: The authentication type to SAP. + * + * @return the authenticationType value. + */ + public SapAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: The authentication type to SAP. + * + * @param authenticationType the authenticationType value to set. + * @return the RfcConnector object itself. + */ + public RfcConnector withAuthenticationType(SapAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (systemNumber() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property systemNumber in model RfcConnector")); + } + if (systemId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property systemId in model RfcConnector")); + } + if (client() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property client in model RfcConnector")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RfcConnector.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("systemNumber", this.systemNumber); + jsonWriter.writeStringField("systemId", this.systemId); + jsonWriter.writeStringField("client", this.client); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("abapServerHost", this.abapServerHost); + jsonWriter.writeStringField("messageServerHost", this.messageServerHost); + jsonWriter.writeStringField("group", this.group); + jsonWriter.writeStringField("messageServerService", this.messageServerService); + jsonWriter.writeStringField("sncQop", this.sncQop); + jsonWriter.writeStringField("codePage", this.codePage); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RfcConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RfcConnector if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RfcConnector. + */ + public static RfcConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RfcConnector deserializedRfcConnector = new RfcConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("systemNumber".equals(fieldName)) { + deserializedRfcConnector.systemNumber = reader.getString(); + } else if ("systemId".equals(fieldName)) { + deserializedRfcConnector.systemId = reader.getString(); + } else if ("client".equals(fieldName)) { + deserializedRfcConnector.client = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRfcConnector.type = SystemConfigurationConnectorType.fromString(reader.getString()); + } else if ("abapServerHost".equals(fieldName)) { + deserializedRfcConnector.abapServerHost = reader.getString(); + } else if ("messageServerHost".equals(fieldName)) { + deserializedRfcConnector.messageServerHost = reader.getString(); + } else if ("group".equals(fieldName)) { + deserializedRfcConnector.group = reader.getString(); + } else if ("messageServerService".equals(fieldName)) { + deserializedRfcConnector.messageServerService = reader.getString(); + } else if ("sncQop".equals(fieldName)) { + deserializedRfcConnector.sncQop = reader.getString(); + } else if ("codePage".equals(fieldName)) { + deserializedRfcConnector.codePage = reader.getString(); + } else if ("authenticationType".equals(fieldName)) { + deserializedRfcConnector.authenticationType = SapAuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRfcConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SampleQueries.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SampleQueries.java new file mode 100644 index 000000000000..c088b9bd9c6f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SampleQueries.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The sample queries for the connector. + */ +@Fluent +public class SampleQueries implements JsonSerializable { + /* + * The sample query description + */ + private String description; + + /* + * the sample query + */ + private String query; + + /** + * Creates an instance of SampleQueries class. + */ + public SampleQueries() { + } + + /** + * Get the description property: The sample query description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The sample query description. + * + * @param description the description value to set. + * @return the SampleQueries object itself. + */ + public SampleQueries withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the query property: the sample query. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: the sample query. + * + * @param query the query value to set. + * @return the SampleQueries object itself. + */ + public SampleQueries withQuery(String query) { + this.query = query; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("query", this.query); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SampleQueries from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SampleQueries if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SampleQueries. + */ + public static SampleQueries fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SampleQueries deserializedSampleQueries = new SampleQueries(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedSampleQueries.description = reader.getString(); + } else if ("query".equals(fieldName)) { + deserializedSampleQueries.query = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSampleQueries; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapAgentConfiguration.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapAgentConfiguration.java new file mode 100644 index 000000000000..3f652f43b475 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapAgentConfiguration.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the configuration of a SAP Docker agent. + */ +@Fluent +public final class SapAgentConfiguration extends AgentConfiguration { + /* + * Type of the agent + */ + private AgentType type = AgentType.SAP; + + /* + * The name of the docker agent. + * only letters with numbers, underscores and hyphens are allowed + * example: "my-agent" + */ + private String agentContainerName; + + /* + * The SDK path (a file not a folder) on the agent machine. + * example: "/path/to/nwrfc750P_8-70002755.zip" + */ + private String sdkPath; + + /* + * The SNC path (a folder not a file) on the agent machine. + * example: "/path/to/snc" + */ + private String sncPath; + + /* + * The key vault resource id to access the key vault. + * example: + * "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.KeyVault/vaults/myVault" + */ + private String keyVaultResourceId; + + /* + * The key mode of the agent. + * ManagedIdentity|ApplicationIdentity are the options + */ + private KeyVaultAuthenticationMode keyVaultAuthenticationMode; + + /* + * The secret source of the agent. + * AzureKeyVault is the option + */ + private SecretSource secretSource; + + /** + * Creates an instance of SapAgentConfiguration class. + */ + public SapAgentConfiguration() { + } + + /** + * Get the type property: Type of the agent. + * + * @return the type value. + */ + @Override + public AgentType type() { + return this.type; + } + + /** + * Get the agentContainerName property: The name of the docker agent. + * only letters with numbers, underscores and hyphens are allowed + * example: "my-agent". + * + * @return the agentContainerName value. + */ + public String agentContainerName() { + return this.agentContainerName; + } + + /** + * Set the agentContainerName property: The name of the docker agent. + * only letters with numbers, underscores and hyphens are allowed + * example: "my-agent". + * + * @param agentContainerName the agentContainerName value to set. + * @return the SapAgentConfiguration object itself. + */ + public SapAgentConfiguration withAgentContainerName(String agentContainerName) { + this.agentContainerName = agentContainerName; + return this; + } + + /** + * Get the sdkPath property: The SDK path (a file not a folder) on the agent machine. + * example: "/path/to/nwrfc750P_8-70002755.zip". + * + * @return the sdkPath value. + */ + public String sdkPath() { + return this.sdkPath; + } + + /** + * Set the sdkPath property: The SDK path (a file not a folder) on the agent machine. + * example: "/path/to/nwrfc750P_8-70002755.zip". + * + * @param sdkPath the sdkPath value to set. + * @return the SapAgentConfiguration object itself. + */ + public SapAgentConfiguration withSdkPath(String sdkPath) { + this.sdkPath = sdkPath; + return this; + } + + /** + * Get the sncPath property: The SNC path (a folder not a file) on the agent machine. + * example: "/path/to/snc". + * + * @return the sncPath value. + */ + public String sncPath() { + return this.sncPath; + } + + /** + * Set the sncPath property: The SNC path (a folder not a file) on the agent machine. + * example: "/path/to/snc". + * + * @param sncPath the sncPath value to set. + * @return the SapAgentConfiguration object itself. + */ + public SapAgentConfiguration withSncPath(String sncPath) { + this.sncPath = sncPath; + return this; + } + + /** + * Get the keyVaultResourceId property: The key vault resource id to access the key vault. + * example: + * "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.KeyVault/vaults/myVault". + * + * @return the keyVaultResourceId value. + */ + public String keyVaultResourceId() { + return this.keyVaultResourceId; + } + + /** + * Set the keyVaultResourceId property: The key vault resource id to access the key vault. + * example: + * "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.KeyVault/vaults/myVault". + * + * @param keyVaultResourceId the keyVaultResourceId value to set. + * @return the SapAgentConfiguration object itself. + */ + public SapAgentConfiguration withKeyVaultResourceId(String keyVaultResourceId) { + this.keyVaultResourceId = keyVaultResourceId; + return this; + } + + /** + * Get the keyVaultAuthenticationMode property: The key mode of the agent. + * ManagedIdentity|ApplicationIdentity are the options. + * + * @return the keyVaultAuthenticationMode value. + */ + public KeyVaultAuthenticationMode keyVaultAuthenticationMode() { + return this.keyVaultAuthenticationMode; + } + + /** + * Set the keyVaultAuthenticationMode property: The key mode of the agent. + * ManagedIdentity|ApplicationIdentity are the options. + * + * @param keyVaultAuthenticationMode the keyVaultAuthenticationMode value to set. + * @return the SapAgentConfiguration object itself. + */ + public SapAgentConfiguration withKeyVaultAuthenticationMode(KeyVaultAuthenticationMode keyVaultAuthenticationMode) { + this.keyVaultAuthenticationMode = keyVaultAuthenticationMode; + return this; + } + + /** + * Get the secretSource property: The secret source of the agent. + * AzureKeyVault is the option. + * + * @return the secretSource value. + */ + public SecretSource secretSource() { + return this.secretSource; + } + + /** + * Set the secretSource property: The secret source of the agent. + * AzureKeyVault is the option. + * + * @param secretSource the secretSource value to set. + * @return the SapAgentConfiguration object itself. + */ + public SapAgentConfiguration withSecretSource(SecretSource secretSource) { + this.secretSource = secretSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("agentContainerName", this.agentContainerName); + jsonWriter.writeStringField("sdkPath", this.sdkPath); + jsonWriter.writeStringField("sncPath", this.sncPath); + jsonWriter.writeStringField("keyVaultResourceId", this.keyVaultResourceId); + jsonWriter.writeStringField("keyVaultAuthenticationMode", + this.keyVaultAuthenticationMode == null ? null : this.keyVaultAuthenticationMode.toString()); + jsonWriter.writeStringField("secretSource", this.secretSource == null ? null : this.secretSource.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SapAgentConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SapAgentConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SapAgentConfiguration. + */ + public static SapAgentConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SapAgentConfiguration deserializedSapAgentConfiguration = new SapAgentConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedSapAgentConfiguration.type = AgentType.fromString(reader.getString()); + } else if ("agentContainerName".equals(fieldName)) { + deserializedSapAgentConfiguration.agentContainerName = reader.getString(); + } else if ("sdkPath".equals(fieldName)) { + deserializedSapAgentConfiguration.sdkPath = reader.getString(); + } else if ("sncPath".equals(fieldName)) { + deserializedSapAgentConfiguration.sncPath = reader.getString(); + } else if ("keyVaultResourceId".equals(fieldName)) { + deserializedSapAgentConfiguration.keyVaultResourceId = reader.getString(); + } else if ("keyVaultAuthenticationMode".equals(fieldName)) { + deserializedSapAgentConfiguration.keyVaultAuthenticationMode + = KeyVaultAuthenticationMode.fromString(reader.getString()); + } else if ("secretSource".equals(fieldName)) { + deserializedSapAgentConfiguration.secretSource = SecretSource.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSapAgentConfiguration; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapAuthenticationType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapAuthenticationType.java new file mode 100644 index 000000000000..f228b7ca68e6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapAuthenticationType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of authentication to SAP. + */ +public final class SapAuthenticationType extends ExpandableStringEnum { + /** + * Static value UsernamePassword for SapAuthenticationType. + */ + public static final SapAuthenticationType USERNAME_PASSWORD = fromString("UsernamePassword"); + + /** + * Static value Snc for SapAuthenticationType. + */ + public static final SapAuthenticationType SNC = fromString("Snc"); + + /** + * Static value SncWithUsernamePassword for SapAuthenticationType. + */ + public static final SapAuthenticationType SNC_WITH_USERNAME_PASSWORD = fromString("SncWithUsernamePassword"); + + /** + * Creates a new instance of SapAuthenticationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SapAuthenticationType() { + } + + /** + * Creates or finds a SapAuthenticationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SapAuthenticationType. + */ + public static SapAuthenticationType fromString(String name) { + return fromString(name, SapAuthenticationType.class); + } + + /** + * Gets known SapAuthenticationType values. + * + * @return known SapAuthenticationType values. + */ + public static Collection values() { + return values(SapAuthenticationType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapControlConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapControlConnector.java new file mode 100644 index 000000000000..ba3aad0d5c53 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapControlConnector.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the SapControl connector configuration. + */ +@Fluent +public final class SapControlConnector extends SystemsConfigurationConnector { + /* + * Represents the types of SAP systems. + */ + private SystemConfigurationConnectorType type = SystemConfigurationConnectorType.SAP_CONTROL; + + /* + * The server name. + * FQDN or IP address. + */ + private String server; + + /* + * The instance number. Only 2 digits are allowed. + */ + private String instance; + + /* + * The timezone. + * example: "GMT+0" or "GMT-8" + * default: "GMT+0" + */ + private String timezone; + + /* + * The port of the SOAP connection to SAP Control. + */ + private String port; + + /* + * Represents the types of HTTPS configuration to connect to the SapControl service. + */ + private HttpsConfigurationType httpsConfiguration; + + /** + * Creates an instance of SapControlConnector class. + */ + public SapControlConnector() { + } + + /** + * Get the type property: Represents the types of SAP systems. + * + * @return the type value. + */ + @Override + public SystemConfigurationConnectorType type() { + return this.type; + } + + /** + * Get the server property: The server name. + * FQDN or IP address. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Set the server property: The server name. + * FQDN or IP address. + * + * @param server the server value to set. + * @return the SapControlConnector object itself. + */ + public SapControlConnector withServer(String server) { + this.server = server; + return this; + } + + /** + * Get the instance property: The instance number. Only 2 digits are allowed. + * + * @return the instance value. + */ + public String instance() { + return this.instance; + } + + /** + * Set the instance property: The instance number. Only 2 digits are allowed. + * + * @param instance the instance value to set. + * @return the SapControlConnector object itself. + */ + public SapControlConnector withInstance(String instance) { + this.instance = instance; + return this; + } + + /** + * Get the timezone property: The timezone. + * example: "GMT+0" or "GMT-8" + * default: "GMT+0". + * + * @return the timezone value. + */ + public String timezone() { + return this.timezone; + } + + /** + * Set the timezone property: The timezone. + * example: "GMT+0" or "GMT-8" + * default: "GMT+0". + * + * @param timezone the timezone value to set. + * @return the SapControlConnector object itself. + */ + public SapControlConnector withTimezone(String timezone) { + this.timezone = timezone; + return this; + } + + /** + * Get the port property: The port of the SOAP connection to SAP Control. + * + * @return the port value. + */ + public String port() { + return this.port; + } + + /** + * Set the port property: The port of the SOAP connection to SAP Control. + * + * @param port the port value to set. + * @return the SapControlConnector object itself. + */ + public SapControlConnector withPort(String port) { + this.port = port; + return this; + } + + /** + * Get the httpsConfiguration property: Represents the types of HTTPS configuration to connect to the SapControl + * service. + * + * @return the httpsConfiguration value. + */ + public HttpsConfigurationType httpsConfiguration() { + return this.httpsConfiguration; + } + + /** + * Set the httpsConfiguration property: Represents the types of HTTPS configuration to connect to the SapControl + * service. + * + * @param httpsConfiguration the httpsConfiguration value to set. + * @return the SapControlConnector object itself. + */ + public SapControlConnector withHttpsConfiguration(HttpsConfigurationType httpsConfiguration) { + this.httpsConfiguration = httpsConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (server() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property server in model SapControlConnector")); + } + if (instance() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property instance in model SapControlConnector")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SapControlConnector.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("server", this.server); + jsonWriter.writeStringField("instance", this.instance); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("timezone", this.timezone); + jsonWriter.writeStringField("port", this.port); + jsonWriter.writeStringField("httpsConfiguration", + this.httpsConfiguration == null ? null : this.httpsConfiguration.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SapControlConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SapControlConnector if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SapControlConnector. + */ + public static SapControlConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SapControlConnector deserializedSapControlConnector = new SapControlConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("server".equals(fieldName)) { + deserializedSapControlConnector.server = reader.getString(); + } else if ("instance".equals(fieldName)) { + deserializedSapControlConnector.instance = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSapControlConnector.type + = SystemConfigurationConnectorType.fromString(reader.getString()); + } else if ("timezone".equals(fieldName)) { + deserializedSapControlConnector.timezone = reader.getString(); + } else if ("port".equals(fieldName)) { + deserializedSapControlConnector.port = reader.getString(); + } else if ("httpsConfiguration".equals(fieldName)) { + deserializedSapControlConnector.httpsConfiguration + = HttpsConfigurationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSapControlConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapSolutionUsageStatistic.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapSolutionUsageStatistic.java new file mode 100644 index 000000000000..c29f9c332828 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapSolutionUsageStatistic.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.BillingStatisticInner; +import com.azure.resourcemanager.securityinsights.fluent.models.SapSolutionUsageStatisticProperties; +import java.io.IOException; + +/** + * Billing statistic about the Microsoft Sentinel solution for SAP Usage. + */ +@Immutable +public final class SapSolutionUsageStatistic extends BillingStatisticInner { + /* + * The kind of the billing statistic + */ + private BillingStatisticKind kind = BillingStatisticKind.SAP_SOLUTION_USAGE; + + /* + * The SAP solution usage object + */ + private SapSolutionUsageStatisticProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Resource Etag. + */ + private String etag; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SapSolutionUsageStatistic class. + */ + public SapSolutionUsageStatistic() { + } + + /** + * Get the kind property: The kind of the billing statistic. + * + * @return the kind value. + */ + @Override + public BillingStatisticKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: The SAP solution usage object. + * + * @return the innerProperties value. + */ + private SapSolutionUsageStatisticProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + @Override + public String etag() { + return this.etag; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the activeSystemIdCount property: The latest count of active SAP system IDs under the Microsoft Sentinel + * solution for SAP Usage. + * + * @return the activeSystemIdCount value. + */ + public Long activeSystemIdCount() { + return this.innerProperties() == null ? null : this.innerProperties().activeSystemIdCount(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SapSolutionUsageStatistic from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SapSolutionUsageStatistic if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SapSolutionUsageStatistic. + */ + public static SapSolutionUsageStatistic fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SapSolutionUsageStatistic deserializedSapSolutionUsageStatistic = new SapSolutionUsageStatistic(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSapSolutionUsageStatistic.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSapSolutionUsageStatistic.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSapSolutionUsageStatistic.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedSapSolutionUsageStatistic.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedSapSolutionUsageStatistic.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedSapSolutionUsageStatistic.kind = BillingStatisticKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedSapSolutionUsageStatistic.innerProperties + = SapSolutionUsageStatisticProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSapSolutionUsageStatistic; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapSystemsConfiguration.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapSystemsConfiguration.java new file mode 100644 index 000000000000..a36909d6d98a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SapSystemsConfiguration.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes the SAP configuration. + */ +@Fluent +public final class SapSystemsConfiguration extends SystemsConfiguration { + /* + * Represents the types of configuration for a system. + */ + private ConfigurationType type = ConfigurationType.SAP; + + /* + * azure resource id + * example: + * "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + */ + private String azureResourceId; + + /* + * Base Model for SAP System Connector. + */ + private SystemsConfigurationConnector connector; + + /* + * The logs configuration. + */ + private List logs; + + /** + * Creates an instance of SapSystemsConfiguration class. + */ + public SapSystemsConfiguration() { + } + + /** + * Get the type property: Represents the types of configuration for a system. + * + * @return the type value. + */ + @Override + public ConfigurationType type() { + return this.type; + } + + /** + * Get the azureResourceId property: azure resource id + * example: + * "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM". + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: azure resource id + * example: + * "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM". + * + * @param azureResourceId the azureResourceId value to set. + * @return the SapSystemsConfiguration object itself. + */ + public SapSystemsConfiguration withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the connector property: Base Model for SAP System Connector. + * + * @return the connector value. + */ + public SystemsConfigurationConnector connector() { + return this.connector; + } + + /** + * Set the connector property: Base Model for SAP System Connector. + * + * @param connector the connector value to set. + * @return the SapSystemsConfiguration object itself. + */ + public SapSystemsConfiguration withConnector(SystemsConfigurationConnector connector) { + this.connector = connector; + return this; + } + + /** + * Get the logs property: The logs configuration. + * + * @return the logs value. + */ + public List logs() { + return this.logs; + } + + /** + * Set the logs property: The logs configuration. + * + * @param logs the logs value to set. + * @return the SapSystemsConfiguration object itself. + */ + public SapSystemsConfiguration withLogs(List logs) { + this.logs = logs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (connector() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connector in model SapSystemsConfiguration")); + } else { + connector().validate(); + } + if (logs() != null) { + logs().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SapSystemsConfiguration.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("connector", this.connector); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("azureResourceId", this.azureResourceId); + jsonWriter.writeArrayField("logs", this.logs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SapSystemsConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SapSystemsConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SapSystemsConfiguration. + */ + public static SapSystemsConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SapSystemsConfiguration deserializedSapSystemsConfiguration = new SapSystemsConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connector".equals(fieldName)) { + deserializedSapSystemsConfiguration.connector = SystemsConfigurationConnector.fromJson(reader); + } else if ("type".equals(fieldName)) { + deserializedSapSystemsConfiguration.type = ConfigurationType.fromString(reader.getString()); + } else if ("azureResourceId".equals(fieldName)) { + deserializedSapSystemsConfiguration.azureResourceId = reader.getString(); + } else if ("logs".equals(fieldName)) { + List logs = reader.readArray(reader1 -> Log.fromJson(reader1)); + deserializedSapSystemsConfiguration.logs = logs; + } else { + reader.skipChildren(); + } + } + + return deserializedSapSystemsConfiguration; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRule.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRule.java index d199153e33c2..6b0905046f87 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRule.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRule.java @@ -23,7 +23,7 @@ @Fluent public final class ScheduledAlertRule extends AlertRuleInner { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.SCHEDULED; @@ -59,7 +59,7 @@ public ScheduledAlertRule() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ @@ -348,6 +348,29 @@ public ScheduledAlertRule withTechniques(List techniques) { return this; } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().subTechniques(); + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the ScheduledAlertRule object itself. + */ + public ScheduledAlertRule withSubTechniques(List subTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledAlertRuleProperties(); + } + this.innerProperties().withSubTechniques(subTechniques); + return this; + } + /** * Get the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this * analytics rule. @@ -603,6 +626,29 @@ public ScheduledAlertRule withAlertDetailsOverride(AlertDetailsOverride alertDet return this; } + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.innerProperties() == null ? null : this.innerProperties().sentinelEntitiesMappings(); + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the ScheduledAlertRule object itself. + */ + public ScheduledAlertRule withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledAlertRuleProperties(); + } + this.innerProperties().withSentinelEntitiesMappings(sentinelEntitiesMappings); + return this; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleCommonProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleCommonProperties.java index e0a0ccfdb7eb..ce19186df95d 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleCommonProperties.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleCommonProperties.java @@ -70,6 +70,11 @@ public class ScheduledAlertRuleCommonProperties implements JsonSerializable sentinelEntitiesMappings; + /** * Creates an instance of ScheduledAlertRuleCommonProperties class. */ @@ -276,6 +281,27 @@ public ScheduledAlertRuleCommonProperties withAlertDetailsOverride(AlertDetailsO return this; } + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.sentinelEntitiesMappings; + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the ScheduledAlertRuleCommonProperties object itself. + */ + public ScheduledAlertRuleCommonProperties + withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + this.sentinelEntitiesMappings = sentinelEntitiesMappings; + return this; + } + /** * Validates the instance. * @@ -291,6 +317,9 @@ public void validate() { if (alertDetailsOverride() != null) { alertDetailsOverride().validate(); } + if (sentinelEntitiesMappings() != null) { + sentinelEntitiesMappings().forEach(e -> e.validate()); + } } /** @@ -311,6 +340,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeArrayField("entityMappings", this.entityMappings, (writer, element) -> writer.writeJson(element)); jsonWriter.writeJsonField("alertDetailsOverride", this.alertDetailsOverride); + jsonWriter.writeArrayField("sentinelEntitiesMappings", this.sentinelEntitiesMappings, + (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -359,6 +390,10 @@ public static ScheduledAlertRuleCommonProperties fromJson(JsonReader jsonReader) } else if ("alertDetailsOverride".equals(fieldName)) { deserializedScheduledAlertRuleCommonProperties.alertDetailsOverride = AlertDetailsOverride.fromJson(reader); + } else if ("sentinelEntitiesMappings".equals(fieldName)) { + List sentinelEntitiesMappings + = reader.readArray(reader1 -> SentinelEntityMapping.fromJson(reader1)); + deserializedScheduledAlertRuleCommonProperties.sentinelEntitiesMappings = sentinelEntitiesMappings; } else { reader.skipChildren(); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleTemplate.java index 69cca8631181..04c5532614e5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleTemplate.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ScheduledAlertRuleTemplate.java @@ -23,7 +23,7 @@ @Fluent public final class ScheduledAlertRuleTemplate extends AlertRuleTemplateInner { /* - * The alert rule kind + * The kind of the alert rule */ private AlertRuleKind kind = AlertRuleKind.SCHEDULED; @@ -59,7 +59,7 @@ public ScheduledAlertRuleTemplate() { } /** - * Get the kind property: The alert rule kind. + * Get the kind property: The kind of the alert rule. * * @return the kind value. */ @@ -413,7 +413,7 @@ public ScheduledAlertRuleTemplate withTactics(List tactics) { } /** - * Get the techniques property: The techniques of the alert rule template. + * Get the techniques property: The techniques of the alert rule. * * @return the techniques value. */ @@ -422,7 +422,7 @@ public List techniques() { } /** - * Set the techniques property: The techniques of the alert rule template. + * Set the techniques property: The techniques of the alert rule. * * @param techniques the techniques value to set. * @return the ScheduledAlertRuleTemplate object itself. @@ -435,6 +435,29 @@ public ScheduledAlertRuleTemplate withTechniques(List techniques) { return this; } + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().subTechniques(); + } + + /** + * Set the subTechniques property: The sub-techniques of the alert rule. + * + * @param subTechniques the subTechniques value to set. + * @return the ScheduledAlertRuleTemplate object itself. + */ + public ScheduledAlertRuleTemplate withSubTechniques(List subTechniques) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledAlertRuleTemplateProperties(); + } + this.innerProperties().withSubTechniques(subTechniques); + return this; + } + /** * Get the version property: The version of this template - in format <a.b.c>, where all are numbers. For * example <1.0.2>. @@ -552,6 +575,30 @@ public ScheduledAlertRuleTemplate withAlertDetailsOverride(AlertDetailsOverride return this; } + /** + * Get the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @return the sentinelEntitiesMappings value. + */ + public List sentinelEntitiesMappings() { + return this.innerProperties() == null ? null : this.innerProperties().sentinelEntitiesMappings(); + } + + /** + * Set the sentinelEntitiesMappings property: Array of the sentinel entity mappings of the alert rule. + * + * @param sentinelEntitiesMappings the sentinelEntitiesMappings value to set. + * @return the ScheduledAlertRuleTemplate object itself. + */ + public ScheduledAlertRuleTemplate + withSentinelEntitiesMappings(List sentinelEntitiesMappings) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledAlertRuleTemplateProperties(); + } + this.innerProperties().withSentinelEntitiesMappings(sentinelEntitiesMappings); + return this; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecretSource.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecretSource.java new file mode 100644 index 000000000000..dfc3d642d1ed --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecretSource.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type for Secret Source - Azure Key Vault. + */ +public final class SecretSource extends ExpandableStringEnum { + /** + * Static value AzureKeyVault for SecretSource. + */ + public static final SecretSource AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates a new instance of SecretSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecretSource() { + } + + /** + * Creates or finds a SecretSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecretSource. + */ + public static SecretSource fromString(String name) { + return fromString(name, SecretSource.class); + } + + /** + * Gets known SecretSource values. + * + * @return known SecretSource values. + */ + public static Collection values() { + return values(SecretSource.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityAlert.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityAlert.java index b2ca2bf368a3..4ca51ad7e30b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityAlert.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityAlert.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.SecurityAlertProperties; import java.io.IOException; import java.time.OffsetDateTime; @@ -19,7 +20,7 @@ * Represents a security alert entity. */ @Fluent -public final class SecurityAlert extends Entity { +public final class SecurityAlert extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityAlertTimelineItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityAlertTimelineItem.java new file mode 100644 index 000000000000..e32ed5a6c402 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityAlertTimelineItem.java @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Represents security alert timeline item. + */ +@Fluent +public final class SecurityAlertTimelineItem extends EntityTimelineItem { + /* + * The entity query kind type. + */ + private EntityTimelineKind kind = EntityTimelineKind.SECURITY_ALERT; + + /* + * The alert azure resource id. + */ + private String azureResourceId; + + /* + * The alert product name. + */ + private String productName; + + /* + * The alert description. + */ + private String description; + + /* + * The alert name. + */ + private String displayName; + + /* + * The alert severity. + */ + private AlertSeverity severity; + + /* + * The alert end time. + */ + private OffsetDateTime endTimeUtc; + + /* + * The alert start time. + */ + private OffsetDateTime startTimeUtc; + + /* + * The alert generated time. + */ + private OffsetDateTime timeGenerated; + + /* + * The name of the alert type. + */ + private String alertType; + + /* + * The intent of the alert. + */ + private KillChainIntent intent; + + /* + * The techniques of the alert. + */ + private List techniques; + + /** + * Creates an instance of SecurityAlertTimelineItem class. + */ + public SecurityAlertTimelineItem() { + } + + /** + * Get the kind property: The entity query kind type. + * + * @return the kind value. + */ + @Override + public EntityTimelineKind kind() { + return this.kind; + } + + /** + * Get the azureResourceId property: The alert azure resource id. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: The alert azure resource id. + * + * @param azureResourceId the azureResourceId value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the productName property: The alert product name. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Set the productName property: The alert product name. + * + * @param productName the productName value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withProductName(String productName) { + this.productName = productName; + return this; + } + + /** + * Get the description property: The alert description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The alert description. + * + * @param description the description value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the displayName property: The alert name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The alert name. + * + * @param displayName the displayName value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the severity property: The alert severity. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: The alert severity. + * + * @param severity the severity value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the endTimeUtc property: The alert end time. + * + * @return the endTimeUtc value. + */ + public OffsetDateTime endTimeUtc() { + return this.endTimeUtc; + } + + /** + * Set the endTimeUtc property: The alert end time. + * + * @param endTimeUtc the endTimeUtc value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withEndTimeUtc(OffsetDateTime endTimeUtc) { + this.endTimeUtc = endTimeUtc; + return this; + } + + /** + * Get the startTimeUtc property: The alert start time. + * + * @return the startTimeUtc value. + */ + public OffsetDateTime startTimeUtc() { + return this.startTimeUtc; + } + + /** + * Set the startTimeUtc property: The alert start time. + * + * @param startTimeUtc the startTimeUtc value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withStartTimeUtc(OffsetDateTime startTimeUtc) { + this.startTimeUtc = startTimeUtc; + return this; + } + + /** + * Get the timeGenerated property: The alert generated time. + * + * @return the timeGenerated value. + */ + public OffsetDateTime timeGenerated() { + return this.timeGenerated; + } + + /** + * Set the timeGenerated property: The alert generated time. + * + * @param timeGenerated the timeGenerated value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withTimeGenerated(OffsetDateTime timeGenerated) { + this.timeGenerated = timeGenerated; + return this; + } + + /** + * Get the alertType property: The name of the alert type. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Set the alertType property: The name of the alert type. + * + * @param alertType the alertType value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withAlertType(String alertType) { + this.alertType = alertType; + return this; + } + + /** + * Get the intent property: The intent of the alert. + * + * @return the intent value. + */ + public KillChainIntent intent() { + return this.intent; + } + + /** + * Get the techniques property: The techniques of the alert. + * + * @return the techniques value. + */ + public List techniques() { + return this.techniques; + } + + /** + * Set the techniques property: The techniques of the alert. + * + * @param techniques the techniques value to set. + * @return the SecurityAlertTimelineItem object itself. + */ + public SecurityAlertTimelineItem withTechniques(List techniques) { + this.techniques = techniques; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (azureResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureResourceId in model SecurityAlertTimelineItem")); + } + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property displayName in model SecurityAlertTimelineItem")); + } + if (severity() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property severity in model SecurityAlertTimelineItem")); + } + if (endTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endTimeUtc in model SecurityAlertTimelineItem")); + } + if (startTimeUtc() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startTimeUtc in model SecurityAlertTimelineItem")); + } + if (timeGenerated() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeGenerated in model SecurityAlertTimelineItem")); + } + if (alertType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property alertType in model SecurityAlertTimelineItem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityAlertTimelineItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureResourceId", this.azureResourceId); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("endTimeUtc", + this.endTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTimeUtc)); + jsonWriter.writeStringField("startTimeUtc", + this.startTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTimeUtc)); + jsonWriter.writeStringField("timeGenerated", + this.timeGenerated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timeGenerated)); + jsonWriter.writeStringField("alertType", this.alertType); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("productName", this.productName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAlertTimelineItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAlertTimelineItem if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAlertTimelineItem. + */ + public static SecurityAlertTimelineItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAlertTimelineItem deserializedSecurityAlertTimelineItem = new SecurityAlertTimelineItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureResourceId".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.azureResourceId = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.displayName = reader.getString(); + } else if ("severity".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.severity = AlertSeverity.fromString(reader.getString()); + } else if ("endTimeUtc".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.endTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("startTimeUtc".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.startTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("timeGenerated".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.timeGenerated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("alertType".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.alertType = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.kind = EntityTimelineKind.fromString(reader.getString()); + } else if ("productName".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.productName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.description = reader.getString(); + } else if ("intent".equals(fieldName)) { + deserializedSecurityAlertTimelineItem.intent = KillChainIntent.fromString(reader.getString()); + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityAlertTimelineItem.techniques = techniques; + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAlertTimelineItem; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityGroupEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityGroupEntity.java index 67006853c1a5..50fe5a784035 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityGroupEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SecurityGroupEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.SecurityGroupEntityProperties; import java.io.IOException; import java.util.Map; @@ -18,7 +19,7 @@ * Represents a security group entity. */ @Immutable -public final class SecurityGroupEntity extends Entity { +public final class SecurityGroupEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SentinelEntityMapping.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SentinelEntityMapping.java new file mode 100644 index 000000000000..a52ed30d5aff --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SentinelEntityMapping.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A single sentinel entity mapping. + */ +@Fluent +public final class SentinelEntityMapping implements JsonSerializable { + /* + * the column name to be mapped to the SentinelEntities + */ + private String columnName; + + /** + * Creates an instance of SentinelEntityMapping class. + */ + public SentinelEntityMapping() { + } + + /** + * Get the columnName property: the column name to be mapped to the SentinelEntities. + * + * @return the columnName value. + */ + public String columnName() { + return this.columnName; + } + + /** + * Set the columnName property: the column name to be mapped to the SentinelEntities. + * + * @param columnName the columnName value to set. + * @return the SentinelEntityMapping object itself. + */ + public SentinelEntityMapping withColumnName(String columnName) { + this.columnName = columnName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("columnName", this.columnName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SentinelEntityMapping from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SentinelEntityMapping if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SentinelEntityMapping. + */ + public static SentinelEntityMapping fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SentinelEntityMapping deserializedSentinelEntityMapping = new SentinelEntityMapping(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("columnName".equals(fieldName)) { + deserializedSentinelEntityMapping.columnName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSentinelEntityMapping; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ServicePrincipal.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ServicePrincipal.java new file mode 100644 index 000000000000..be18038b60e7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ServicePrincipal.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Service principal metadata. + */ +@Fluent +public final class ServicePrincipal implements JsonSerializable { + /* + * Id of service principal. + */ + private String id; + + /* + * Tenant id of service principal. + */ + private String tenantId; + + /* + * App id of service principal. + */ + private String appId; + + /* + * Expiration time of service principal credentials. + */ + private OffsetDateTime credentialsExpireOn; + + /** + * Creates an instance of ServicePrincipal class. + */ + public ServicePrincipal() { + } + + /** + * Get the id property: Id of service principal. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the tenantId property: Tenant id of service principal. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the appId property: App id of service principal. + * + * @return the appId value. + */ + public String appId() { + return this.appId; + } + + /** + * Get the credentialsExpireOn property: Expiration time of service principal credentials. + * + * @return the credentialsExpireOn value. + */ + public OffsetDateTime credentialsExpireOn() { + return this.credentialsExpireOn; + } + + /** + * Set the credentialsExpireOn property: Expiration time of service principal credentials. + * + * @param credentialsExpireOn the credentialsExpireOn value to set. + * @return the ServicePrincipal object itself. + */ + public ServicePrincipal withCredentialsExpireOn(OffsetDateTime credentialsExpireOn) { + this.credentialsExpireOn = credentialsExpireOn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("credentialsExpireOn", + this.credentialsExpireOn == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.credentialsExpireOn)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServicePrincipal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServicePrincipal if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ServicePrincipal. + */ + public static ServicePrincipal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServicePrincipal deserializedServicePrincipal = new ServicePrincipal(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServicePrincipal.id = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedServicePrincipal.tenantId = reader.getString(); + } else if ("appId".equals(fieldName)) { + deserializedServicePrincipal.appId = reader.getString(); + } else if ("credentialsExpireOn".equals(fieldName)) { + deserializedServicePrincipal.credentialsExpireOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedServicePrincipal; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SessionAuthModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SessionAuthModel.java new file mode 100644 index 000000000000..401f5b57454b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SessionAuthModel.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Model for API authentication with session cookie. + */ +@Fluent +public final class SessionAuthModel extends CcpAuthConfig { + /* + * The auth type + */ + private CcpAuthType type = CcpAuthType.SESSION; + + /* + * The user name attribute key value. + */ + private Map username; + + /* + * The password attribute name. + */ + private Map password; + + /* + * Query parameters to session service endpoint. + */ + private Map queryParameters; + + /* + * Indicating whether API key is set in HTTP POST payload. + */ + private Boolean isPostPayloadJson; + + /* + * HTTP request headers to session service endpoint. + */ + private Map headers; + + /* + * Session timeout in minutes. + */ + private Integer sessionTimeoutInMinutes; + + /* + * Session id attribute name from HTTP response header. + */ + private String sessionIdName; + + /* + * HTTP request URL to session service endpoint. + */ + private String sessionLoginRequestUri; + + /** + * Creates an instance of SessionAuthModel class. + */ + public SessionAuthModel() { + } + + /** + * Get the type property: The auth type. + * + * @return the type value. + */ + @Override + public CcpAuthType type() { + return this.type; + } + + /** + * Get the username property: The user name attribute key value. + * + * @return the username value. + */ + public Map username() { + return this.username; + } + + /** + * Set the username property: The user name attribute key value. + * + * @param username the username value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withUsername(Map username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password attribute name. + * + * @return the password value. + */ + public Map password() { + return this.password; + } + + /** + * Set the password property: The password attribute name. + * + * @param password the password value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withPassword(Map password) { + this.password = password; + return this; + } + + /** + * Get the queryParameters property: Query parameters to session service endpoint. + * + * @return the queryParameters value. + */ + public Map queryParameters() { + return this.queryParameters; + } + + /** + * Set the queryParameters property: Query parameters to session service endpoint. + * + * @param queryParameters the queryParameters value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withQueryParameters(Map queryParameters) { + this.queryParameters = queryParameters; + return this; + } + + /** + * Get the isPostPayloadJson property: Indicating whether API key is set in HTTP POST payload. + * + * @return the isPostPayloadJson value. + */ + public Boolean isPostPayloadJson() { + return this.isPostPayloadJson; + } + + /** + * Set the isPostPayloadJson property: Indicating whether API key is set in HTTP POST payload. + * + * @param isPostPayloadJson the isPostPayloadJson value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withIsPostPayloadJson(Boolean isPostPayloadJson) { + this.isPostPayloadJson = isPostPayloadJson; + return this; + } + + /** + * Get the headers property: HTTP request headers to session service endpoint. + * + * @return the headers value. + */ + public Map headers() { + return this.headers; + } + + /** + * Set the headers property: HTTP request headers to session service endpoint. + * + * @param headers the headers value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withHeaders(Map headers) { + this.headers = headers; + return this; + } + + /** + * Get the sessionTimeoutInMinutes property: Session timeout in minutes. + * + * @return the sessionTimeoutInMinutes value. + */ + public Integer sessionTimeoutInMinutes() { + return this.sessionTimeoutInMinutes; + } + + /** + * Set the sessionTimeoutInMinutes property: Session timeout in minutes. + * + * @param sessionTimeoutInMinutes the sessionTimeoutInMinutes value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withSessionTimeoutInMinutes(Integer sessionTimeoutInMinutes) { + this.sessionTimeoutInMinutes = sessionTimeoutInMinutes; + return this; + } + + /** + * Get the sessionIdName property: Session id attribute name from HTTP response header. + * + * @return the sessionIdName value. + */ + public String sessionIdName() { + return this.sessionIdName; + } + + /** + * Set the sessionIdName property: Session id attribute name from HTTP response header. + * + * @param sessionIdName the sessionIdName value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withSessionIdName(String sessionIdName) { + this.sessionIdName = sessionIdName; + return this; + } + + /** + * Get the sessionLoginRequestUri property: HTTP request URL to session service endpoint. + * + * @return the sessionLoginRequestUri value. + */ + public String sessionLoginRequestUri() { + return this.sessionLoginRequestUri; + } + + /** + * Set the sessionLoginRequestUri property: HTTP request URL to session service endpoint. + * + * @param sessionLoginRequestUri the sessionLoginRequestUri value to set. + * @return the SessionAuthModel object itself. + */ + public SessionAuthModel withSessionLoginRequestUri(String sessionLoginRequestUri) { + this.sessionLoginRequestUri = sessionLoginRequestUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (username() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property username in model SessionAuthModel")); + } + if (password() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property password in model SessionAuthModel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SessionAuthModel.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("userName", this.username, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("password", this.password, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("queryParameters", this.queryParameters, + (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeBooleanField("isPostPayloadJson", this.isPostPayloadJson); + jsonWriter.writeMapField("headers", this.headers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("sessionTimeoutInMinutes", this.sessionTimeoutInMinutes); + jsonWriter.writeStringField("sessionIdName", this.sessionIdName); + jsonWriter.writeStringField("sessionLoginRequestUri", this.sessionLoginRequestUri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SessionAuthModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SessionAuthModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SessionAuthModel. + */ + public static SessionAuthModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SessionAuthModel deserializedSessionAuthModel = new SessionAuthModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userName".equals(fieldName)) { + Map username = reader.readMap(reader1 -> reader1.getString()); + deserializedSessionAuthModel.username = username; + } else if ("password".equals(fieldName)) { + Map password = reader.readMap(reader1 -> reader1.getString()); + deserializedSessionAuthModel.password = password; + } else if ("type".equals(fieldName)) { + deserializedSessionAuthModel.type = CcpAuthType.fromString(reader.getString()); + } else if ("queryParameters".equals(fieldName)) { + Map queryParameters = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedSessionAuthModel.queryParameters = queryParameters; + } else if ("isPostPayloadJson".equals(fieldName)) { + deserializedSessionAuthModel.isPostPayloadJson = reader.getNullable(JsonReader::getBoolean); + } else if ("headers".equals(fieldName)) { + Map headers = reader.readMap(reader1 -> reader1.getString()); + deserializedSessionAuthModel.headers = headers; + } else if ("sessionTimeoutInMinutes".equals(fieldName)) { + deserializedSessionAuthModel.sessionTimeoutInMinutes = reader.getNullable(JsonReader::getInt); + } else if ("sessionIdName".equals(fieldName)) { + deserializedSessionAuthModel.sessionIdName = reader.getString(); + } else if ("sessionLoginRequestUri".equals(fieldName)) { + deserializedSessionAuthModel.sessionLoginRequestUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSessionAuthModel; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingKind.java new file mode 100644 index 000000000000..1a4ddb70044f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingKind.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the setting. + */ +public final class SettingKind extends ExpandableStringEnum { + /** + * Static value Anomalies for SettingKind. + */ + public static final SettingKind ANOMALIES = fromString("Anomalies"); + + /** + * Static value EyesOn for SettingKind. + */ + public static final SettingKind EYES_ON = fromString("EyesOn"); + + /** + * Static value EntityAnalytics for SettingKind. + */ + public static final SettingKind ENTITY_ANALYTICS = fromString("EntityAnalytics"); + + /** + * Static value Ueba for SettingKind. + */ + public static final SettingKind UEBA = fromString("Ueba"); + + /** + * Creates a new instance of SettingKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SettingKind() { + } + + /** + * Creates or finds a SettingKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding SettingKind. + */ + public static SettingKind fromString(String name) { + return fromString(name, SettingKind.class); + } + + /** + * Gets known SettingKind values. + * + * @return known SettingKind values. + */ + public static Collection values() { + return values(SettingKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingList.java new file mode 100644 index 000000000000..54f525a25165 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the settings. + */ +@Fluent +public final class SettingList implements JsonSerializable { + /* + * Array of settings. + */ + private List value; + + /* + * URL to fetch the next set of settings. + */ + private String nextLink; + + /** + * Creates an instance of SettingList class. + */ + public SettingList() { + } + + /** + * Get the value property: Array of settings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of settings. + * + * @param value the value value to set. + * @return the SettingList object itself. + */ + public SettingList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to fetch the next set of settings. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SettingList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SettingList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SettingList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SettingList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SettingList. + */ + public static SettingList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SettingList deserializedSettingList = new SettingList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SettingsInner.fromJson(reader1)); + deserializedSettingList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSettingList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSettingList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingType.java new file mode 100644 index 000000000000..343af240b3f6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SettingType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the setting. + */ +public final class SettingType extends ExpandableStringEnum { + /** + * Static value CopyableLabel for SettingType. + */ + public static final SettingType COPYABLE_LABEL = fromString("CopyableLabel"); + + /** + * Static value InstructionStepsGroup for SettingType. + */ + public static final SettingType INSTRUCTION_STEPS_GROUP = fromString("InstructionStepsGroup"); + + /** + * Static value InfoMessage for SettingType. + */ + public static final SettingType INFO_MESSAGE = fromString("InfoMessage"); + + /** + * Creates a new instance of SettingType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SettingType() { + } + + /** + * Creates or finds a SettingType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SettingType. + */ + public static SettingType fromString(String name) { + return fromString(name, SettingType.class); + } + + /** + * Gets known SettingType values. + * + * @return known SettingType values. + */ + public static Collection values() { + return values(SettingType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Settings.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Settings.java new file mode 100644 index 000000000000..a709698a3024 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Settings.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; + +/** + * An immutable client-side representation of Settings. + */ +public interface Settings { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the kind property: The kind of the setting. + * + * @return the kind value. + */ + SettingKind kind(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner object. + * + * @return the inner object. + */ + SettingsInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SortingDirection.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SortingDirection.java new file mode 100644 index 000000000000..f058a162f17d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SortingDirection.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The direction to sort the results by. + */ +public final class SortingDirection extends ExpandableStringEnum { + /** + * Static value ASC for SortingDirection. + */ + public static final SortingDirection ASC = fromString("ASC"); + + /** + * Static value DESC for SortingDirection. + */ + public static final SortingDirection DESC = fromString("DESC"); + + /** + * Creates a new instance of SortingDirection value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SortingDirection() { + } + + /** + * Creates or finds a SortingDirection from its string representation. + * + * @param name a name to look for. + * @return the corresponding SortingDirection. + */ + public static SortingDirection fromString(String name) { + return fromString(name, SortingDirection.class); + } + + /** + * Gets known SortingDirection values. + * + * @return known SortingDirection values. + */ + public static Collection values() { + return values(SortingDirection.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Source.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Source.java deleted file mode 100644 index e0c50875065b..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Source.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The source of the watchlist. - */ -public final class Source extends ExpandableStringEnum { - /** - * Static value Local file for Source. - */ - public static final Source LOCAL_FILE = fromString("Local file"); - - /** - * Static value Remote storage for Source. - */ - public static final Source REMOTE_STORAGE = fromString("Remote storage"); - - /** - * Creates a new instance of Source value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public Source() { - } - - /** - * Creates or finds a Source from its string representation. - * - * @param name a name to look for. - * @return the corresponding Source. - */ - public static Source fromString(String name) { - return fromString(name, Source.class); - } - - /** - * Gets known Source values. - * - * @return known Source values. - */ - public static Collection values() { - return values(Source.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControl.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControl.java new file mode 100644 index 000000000000..e9f7ce516c66 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControl.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.RepositoryAccess; +import com.azure.resourcemanager.securityinsights.fluent.models.SourceControlInner; +import java.util.List; + +/** + * An immutable client-side representation of SourceControl. + */ +public interface SourceControl { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the idPropertiesId property: The id (a Guid) of the source control. + * + * @return the idPropertiesId value. + */ + String idPropertiesId(); + + /** + * Gets the version property: The version number associated with the source control. + * + * @return the version value. + */ + Version version(); + + /** + * Gets the displayName property: The display name of the source control. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: A description of the source control. + * + * @return the description value. + */ + String description(); + + /** + * Gets the repoType property: The repository type of the source control. + * + * @return the repoType value. + */ + RepoType repoType(); + + /** + * Gets the contentTypes property: Array of source control content types. + * + * @return the contentTypes value. + */ + List contentTypes(); + + /** + * Gets the repository property: Repository metadata. + * + * @return the repository value. + */ + Repository repository(); + + /** + * Gets the servicePrincipal property: Service principal metadata. + * + * @return the servicePrincipal value. + */ + ServicePrincipal servicePrincipal(); + + /** + * Gets the repositoryAccess property: Repository access credentials. This is write-only object and it never returns + * back to a user. + * + * @return the repositoryAccess value. + */ + RepositoryAccess repositoryAccess(); + + /** + * Gets the repositoryResourceInfo property: Information regarding the resources created in user's repository. + * + * @return the repositoryResourceInfo value. + */ + RepositoryResourceInfo repositoryResourceInfo(); + + /** + * Gets the lastDeploymentInfo property: Information regarding the latest deployment for the source control. + * + * @return the lastDeploymentInfo value. + */ + DeploymentInfo lastDeploymentInfo(); + + /** + * Gets the pullRequest property: Information regarding the pull request of the source control. + * + * @return the pullRequest value. + */ + PullRequest pullRequest(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.SourceControlInner object. + * + * @return the inner object. + */ + SourceControlInner innerModel(); + + /** + * The entirety of the SourceControl definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithDisplayName, DefinitionStages.WithRepoType, DefinitionStages.WithContentTypes, + DefinitionStages.WithRepository, DefinitionStages.WithCreate { + } + + /** + * The SourceControl definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SourceControl definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SourceControl definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithDisplayName withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the SourceControl definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the source control. + * + * @param displayName The display name of the source control. + * @return the next definition stage. + */ + WithRepoType withDisplayName(String displayName); + } + + /** + * The stage of the SourceControl definition allowing to specify repoType. + */ + interface WithRepoType { + /** + * Specifies the repoType property: The repository type of the source control. + * + * @param repoType The repository type of the source control. + * @return the next definition stage. + */ + WithContentTypes withRepoType(RepoType repoType); + } + + /** + * The stage of the SourceControl definition allowing to specify contentTypes. + */ + interface WithContentTypes { + /** + * Specifies the contentTypes property: Array of source control content types.. + * + * @param contentTypes Array of source control content types. + * @return the next definition stage. + */ + WithRepository withContentTypes(List contentTypes); + } + + /** + * The stage of the SourceControl definition allowing to specify repository. + */ + interface WithRepository { + /** + * Specifies the repository property: Repository metadata.. + * + * @param repository Repository metadata. + * @return the next definition stage. + */ + WithCreate withRepository(Repository repository); + } + + /** + * The stage of the SourceControl definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithEtag, DefinitionStages.WithDescription, DefinitionStages.WithServicePrincipal, + DefinitionStages.WithRepositoryAccess, DefinitionStages.WithRepositoryResourceInfo { + /** + * Executes the create request. + * + * @return the created resource. + */ + SourceControl create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SourceControl create(Context context); + } + + /** + * The stage of the SourceControl definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the SourceControl definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: A description of the source control. + * + * @param description A description of the source control. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the SourceControl definition allowing to specify servicePrincipal. + */ + interface WithServicePrincipal { + /** + * Specifies the servicePrincipal property: Service principal metadata.. + * + * @param servicePrincipal Service principal metadata. + * @return the next definition stage. + */ + WithCreate withServicePrincipal(ServicePrincipal servicePrincipal); + } + + /** + * The stage of the SourceControl definition allowing to specify repositoryAccess. + */ + interface WithRepositoryAccess { + /** + * Specifies the repositoryAccess property: Repository access credentials. This is write-only object and it + * never returns back to a user.. + * + * @param repositoryAccess Repository access credentials. This is write-only object and it never returns + * back to a user. + * @return the next definition stage. + */ + WithCreate withRepositoryAccess(RepositoryAccess repositoryAccess); + } + + /** + * The stage of the SourceControl definition allowing to specify repositoryResourceInfo. + */ + interface WithRepositoryResourceInfo { + /** + * Specifies the repositoryResourceInfo property: Information regarding the resources created in user's + * repository.. + * + * @param repositoryResourceInfo Information regarding the resources created in user's repository. + * @return the next definition stage. + */ + WithCreate withRepositoryResourceInfo(RepositoryResourceInfo repositoryResourceInfo); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SourceControl refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SourceControl refresh(Context context); + + /** + * Delete a source control. + * + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure along with {@link Response}. + */ + Response deleteWithResponse(RepositoryAccessProperties repositoryAccess, Context context); + + /** + * Delete a source control. + * + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure. + */ + Warning delete(RepositoryAccessProperties repositoryAccess); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControlList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControlList.java new file mode 100644 index 000000000000..49adb211ec75 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControlList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.SourceControlInner; +import java.io.IOException; +import java.util.List; + +/** + * List all the source controls. + */ +@Fluent +public final class SourceControlList implements JsonSerializable { + /* + * URL to fetch the next set of source controls. + */ + private String nextLink; + + /* + * Array of source controls. + */ + private List value; + + /** + * Creates an instance of SourceControlList class. + */ + public SourceControlList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of source controls. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of source controls. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of source controls. + * + * @param value the value value to set. + * @return the SourceControlList object itself. + */ + public SourceControlList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SourceControlList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SourceControlList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceControlList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceControlList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SourceControlList. + */ + public static SourceControlList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceControlList deserializedSourceControlList = new SourceControlList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SourceControlInner.fromJson(reader1)); + deserializedSourceControlList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSourceControlList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceControlList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControls.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControls.java new file mode 100644 index 000000000000..64074be53bde --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControls.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of SourceControls. + */ +public interface SourceControls { + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedIterable}. + */ + PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess); + + /** + * Gets a list of repositories metadata. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of repositories metadata as paginated response with {@link PagedIterable}. + */ + PagedIterable listRepositories(String resourceGroupName, String workspaceName, + RepositoryAccessProperties repositoryAccess, Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControlsOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControlsOperations.java new file mode 100644 index 000000000000..808e6ea61c22 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceControlsOperations.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of SourceControlsOperations. + */ +public interface SourceControlsOperations { + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all source controls, without source control items. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all source controls, without source control items as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, Context context); + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String sourceControlId, + Context context); + + /** + * Gets a source control byt its identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier. + */ + SourceControl get(String resourceGroupName, String workspaceName, String sourceControlId); + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure along with {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess, Context context); + + /** + * Delete a source control. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param sourceControlId Source control Id. + * @param repositoryAccess The repository access credentials. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return warning response structure. + */ + Warning delete(String resourceGroupName, String workspaceName, String sourceControlId, + RepositoryAccessProperties repositoryAccess); + + /** + * Gets a source control byt its identifier. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier along with {@link Response}. + */ + SourceControl getById(String id); + + /** + * Gets a source control byt its identifier. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a source control byt its identifier along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SourceControl resource. + * + * @param name resource name. + * @return the first stage of the new SourceControl definition. + */ + SourceControl.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceKind.java new file mode 100644 index 000000000000..c2426f53d95b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceKind.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Source type of the content. + */ +public final class SourceKind extends ExpandableStringEnum { + /** + * Static value LocalWorkspace for SourceKind. + */ + public static final SourceKind LOCAL_WORKSPACE = fromString("LocalWorkspace"); + + /** + * Static value Community for SourceKind. + */ + public static final SourceKind COMMUNITY = fromString("Community"); + + /** + * Static value Solution for SourceKind. + */ + public static final SourceKind SOLUTION = fromString("Solution"); + + /** + * Static value SourceRepository for SourceKind. + */ + public static final SourceKind SOURCE_REPOSITORY = fromString("SourceRepository"); + + /** + * Creates a new instance of SourceKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SourceKind() { + } + + /** + * Creates or finds a SourceKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceKind. + */ + public static SourceKind fromString(String name) { + return fromString(name, SourceKind.class); + } + + /** + * Gets known SourceKind values. + * + * @return known SourceKind values. + */ + public static Collection values() { + return values(SourceKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceType.java new file mode 100644 index 000000000000..962f5dddecc9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SourceType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The sourceType of the watchlist. + */ +public final class SourceType extends ExpandableStringEnum { + /** + * Static value Local for SourceType. + */ + public static final SourceType LOCAL = fromString("Local"); + + /** + * Static value AzureStorage for SourceType. + */ + public static final SourceType AZURE_STORAGE = fromString("AzureStorage"); + + /** + * Creates a new instance of SourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SourceType() { + } + + /** + * Creates or finds a SourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceType. + */ + public static SourceType fromString(String name) { + return fromString(name, SourceType.class); + } + + /** + * Gets known SourceType values. + * + * @return known SourceType values. + */ + public static Collection values() { + return values(SourceType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/State.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/State.java new file mode 100644 index 000000000000..bbff9785431f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/State.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of recommendation. + */ +public final class State extends ExpandableStringEnum { + /** + * Static value Active for State. + */ + public static final State ACTIVE = fromString("Active"); + + /** + * Static value InProgress for State. + */ + public static final State IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Dismissed for State. + */ + public static final State DISMISSED = fromString("Dismissed"); + + /** + * Static value CompletedByUser for State. + */ + public static final State COMPLETED_BY_USER = fromString("CompletedByUser"); + + /** + * Static value CompletedBySystem for State. + */ + public static final State COMPLETED_BY_SYSTEM = fromString("CompletedBySystem"); + + /** + * Creates a new instance of State value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public State() { + } + + /** + * Creates or finds a State from its string representation. + * + * @param name a name to look for. + * @return the corresponding State. + */ + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** + * Gets known State values. + * + * @return known State values. + */ + public static Collection values() { + return values(State.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Status.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Status.java new file mode 100644 index 000000000000..ea56134c44d5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Status.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the hunt. + */ +public final class Status extends ExpandableStringEnum { + /** + * Static value New for Status. + */ + public static final Status NEW = fromString("New"); + + /** + * Static value Active for Status. + */ + public static final Status ACTIVE = fromString("Active"); + + /** + * Static value Closed for Status. + */ + public static final Status CLOSED = fromString("Closed"); + + /** + * Static value Backlog for Status. + */ + public static final Status BACKLOG = fromString("Backlog"); + + /** + * Static value Approved for Status. + */ + public static final Status APPROVED = fromString("Approved"); + + /** + * Static value Succeeded for Status. + */ + public static final Status SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for Status. + */ + public static final Status FAILED = fromString("Failed"); + + /** + * Static value InProgress for Status. + */ + public static final Status IN_PROGRESS = fromString("InProgress"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SubmissionMailEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SubmissionMailEntity.java index 09a339fb75f9..8e79b889ba0b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SubmissionMailEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SubmissionMailEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.SubmissionMailEntityProperties; import java.io.IOException; import java.time.OffsetDateTime; @@ -19,7 +20,7 @@ * Represents a submission mail entity. */ @Immutable -public final class SubmissionMailEntity extends Entity { +public final class SubmissionMailEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SupportTier.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SupportTier.java new file mode 100644 index 000000000000..eccc255597a6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SupportTier.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of support for content item. + */ +public final class SupportTier extends ExpandableStringEnum { + /** + * Static value Microsoft for SupportTier. + */ + public static final SupportTier MICROSOFT = fromString("Microsoft"); + + /** + * Static value Partner for SupportTier. + */ + public static final SupportTier PARTNER = fromString("Partner"); + + /** + * Static value Community for SupportTier. + */ + public static final SupportTier COMMUNITY = fromString("Community"); + + /** + * Creates a new instance of SupportTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SupportTier() { + } + + /** + * Creates or finds a SupportTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding SupportTier. + */ + public static SupportTier fromString(String name) { + return fromString(name, SupportTier.class); + } + + /** + * Gets known SupportTier values. + * + * @return known SupportTier values. + */ + public static Collection values() { + return values(SupportTier.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemConfigurationConnectorType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemConfigurationConnectorType.java new file mode 100644 index 000000000000..c2af116de7d5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemConfigurationConnectorType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents the types of SAP systems. + */ +public final class SystemConfigurationConnectorType extends ExpandableStringEnum { + /** + * Static value Rfc for SystemConfigurationConnectorType. + */ + public static final SystemConfigurationConnectorType RFC = fromString("Rfc"); + + /** + * Static value SapControl for SystemConfigurationConnectorType. + */ + public static final SystemConfigurationConnectorType SAP_CONTROL = fromString("SapControl"); + + /** + * Creates a new instance of SystemConfigurationConnectorType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SystemConfigurationConnectorType() { + } + + /** + * Creates or finds a SystemConfigurationConnectorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SystemConfigurationConnectorType. + */ + public static SystemConfigurationConnectorType fromString(String name) { + return fromString(name, SystemConfigurationConnectorType.class); + } + + /** + * Gets known SystemConfigurationConnectorType values. + * + * @return known SystemConfigurationConnectorType values. + */ + public static Collection values() { + return values(SystemConfigurationConnectorType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemResource.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemResource.java new file mode 100644 index 000000000000..c336c503ca1a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemResource.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.SystemResourceInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of SystemResource. + */ +public interface SystemResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the status property: The status of the system. + * + * @return the status value. + */ + SystemStatusType status(); + + /** + * Gets the configuration property: The configuration of the system. + * + * @return the configuration value. + */ + SystemsConfiguration configuration(); + + /** + * Gets the displayName property: The displayName property. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the lastModifiedTimeUtc property: The lastModifiedTimeUtc property. + * + * @return the lastModifiedTimeUtc value. + */ + OffsetDateTime lastModifiedTimeUtc(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.SystemResourceInner object. + * + * @return the inner object. + */ + SystemResourceInner innerModel(); + + /** + * The entirety of the SystemResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithConfiguration, DefinitionStages.WithDisplayName, DefinitionStages.WithCreate { + } + + /** + * The SystemResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SystemResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SystemResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName, agentResourceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @return the next definition stage. + */ + WithConfiguration withExistingBusinessApplicationAgent(String resourceGroupName, String workspaceName, + String agentResourceName); + } + + /** + * The stage of the SystemResource definition allowing to specify configuration. + */ + interface WithConfiguration { + /** + * Specifies the configuration property: The configuration of the system.. + * + * @param configuration The configuration of the system. + * @return the next definition stage. + */ + WithDisplayName withConfiguration(SystemsConfiguration configuration); + } + + /** + * The stage of the SystemResource definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The displayName property.. + * + * @param displayName The displayName property. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the SystemResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithStatus { + /** + * Executes the create request. + * + * @return the created resource. + */ + SystemResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SystemResource create(Context context); + } + + /** + * The stage of the SystemResource definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the SystemResource definition allowing to specify status. + */ + interface WithStatus { + /** + * Specifies the status property: The status of the system.. + * + * @param status The status of the system. + * @return the next definition stage. + */ + WithCreate withStatus(SystemStatusType status); + } + } + + /** + * Begins update for the SystemResource resource. + * + * @return the stage of resource update. + */ + SystemResource.Update update(); + + /** + * The template for SystemResource update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithStatus, UpdateStages.WithConfiguration, + UpdateStages.WithDisplayName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SystemResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SystemResource apply(Context context); + } + + /** + * The SystemResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SystemResource update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the SystemResource update allowing to specify status. + */ + interface WithStatus { + /** + * Specifies the status property: The status of the system.. + * + * @param status The status of the system. + * @return the next definition stage. + */ + Update withStatus(SystemStatusType status); + } + + /** + * The stage of the SystemResource update allowing to specify configuration. + */ + interface WithConfiguration { + /** + * Specifies the configuration property: The configuration of the system.. + * + * @param configuration The configuration of the system. + * @return the next definition stage. + */ + Update withConfiguration(SystemsConfiguration configuration); + } + + /** + * The stage of the SystemResource update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The displayName property.. + * + * @param displayName The displayName property. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SystemResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SystemResource refresh(Context context); + + /** + * List of actions for a business application system. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + PagedIterable listActions(); + + /** + * List of actions for a business application system. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + PagedIterable listActions(Context context); + + /** + * Undo action, based on the actionId. + * + * @param payload Undo action, based on the actionId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response undoActionWithResponse(UndoActionPayload payload, Context context); + + /** + * Undo action, based on the actionId. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void undoAction(); + + /** + * Report the status of the action. + * + * @param payload Report a status of the action that was performed by the agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response reportActionStatusWithResponse(ReportActionStatusPayload payload, Context context); + + /** + * Report the status of the action. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reportActionStatus(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemStatusType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemStatusType.java new file mode 100644 index 000000000000..2c0fbde057d5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemStatusType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the system. + */ +public final class SystemStatusType extends ExpandableStringEnum { + /** + * Static value Running for SystemStatusType. + */ + public static final SystemStatusType RUNNING = fromString("Running"); + + /** + * Static value Stopped for SystemStatusType. + */ + public static final SystemStatusType STOPPED = fromString("Stopped"); + + /** + * Creates a new instance of SystemStatusType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SystemStatusType() { + } + + /** + * Creates or finds a SystemStatusType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SystemStatusType. + */ + public static SystemStatusType fromString(String name) { + return fromString(name, SystemStatusType.class); + } + + /** + * Gets known SystemStatusType values. + * + * @return known SystemStatusType values. + */ + public static Collection values() { + return values(SystemStatusType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Systems.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Systems.java new file mode 100644 index 000000000000..c88d55b8359b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Systems.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Systems. + */ +public interface Systems { + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context); + + /** + * Gets the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system. + */ + SystemResource get(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context); + + /** + * Deletes the system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String agentResourceName, String systemResourceName); + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String agentResourceName); + + /** + * ListAll the systems. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param filter Filters the results, based on a Boolean condition. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Agent's Systems as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String agentResourceName, + String filter, String skipToken, Context context); + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + PagedIterable listActions(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * List of actions for a business application system. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list all actions for a system to perform as paginated response with {@link PagedIterable}. + */ + PagedIterable listActions(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, Context context); + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Undo action, based on the actionId. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response undoActionWithResponse(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName, UndoActionPayload payload, Context context); + + /** + * Undo action, based on the actionId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void undoAction(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @param payload Report a status of the action that was performed by the agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response reportActionStatusWithResponse(String resourceGroupName, String workspaceName, + String agentResourceName, String systemResourceName, ReportActionStatusPayload payload, Context context); + + /** + * Report the status of the action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param agentResourceName Business Application Agent Name. + * @param systemResourceName The name of the system. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reportActionStatus(String resourceGroupName, String workspaceName, String agentResourceName, + String systemResourceName); + + /** + * Gets the system. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system along with {@link Response}. + */ + SystemResource getById(String id); + + /** + * Gets the system. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the system along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the system. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the system. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SystemResource resource. + * + * @param name resource name. + * @return the first stage of the new SystemResource definition. + */ + SystemResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsConfiguration.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsConfiguration.java new file mode 100644 index 000000000000..fac73081ae2f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsConfiguration.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The configuration of the system. + */ +@Immutable +public class SystemsConfiguration implements JsonSerializable { + /* + * Represents the types of configuration for a system. + */ + private ConfigurationType type = ConfigurationType.fromString("SystemsConfiguration"); + + /** + * Creates an instance of SystemsConfiguration class. + */ + public SystemsConfiguration() { + } + + /** + * Get the type property: Represents the types of configuration for a system. + * + * @return the type value. + */ + public ConfigurationType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemsConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemsConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SystemsConfiguration. + */ + public static SystemsConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SAP".equals(discriminatorValue)) { + return SapSystemsConfiguration.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static SystemsConfiguration fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemsConfiguration deserializedSystemsConfiguration = new SystemsConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedSystemsConfiguration.type = ConfigurationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSystemsConfiguration; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsConfigurationConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsConfigurationConnector.java new file mode 100644 index 000000000000..af3e27b13edc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsConfigurationConnector.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Base Model for SAP System Connector. + */ +@Immutable +public class SystemsConfigurationConnector implements JsonSerializable { + /* + * Represents the types of SAP systems. + */ + private SystemConfigurationConnectorType type + = SystemConfigurationConnectorType.fromString("SystemsConfigurationConnector"); + + /** + * Creates an instance of SystemsConfigurationConnector class. + */ + public SystemsConfigurationConnector() { + } + + /** + * Get the type property: Represents the types of SAP systems. + * + * @return the type value. + */ + public SystemConfigurationConnectorType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemsConfigurationConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemsConfigurationConnector if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SystemsConfigurationConnector. + */ + public static SystemsConfigurationConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Rfc".equals(discriminatorValue)) { + return RfcConnector.fromJson(readerToUse.reset()); + } else if ("SapControl".equals(discriminatorValue)) { + return SapControlConnector.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static SystemsConfigurationConnector fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemsConfigurationConnector deserializedSystemsConfigurationConnector + = new SystemsConfigurationConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedSystemsConfigurationConnector.type + = SystemConfigurationConnectorType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSystemsConfigurationConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsList.java new file mode 100644 index 000000000000..a9cff762553d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/SystemsList.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.SystemResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * List of Agent's Systems. + */ +@Fluent +public final class SystemsList implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of SystemsList class. + */ + public SystemsList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the SystemsList object itself. + */ + public SystemsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The nextLink property. + * + * @param nextLink the nextLink value to set. + * @return the SystemsList object itself. + */ + public SystemsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemsList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SystemsList. + */ + public static SystemsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemsList deserializedSystemsList = new SystemsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SystemResourceInner.fromJson(reader1)); + deserializedSystemsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSystemsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSystemsList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TICheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TICheckRequirements.java new file mode 100644 index 000000000000..934b7a822752 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TICheckRequirements.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TICheckRequirementsProperties; +import java.io.IOException; + +/** + * Threat Intelligence Platforms data connector check requirements. + */ +@Fluent +public final class TICheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.THREAT_INTELLIGENCE; + + /* + * Threat Intelligence Platforms data connector check required properties + */ + private TICheckRequirementsProperties innerProperties; + + /** + * Creates an instance of TICheckRequirements class. + */ + public TICheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Threat Intelligence Platforms data connector check required properties. + * + * @return the innerProperties value. + */ + TICheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the TICheckRequirements object itself. + */ + public TICheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new TICheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TICheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TICheckRequirements if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TICheckRequirements. + */ + public static TICheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TICheckRequirements deserializedTICheckRequirements = new TICheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedTICheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedTICheckRequirements.innerProperties = TICheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTICheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnector.java index 0b5f3f6ffcb4..60e679c071f6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnector.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnector.java @@ -123,29 +123,6 @@ public TIDataConnector withEtag(String etag) { return this; } - /** - * Get the tenantId property: The tenant id to connect to, and get the data from. - * - * @return the tenantId value. - */ - public String tenantId() { - return this.innerProperties() == null ? null : this.innerProperties().tenantId(); - } - - /** - * Set the tenantId property: The tenant id to connect to, and get the data from. - * - * @param tenantId the tenantId value to set. - * @return the TIDataConnector object itself. - */ - public TIDataConnector withTenantId(String tenantId) { - if (this.innerProperties() == null) { - this.innerProperties = new TIDataConnectorProperties(); - } - this.innerProperties().withTenantId(tenantId); - return this; - } - /** * Get the tipLookbackPeriod property: The lookback period for the feed to be imported. * @@ -192,6 +169,29 @@ public TIDataConnector withDataTypes(TIDataConnectorDataTypes dataTypes) { return this; } + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the TIDataConnector object itself. + */ + public TIDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new TIDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + /** * Validates the instance. * diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypes.java index 908aab912187..028da90ef35c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypes.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypes.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -53,11 +54,17 @@ public TIDataConnectorDataTypes withIndicators(TIDataConnectorDataTypesIndicator * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (indicators() != null) { + if (indicators() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property indicators in model TIDataConnectorDataTypes")); + } else { indicators().validate(); } } + private static final ClientLogger LOGGER = new ClientLogger(TIDataConnectorDataTypes.class); + /** * {@inheritDoc} */ @@ -74,6 +81,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of TIDataConnectorDataTypes if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the TIDataConnectorDataTypes. */ public static TIDataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypesIndicators.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypesIndicators.java index 65f0c7145e1b..8be5f239cd7a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypesIndicators.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIDataConnectorDataTypesIndicators.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.securityinsights.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -37,8 +38,15 @@ public TIDataConnectorDataTypesIndicators withState(DataTypeState state) { */ @Override public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model TIDataConnectorDataTypesIndicators")); + } } + private static final ClientLogger LOGGER = new ClientLogger(TIDataConnectorDataTypesIndicators.class); + /** * {@inheritDoc} */ @@ -55,6 +63,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of TIDataConnectorDataTypesIndicators if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the TIDataConnectorDataTypesIndicators. */ public static TIDataConnectorDataTypesIndicators fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIObject.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIObject.java new file mode 100644 index 000000000000..1ec5ff40ea4d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIObject.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * An immutable client-side representation of TIObject. + */ +public interface TIObject { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: The kind of the TI object. + * + * @return the kind value. + */ + TIObjectKind kind(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + Map data(); + + /** + * Gets the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + UserInfo createdBy(); + + /** + * Gets the source property: The source name for this TI object. + * + * @return the source value. + */ + String source(); + + /** + * Gets the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + OffsetDateTime firstIngestedTimeUtc(); + + /** + * Gets the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + OffsetDateTime lastIngestedTimeUtc(); + + /** + * Gets the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + UUID ingestionRulesVersion(); + + /** + * Gets the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + String lastUpdateMethod(); + + /** + * Gets the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + UserInfo lastModifiedBy(); + + /** + * Gets the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + OffsetDateTime lastUpdatedDateTimeUtc(); + + /** + * Gets the relationshipHints property: A dictionary used to help follow relationships from this object to other + * STIX objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of + * sources that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + List relationshipHints(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner object. + * + * @return the inner object. + */ + TIObjectInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIObjectKind.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIObjectKind.java new file mode 100644 index 000000000000..da2d48a51ce5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TIObjectKind.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the TI object. + */ +public final class TIObjectKind extends ExpandableStringEnum { + /** + * Static value AttackPattern for TIObjectKind. + */ + public static final TIObjectKind ATTACK_PATTERN = fromString("AttackPattern"); + + /** + * Static value Identity for TIObjectKind. + */ + public static final TIObjectKind IDENTITY = fromString("Identity"); + + /** + * Static value Indicator for TIObjectKind. + */ + public static final TIObjectKind INDICATOR = fromString("Indicator"); + + /** + * Static value Relationship for TIObjectKind. + */ + public static final TIObjectKind RELATIONSHIP = fromString("Relationship"); + + /** + * Static value ThreatActor for TIObjectKind. + */ + public static final TIObjectKind THREAT_ACTOR = fromString("ThreatActor"); + + /** + * Creates a new instance of TIObjectKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TIObjectKind() { + } + + /** + * Creates or finds a TIObjectKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding TIObjectKind. + */ + public static TIObjectKind fromString(String name) { + return fromString(name, TIObjectKind.class); + } + + /** + * Gets known TIObjectKind values. + * + * @return known TIObjectKind values. + */ + public static Collection values() { + return values(TIObjectKind.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TeamInformation.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TeamInformation.java new file mode 100644 index 000000000000..b7ac28f81a6c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TeamInformation.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Describes team information. + */ +@Immutable +public final class TeamInformation implements JsonSerializable { + /* + * Team ID + */ + private String teamId; + + /* + * The primary channel URL of the team + */ + private String primaryChannelUrl; + + /* + * The time the team was created + */ + private OffsetDateTime teamCreationTimeUtc; + + /* + * The name of the team + */ + private String name; + + /* + * The description of the team + */ + private String description; + + /** + * Creates an instance of TeamInformation class. + */ + public TeamInformation() { + } + + /** + * Get the teamId property: Team ID. + * + * @return the teamId value. + */ + public String teamId() { + return this.teamId; + } + + /** + * Get the primaryChannelUrl property: The primary channel URL of the team. + * + * @return the primaryChannelUrl value. + */ + public String primaryChannelUrl() { + return this.primaryChannelUrl; + } + + /** + * Get the teamCreationTimeUtc property: The time the team was created. + * + * @return the teamCreationTimeUtc value. + */ + public OffsetDateTime teamCreationTimeUtc() { + return this.teamCreationTimeUtc; + } + + /** + * Get the name property: The name of the team. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the description property: The description of the team. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TeamInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TeamInformation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TeamInformation. + */ + public static TeamInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TeamInformation deserializedTeamInformation = new TeamInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("teamId".equals(fieldName)) { + deserializedTeamInformation.teamId = reader.getString(); + } else if ("primaryChannelUrl".equals(fieldName)) { + deserializedTeamInformation.primaryChannelUrl = reader.getString(); + } else if ("teamCreationTimeUtc".equals(fieldName)) { + deserializedTeamInformation.teamCreationTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("name".equals(fieldName)) { + deserializedTeamInformation.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedTeamInformation.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTeamInformation; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateAdditionalProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateAdditionalProperties.java new file mode 100644 index 000000000000..01a86ce99405 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateAdditionalProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateProperties; +import java.io.IOException; +import java.util.List; + +/** + * additional properties of product template. + */ +@Fluent +public class TemplateAdditionalProperties implements JsonSerializable { + /* + * The JSON of the ARM template to deploy active content. Expandable. + */ + private Object mainTemplate; + + /* + * Dependant templates. Expandable. + */ + private List dependantTemplates; + + /** + * Creates an instance of TemplateAdditionalProperties class. + */ + public TemplateAdditionalProperties() { + } + + /** + * Get the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable. + * + * @return the mainTemplate value. + */ + public Object mainTemplate() { + return this.mainTemplate; + } + + /** + * Set the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable. + * + * @param mainTemplate the mainTemplate value to set. + * @return the TemplateAdditionalProperties object itself. + */ + public TemplateAdditionalProperties withMainTemplate(Object mainTemplate) { + this.mainTemplate = mainTemplate; + return this; + } + + /** + * Get the dependantTemplates property: Dependant templates. Expandable. + * + * @return the dependantTemplates value. + */ + public List dependantTemplates() { + return this.dependantTemplates; + } + + /** + * Set the dependantTemplates property: Dependant templates. Expandable. + * + * @param dependantTemplates the dependantTemplates value to set. + * @return the TemplateAdditionalProperties object itself. + */ + TemplateAdditionalProperties withDependantTemplates(List dependantTemplates) { + this.dependantTemplates = dependantTemplates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dependantTemplates() != null) { + dependantTemplates().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeUntypedField("mainTemplate", this.mainTemplate); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TemplateAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TemplateAdditionalProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TemplateAdditionalProperties. + */ + public static TemplateAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TemplateAdditionalProperties deserializedTemplateAdditionalProperties = new TemplateAdditionalProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mainTemplate".equals(fieldName)) { + deserializedTemplateAdditionalProperties.mainTemplate = reader.readUntyped(); + } else if ("dependantTemplates".equals(fieldName)) { + List dependantTemplates + = reader.readArray(reader1 -> TemplateProperties.fromJson(reader1)); + deserializedTemplateAdditionalProperties.dependantTemplates = dependantTemplates; + } else { + reader.skipChildren(); + } + } + + return deserializedTemplateAdditionalProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateBaseProperties.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateBaseProperties.java new file mode 100644 index 000000000000..f381bfa3cf1a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateBaseProperties.java @@ -0,0 +1,823 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +/** + * Template property bag. + */ +@Fluent +public class TemplateBaseProperties implements JsonSerializable { + /* + * Static ID for the content. Used to identify dependencies and content from solutions or community. + * Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the resource name + */ + private String contentId; + + /* + * Unique ID for the content. It should be generated based on the contentId of the package, contentId of the + * template, contentKind of the template and the contentVersion of the template + */ + private String contentProductId; + + /* + * Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM + * metadata best practices. Can also be any string, but then we cannot guarantee any version checks + */ + private String packageVersion; + + /* + * Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM + * metadata best practices. Can also be any string, but then we cannot guarantee any version checks + */ + private String version; + + /* + * The display name of the template + */ + private String displayName; + + /* + * The kind of content the template is for. + */ + private Kind contentKind; + + /* + * Source of the content. This is where/how it was created. + */ + private MetadataSource source; + + /* + * The creator of the content item. + */ + private MetadataAuthor author; + + /* + * Support information for the template - type, name, contact information + */ + private MetadataSupport support; + + /* + * Dependencies for the content item, what other content items it requires to work. Can describe more complex + * dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or + * operator/criteria for complex formats. + */ + private MetadataDependencies dependencies; + + /* + * Categories for the item + */ + private MetadataCategories categories; + + /* + * Providers for the content item + */ + private List providers; + + /* + * first publish date content item + */ + private LocalDate firstPublishDate; + + /* + * last publish date for the content item + */ + private LocalDate lastPublishDate; + + /* + * The custom version of the content. A optional free text + */ + private String customVersion; + + /* + * Schema version of the content. Can be used to distinguish between different flow based on the schema version + */ + private String contentSchemaVersion; + + /* + * the icon identifier. this id can later be fetched from the content metadata + */ + private String icon; + + /* + * the tactics the resource covers + */ + private List threatAnalysisTactics; + + /* + * the techniques the resource covers, these have to be aligned with the tactics being used + */ + private List threatAnalysisTechniques; + + /* + * preview image file names. These will be taken from the solution artifacts + */ + private List previewImages; + + /* + * preview image file names. These will be taken from the solution artifacts. used for dark theme support + */ + private List previewImagesDark; + + /* + * the package Id contains this template + */ + private String packageId; + + /* + * the packageKind of the package contains this template + */ + private PackageKind packageKind; + + /* + * the name of the package contains this template + */ + private String packageName; + + /* + * Flag indicates if this template is deprecated + */ + private Flag isDeprecated; + + /** + * Creates an instance of TemplateBaseProperties class. + */ + public TemplateBaseProperties() { + } + + /** + * Get the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + public String contentId() { + return this.contentId; + } + + /** + * Set the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @param contentId the contentId value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withContentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Get the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @return the contentProductId value. + */ + public String contentProductId() { + return this.contentProductId; + } + + /** + * Set the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @param contentProductId the contentProductId value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withContentProductId(String contentProductId) { + this.contentProductId = contentProductId; + return this; + } + + /** + * Get the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @return the packageVersion value. + */ + public String packageVersion() { + return this.packageVersion; + } + + /** + * Set the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @param packageVersion the packageVersion value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + return this; + } + + /** + * Get the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @param version the version value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the displayName property: The display name of the template. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the template. + * + * @param displayName the displayName value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the contentKind property: The kind of content the template is for. + * + * @return the contentKind value. + */ + public Kind contentKind() { + return this.contentKind; + } + + /** + * Set the contentKind property: The kind of content the template is for. + * + * @param contentKind the contentKind value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withContentKind(Kind contentKind) { + this.contentKind = contentKind; + return this; + } + + /** + * Get the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + public MetadataSource source() { + return this.source; + } + + /** + * Set the source property: Source of the content. This is where/how it was created. + * + * @param source the source value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withSource(MetadataSource source) { + this.source = source; + return this; + } + + /** + * Get the author property: The creator of the content item. + * + * @return the author value. + */ + public MetadataAuthor author() { + return this.author; + } + + /** + * Set the author property: The creator of the content item. + * + * @param author the author value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withAuthor(MetadataAuthor author) { + this.author = author; + return this; + } + + /** + * Get the support property: Support information for the template - type, name, contact information. + * + * @return the support value. + */ + public MetadataSupport support() { + return this.support; + } + + /** + * Set the support property: Support information for the template - type, name, contact information. + * + * @param support the support value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withSupport(MetadataSupport support) { + this.support = support; + return this; + } + + /** + * Get the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + public MetadataDependencies dependencies() { + return this.dependencies; + } + + /** + * Set the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @param dependencies the dependencies value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withDependencies(MetadataDependencies dependencies) { + this.dependencies = dependencies; + return this; + } + + /** + * Get the categories property: Categories for the item. + * + * @return the categories value. + */ + public MetadataCategories categories() { + return this.categories; + } + + /** + * Set the categories property: Categories for the item. + * + * @param categories the categories value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withCategories(MetadataCategories categories) { + this.categories = categories; + return this; + } + + /** + * Get the providers property: Providers for the content item. + * + * @return the providers value. + */ + public List providers() { + return this.providers; + } + + /** + * Set the providers property: Providers for the content item. + * + * @param providers the providers value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withProviders(List providers) { + this.providers = providers; + return this; + } + + /** + * Get the firstPublishDate property: first publish date content item. + * + * @return the firstPublishDate value. + */ + public LocalDate firstPublishDate() { + return this.firstPublishDate; + } + + /** + * Set the firstPublishDate property: first publish date content item. + * + * @param firstPublishDate the firstPublishDate value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withFirstPublishDate(LocalDate firstPublishDate) { + this.firstPublishDate = firstPublishDate; + return this; + } + + /** + * Get the lastPublishDate property: last publish date for the content item. + * + * @return the lastPublishDate value. + */ + public LocalDate lastPublishDate() { + return this.lastPublishDate; + } + + /** + * Set the lastPublishDate property: last publish date for the content item. + * + * @param lastPublishDate the lastPublishDate value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withLastPublishDate(LocalDate lastPublishDate) { + this.lastPublishDate = lastPublishDate; + return this; + } + + /** + * Get the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + public String customVersion() { + return this.customVersion; + } + + /** + * Set the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion the customVersion value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withCustomVersion(String customVersion) { + this.customVersion = customVersion; + return this; + } + + /** + * Get the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + public String contentSchemaVersion() { + return this.contentSchemaVersion; + } + + /** + * Set the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @param contentSchemaVersion the contentSchemaVersion value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withContentSchemaVersion(String contentSchemaVersion) { + this.contentSchemaVersion = contentSchemaVersion; + return this; + } + + /** + * Get the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + public String icon() { + return this.icon; + } + + /** + * Set the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withIcon(String icon) { + this.icon = icon; + return this; + } + + /** + * Get the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + public List threatAnalysisTactics() { + return this.threatAnalysisTactics; + } + + /** + * Set the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the threatAnalysisTactics value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withThreatAnalysisTactics(List threatAnalysisTactics) { + this.threatAnalysisTactics = threatAnalysisTactics; + return this; + } + + /** + * Get the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + public List threatAnalysisTechniques() { + return this.threatAnalysisTechniques; + } + + /** + * Set the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @param threatAnalysisTechniques the threatAnalysisTechniques value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withThreatAnalysisTechniques(List threatAnalysisTechniques) { + this.threatAnalysisTechniques = threatAnalysisTechniques; + return this; + } + + /** + * Get the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + public List previewImages() { + return this.previewImages; + } + + /** + * Set the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @param previewImages the previewImages value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withPreviewImages(List previewImages) { + this.previewImages = previewImages; + return this; + } + + /** + * Get the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + public List previewImagesDark() { + return this.previewImagesDark; + } + + /** + * Set the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @param previewImagesDark the previewImagesDark value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withPreviewImagesDark(List previewImagesDark) { + this.previewImagesDark = previewImagesDark; + return this; + } + + /** + * Get the packageId property: the package Id contains this template. + * + * @return the packageId value. + */ + public String packageId() { + return this.packageId; + } + + /** + * Set the packageId property: the package Id contains this template. + * + * @param packageId the packageId value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withPackageId(String packageId) { + this.packageId = packageId; + return this; + } + + /** + * Get the packageKind property: the packageKind of the package contains this template. + * + * @return the packageKind value. + */ + public PackageKind packageKind() { + return this.packageKind; + } + + /** + * Set the packageKind property: the packageKind of the package contains this template. + * + * @param packageKind the packageKind value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withPackageKind(PackageKind packageKind) { + this.packageKind = packageKind; + return this; + } + + /** + * Get the packageName property: the name of the package contains this template. + * + * @return the packageName value. + */ + public String packageName() { + return this.packageName; + } + + /** + * Set the packageName property: the name of the package contains this template. + * + * @param packageName the packageName value to set. + * @return the TemplateBaseProperties object itself. + */ + public TemplateBaseProperties withPackageName(String packageName) { + this.packageName = packageName; + return this; + } + + /** + * Get the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + public Flag isDeprecated() { + return this.isDeprecated; + } + + /** + * Set the isDeprecated property: Flag indicates if this template is deprecated. + * + * @param isDeprecated the isDeprecated value to set. + * @return the TemplateBaseProperties object itself. + */ + TemplateBaseProperties withIsDeprecated(Flag isDeprecated) { + this.isDeprecated = isDeprecated; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (author() != null) { + author().validate(); + } + if (support() != null) { + support().validate(); + } + if (dependencies() != null) { + dependencies().validate(); + } + if (categories() != null) { + categories().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contentId", this.contentId); + jsonWriter.writeStringField("contentProductId", this.contentProductId); + jsonWriter.writeStringField("packageVersion", this.packageVersion); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("contentKind", this.contentKind == null ? null : this.contentKind.toString()); + jsonWriter.writeJsonField("source", this.source); + jsonWriter.writeJsonField("author", this.author); + jsonWriter.writeJsonField("support", this.support); + jsonWriter.writeJsonField("dependencies", this.dependencies); + jsonWriter.writeJsonField("categories", this.categories); + jsonWriter.writeArrayField("providers", this.providers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("firstPublishDate", Objects.toString(this.firstPublishDate, null)); + jsonWriter.writeStringField("lastPublishDate", Objects.toString(this.lastPublishDate, null)); + jsonWriter.writeStringField("customVersion", this.customVersion); + jsonWriter.writeStringField("contentSchemaVersion", this.contentSchemaVersion); + jsonWriter.writeStringField("icon", this.icon); + jsonWriter.writeArrayField("threatAnalysisTactics", this.threatAnalysisTactics, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("threatAnalysisTechniques", this.threatAnalysisTechniques, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImages", this.previewImages, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("previewImagesDark", this.previewImagesDark, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("packageId", this.packageId); + jsonWriter.writeStringField("packageKind", this.packageKind == null ? null : this.packageKind.toString()); + jsonWriter.writeStringField("packageName", this.packageName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TemplateBaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TemplateBaseProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TemplateBaseProperties. + */ + public static TemplateBaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TemplateBaseProperties deserializedTemplateBaseProperties = new TemplateBaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contentId".equals(fieldName)) { + deserializedTemplateBaseProperties.contentId = reader.getString(); + } else if ("contentProductId".equals(fieldName)) { + deserializedTemplateBaseProperties.contentProductId = reader.getString(); + } else if ("packageVersion".equals(fieldName)) { + deserializedTemplateBaseProperties.packageVersion = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedTemplateBaseProperties.version = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedTemplateBaseProperties.displayName = reader.getString(); + } else if ("contentKind".equals(fieldName)) { + deserializedTemplateBaseProperties.contentKind = Kind.fromString(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedTemplateBaseProperties.source = MetadataSource.fromJson(reader); + } else if ("author".equals(fieldName)) { + deserializedTemplateBaseProperties.author = MetadataAuthor.fromJson(reader); + } else if ("support".equals(fieldName)) { + deserializedTemplateBaseProperties.support = MetadataSupport.fromJson(reader); + } else if ("dependencies".equals(fieldName)) { + deserializedTemplateBaseProperties.dependencies = MetadataDependencies.fromJson(reader); + } else if ("categories".equals(fieldName)) { + deserializedTemplateBaseProperties.categories = MetadataCategories.fromJson(reader); + } else if ("providers".equals(fieldName)) { + List providers = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateBaseProperties.providers = providers; + } else if ("firstPublishDate".equals(fieldName)) { + deserializedTemplateBaseProperties.firstPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("lastPublishDate".equals(fieldName)) { + deserializedTemplateBaseProperties.lastPublishDate + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("customVersion".equals(fieldName)) { + deserializedTemplateBaseProperties.customVersion = reader.getString(); + } else if ("contentSchemaVersion".equals(fieldName)) { + deserializedTemplateBaseProperties.contentSchemaVersion = reader.getString(); + } else if ("icon".equals(fieldName)) { + deserializedTemplateBaseProperties.icon = reader.getString(); + } else if ("threatAnalysisTactics".equals(fieldName)) { + List threatAnalysisTactics = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateBaseProperties.threatAnalysisTactics = threatAnalysisTactics; + } else if ("threatAnalysisTechniques".equals(fieldName)) { + List threatAnalysisTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateBaseProperties.threatAnalysisTechniques = threatAnalysisTechniques; + } else if ("previewImages".equals(fieldName)) { + List previewImages = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateBaseProperties.previewImages = previewImages; + } else if ("previewImagesDark".equals(fieldName)) { + List previewImagesDark = reader.readArray(reader1 -> reader1.getString()); + deserializedTemplateBaseProperties.previewImagesDark = previewImagesDark; + } else if ("packageId".equals(fieldName)) { + deserializedTemplateBaseProperties.packageId = reader.getString(); + } else if ("packageKind".equals(fieldName)) { + deserializedTemplateBaseProperties.packageKind = PackageKind.fromString(reader.getString()); + } else if ("packageName".equals(fieldName)) { + deserializedTemplateBaseProperties.packageName = reader.getString(); + } else if ("isDeprecated".equals(fieldName)) { + deserializedTemplateBaseProperties.isDeprecated = Flag.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTemplateBaseProperties; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateList.java new file mode 100644 index 000000000000..64e5f37574c0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the template. + */ +@Fluent +public final class TemplateList implements JsonSerializable { + /* + * Array of templates. + */ + private List value; + + /* + * URL to fetch the next page of template. + */ + private String nextLink; + + /** + * Creates an instance of TemplateList class. + */ + public TemplateList() { + } + + /** + * Get the value property: Array of templates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of templates. + * + * @param value the value value to set. + * @return the TemplateList object itself. + */ + public TemplateList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to fetch the next page of template. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model TemplateList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TemplateList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TemplateList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TemplateList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TemplateList. + */ + public static TemplateList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TemplateList deserializedTemplateList = new TemplateList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> TemplateModelInner.fromJson(reader1)); + deserializedTemplateList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTemplateList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTemplateList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateModel.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateModel.java new file mode 100644 index 000000000000..947d17ef612b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TemplateModel.java @@ -0,0 +1,1112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner; +import com.azure.resourcemanager.securityinsights.fluent.models.TemplateProperties; +import java.time.LocalDate; +import java.util.List; + +/** + * An immutable client-side representation of TemplateModel. + */ +public interface TemplateModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable. + * + * @return the mainTemplate value. + */ + Object mainTemplate(); + + /** + * Gets the dependantTemplates property: Dependant templates. Expandable. + * + * @return the dependantTemplates value. + */ + List dependantTemplates(); + + /** + * Gets the contentId property: Static ID for the content. Used to identify dependencies and content from solutions + * or community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is the + * resource name. + * + * @return the contentId value. + */ + String contentId(); + + /** + * Gets the contentProductId property: Unique ID for the content. It should be generated based on the contentId of + * the package, contentId of the template, contentKind of the template and the contentVersion of the template. + * + * @return the contentProductId value. + */ + String contentProductId(); + + /** + * Gets the packageVersion property: Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * + * @return the packageVersion value. + */ + String packageVersion(); + + /** + * Gets the version property: Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any version + * checks. + * + * @return the version value. + */ + String version(); + + /** + * Gets the displayName property: The display name of the template. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the contentKind property: The kind of content the template is for. + * + * @return the contentKind value. + */ + Kind contentKind(); + + /** + * Gets the source property: Source of the content. This is where/how it was created. + * + * @return the source value. + */ + MetadataSource source(); + + /** + * Gets the author property: The creator of the content item. + * + * @return the author value. + */ + MetadataAuthor author(); + + /** + * Gets the support property: Support information for the template - type, name, contact information. + * + * @return the support value. + */ + MetadataSupport support(); + + /** + * Gets the dependencies property: Dependencies for the content item, what other content items it requires to work. + * Can describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * + * @return the dependencies value. + */ + MetadataDependencies dependencies(); + + /** + * Gets the categories property: Categories for the item. + * + * @return the categories value. + */ + MetadataCategories categories(); + + /** + * Gets the providers property: Providers for the content item. + * + * @return the providers value. + */ + List providers(); + + /** + * Gets the firstPublishDate property: first publish date content item. + * + * @return the firstPublishDate value. + */ + LocalDate firstPublishDate(); + + /** + * Gets the lastPublishDate property: last publish date for the content item. + * + * @return the lastPublishDate value. + */ + LocalDate lastPublishDate(); + + /** + * Gets the customVersion property: The custom version of the content. A optional free text. + * + * @return the customVersion value. + */ + String customVersion(); + + /** + * Gets the contentSchemaVersion property: Schema version of the content. Can be used to distinguish between + * different flow based on the schema version. + * + * @return the contentSchemaVersion value. + */ + String contentSchemaVersion(); + + /** + * Gets the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the threatAnalysisTactics property: the tactics the resource covers. + * + * @return the threatAnalysisTactics value. + */ + List threatAnalysisTactics(); + + /** + * Gets the threatAnalysisTechniques property: the techniques the resource covers, these have to be aligned with the + * tactics being used. + * + * @return the threatAnalysisTechniques value. + */ + List threatAnalysisTechniques(); + + /** + * Gets the previewImages property: preview image file names. These will be taken from the solution artifacts. + * + * @return the previewImages value. + */ + List previewImages(); + + /** + * Gets the previewImagesDark property: preview image file names. These will be taken from the solution artifacts. + * used for dark theme support. + * + * @return the previewImagesDark value. + */ + List previewImagesDark(); + + /** + * Gets the packageId property: the package Id contains this template. + * + * @return the packageId value. + */ + String packageId(); + + /** + * Gets the packageKind property: the packageKind of the package contains this template. + * + * @return the packageKind value. + */ + PackageKind packageKind(); + + /** + * Gets the packageName property: the name of the package contains this template. + * + * @return the packageName value. + */ + String packageName(); + + /** + * Gets the isDeprecated property: Flag indicates if this template is deprecated. + * + * @return the isDeprecated value. + */ + Flag isDeprecated(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.TemplateModelInner object. + * + * @return the inner object. + */ + TemplateModelInner innerModel(); + + /** + * The entirety of the TemplateModel definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The TemplateModel definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the TemplateModel definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the TemplateModel definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the TemplateModel definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithMainTemplate, + DefinitionStages.WithContentId, DefinitionStages.WithContentProductId, DefinitionStages.WithPackageVersion, + DefinitionStages.WithVersion, DefinitionStages.WithDisplayName, DefinitionStages.WithContentKind, + DefinitionStages.WithSource, DefinitionStages.WithAuthor, DefinitionStages.WithSupport, + DefinitionStages.WithDependencies, DefinitionStages.WithCategories, DefinitionStages.WithProviders, + DefinitionStages.WithFirstPublishDate, DefinitionStages.WithLastPublishDate, + DefinitionStages.WithCustomVersion, DefinitionStages.WithContentSchemaVersion, DefinitionStages.WithIcon, + DefinitionStages.WithThreatAnalysisTactics, DefinitionStages.WithThreatAnalysisTechniques, + DefinitionStages.WithPreviewImages, DefinitionStages.WithPreviewImagesDark, DefinitionStages.WithPackageId, + DefinitionStages.WithPackageKind, DefinitionStages.WithPackageName { + /** + * Executes the create request. + * + * @return the created resource. + */ + TemplateModel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TemplateModel create(Context context); + } + + /** + * The stage of the TemplateModel definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the TemplateModel definition allowing to specify mainTemplate. + */ + interface WithMainTemplate { + /** + * Specifies the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable.. + * + * @param mainTemplate The JSON of the ARM template to deploy active content. Expandable. + * @return the next definition stage. + */ + WithCreate withMainTemplate(Object mainTemplate); + } + + /** + * The stage of the TemplateModel definition allowing to specify contentId. + */ + interface WithContentId { + /** + * Specifies the contentId property: Static ID for the content. Used to identify dependencies and content + * from solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic for + * user-created. This is the resource name. + * + * @param contentId Static ID for the content. Used to identify dependencies and content from solutions or + * community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is + * the resource name. + * @return the next definition stage. + */ + WithCreate withContentId(String contentId); + } + + /** + * The stage of the TemplateModel definition allowing to specify contentProductId. + */ + interface WithContentProductId { + /** + * Specifies the contentProductId property: Unique ID for the content. It should be generated based on the + * contentId of the package, contentId of the template, contentKind of the template and the contentVersion + * of the template. + * + * @param contentProductId Unique ID for the content. It should be generated based on the contentId of the + * package, contentId of the template, contentKind of the template and the contentVersion of the template. + * @return the next definition stage. + */ + WithCreate withContentProductId(String contentProductId); + } + + /** + * The stage of the TemplateModel definition allowing to specify packageVersion. + */ + interface WithPackageVersion { + /** + * Specifies the packageVersion property: Version of the package. Default and recommended format is numeric + * (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + * cannot guarantee any version checks. + * + * @param packageVersion Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot + * guarantee any version checks. + * @return the next definition stage. + */ + WithCreate withPackageVersion(String packageVersion); + } + + /** + * The stage of the TemplateModel definition allowing to specify version. + */ + interface WithVersion { + /** + * Specifies the version property: Version of the content. Default and recommended format is numeric (e.g. + * 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + * cannot guarantee any version checks. + * + * @param version Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + + /** + * The stage of the TemplateModel definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the template. + * + * @param displayName The display name of the template. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the TemplateModel definition allowing to specify contentKind. + */ + interface WithContentKind { + /** + * Specifies the contentKind property: The kind of content the template is for.. + * + * @param contentKind The kind of content the template is for. + * @return the next definition stage. + */ + WithCreate withContentKind(Kind contentKind); + } + + /** + * The stage of the TemplateModel definition allowing to specify source. + */ + interface WithSource { + /** + * Specifies the source property: Source of the content. This is where/how it was created.. + * + * @param source Source of the content. This is where/how it was created. + * @return the next definition stage. + */ + WithCreate withSource(MetadataSource source); + } + + /** + * The stage of the TemplateModel definition allowing to specify author. + */ + interface WithAuthor { + /** + * Specifies the author property: The creator of the content item.. + * + * @param author The creator of the content item. + * @return the next definition stage. + */ + WithCreate withAuthor(MetadataAuthor author); + } + + /** + * The stage of the TemplateModel definition allowing to specify support. + */ + interface WithSupport { + /** + * Specifies the support property: Support information for the template - type, name, contact information. + * + * @param support Support information for the template - type, name, contact information. + * @return the next definition stage. + */ + WithCreate withSupport(MetadataSupport support); + } + + /** + * The stage of the TemplateModel definition allowing to specify dependencies. + */ + interface WithDependencies { + /** + * Specifies the dependencies property: Dependencies for the content item, what other content items it + * requires to work. Can describe more complex dependencies using a recursive/nested structure. For a single + * dependency an id/kind/version can be supplied or operator/criteria for complex formats.. + * + * @param dependencies Dependencies for the content item, what other content items it requires to work. Can + * describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * @return the next definition stage. + */ + WithCreate withDependencies(MetadataDependencies dependencies); + } + + /** + * The stage of the TemplateModel definition allowing to specify categories. + */ + interface WithCategories { + /** + * Specifies the categories property: Categories for the item. + * + * @param categories Categories for the item. + * @return the next definition stage. + */ + WithCreate withCategories(MetadataCategories categories); + } + + /** + * The stage of the TemplateModel definition allowing to specify providers. + */ + interface WithProviders { + /** + * Specifies the providers property: Providers for the content item. + * + * @param providers Providers for the content item. + * @return the next definition stage. + */ + WithCreate withProviders(List providers); + } + + /** + * The stage of the TemplateModel definition allowing to specify firstPublishDate. + */ + interface WithFirstPublishDate { + /** + * Specifies the firstPublishDate property: first publish date content item. + * + * @param firstPublishDate first publish date content item. + * @return the next definition stage. + */ + WithCreate withFirstPublishDate(LocalDate firstPublishDate); + } + + /** + * The stage of the TemplateModel definition allowing to specify lastPublishDate. + */ + interface WithLastPublishDate { + /** + * Specifies the lastPublishDate property: last publish date for the content item. + * + * @param lastPublishDate last publish date for the content item. + * @return the next definition stage. + */ + WithCreate withLastPublishDate(LocalDate lastPublishDate); + } + + /** + * The stage of the TemplateModel definition allowing to specify customVersion. + */ + interface WithCustomVersion { + /** + * Specifies the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion The custom version of the content. A optional free text. + * @return the next definition stage. + */ + WithCreate withCustomVersion(String customVersion); + } + + /** + * The stage of the TemplateModel definition allowing to specify contentSchemaVersion. + */ + interface WithContentSchemaVersion { + /** + * Specifies the contentSchemaVersion property: Schema version of the content. Can be used to distinguish + * between different flow based on the schema version. + * + * @param contentSchemaVersion Schema version of the content. Can be used to distinguish between different + * flow based on the schema version. + * @return the next definition stage. + */ + WithCreate withContentSchemaVersion(String contentSchemaVersion); + } + + /** + * The stage of the TemplateModel definition allowing to specify icon. + */ + interface WithIcon { + /** + * Specifies the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon identifier. this id can later be fetched from the content metadata. + * @return the next definition stage. + */ + WithCreate withIcon(String icon); + } + + /** + * The stage of the TemplateModel definition allowing to specify threatAnalysisTactics. + */ + interface WithThreatAnalysisTactics { + /** + * Specifies the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the tactics the resource covers. + * @return the next definition stage. + */ + WithCreate withThreatAnalysisTactics(List threatAnalysisTactics); + } + + /** + * The stage of the TemplateModel definition allowing to specify threatAnalysisTechniques. + */ + interface WithThreatAnalysisTechniques { + /** + * Specifies the threatAnalysisTechniques property: the techniques the resource covers, these have to be + * aligned with the tactics being used. + * + * @param threatAnalysisTechniques the techniques the resource covers, these have to be aligned with the + * tactics being used. + * @return the next definition stage. + */ + WithCreate withThreatAnalysisTechniques(List threatAnalysisTechniques); + } + + /** + * The stage of the TemplateModel definition allowing to specify previewImages. + */ + interface WithPreviewImages { + /** + * Specifies the previewImages property: preview image file names. These will be taken from the solution + * artifacts. + * + * @param previewImages preview image file names. These will be taken from the solution artifacts. + * @return the next definition stage. + */ + WithCreate withPreviewImages(List previewImages); + } + + /** + * The stage of the TemplateModel definition allowing to specify previewImagesDark. + */ + interface WithPreviewImagesDark { + /** + * Specifies the previewImagesDark property: preview image file names. These will be taken from the solution + * artifacts. used for dark theme support. + * + * @param previewImagesDark preview image file names. These will be taken from the solution artifacts. used + * for dark theme support. + * @return the next definition stage. + */ + WithCreate withPreviewImagesDark(List previewImagesDark); + } + + /** + * The stage of the TemplateModel definition allowing to specify packageId. + */ + interface WithPackageId { + /** + * Specifies the packageId property: the package Id contains this template. + * + * @param packageId the package Id contains this template. + * @return the next definition stage. + */ + WithCreate withPackageId(String packageId); + } + + /** + * The stage of the TemplateModel definition allowing to specify packageKind. + */ + interface WithPackageKind { + /** + * Specifies the packageKind property: the packageKind of the package contains this template. + * + * @param packageKind the packageKind of the package contains this template. + * @return the next definition stage. + */ + WithCreate withPackageKind(PackageKind packageKind); + } + + /** + * The stage of the TemplateModel definition allowing to specify packageName. + */ + interface WithPackageName { + /** + * Specifies the packageName property: the name of the package contains this template. + * + * @param packageName the name of the package contains this template. + * @return the next definition stage. + */ + WithCreate withPackageName(String packageName); + } + } + + /** + * Begins update for the TemplateModel resource. + * + * @return the stage of resource update. + */ + TemplateModel.Update update(); + + /** + * The template for TemplateModel update. + */ + interface Update extends UpdateStages.WithEtag, UpdateStages.WithMainTemplate, UpdateStages.WithContentId, + UpdateStages.WithContentProductId, UpdateStages.WithPackageVersion, UpdateStages.WithVersion, + UpdateStages.WithDisplayName, UpdateStages.WithContentKind, UpdateStages.WithSource, UpdateStages.WithAuthor, + UpdateStages.WithSupport, UpdateStages.WithDependencies, UpdateStages.WithCategories, + UpdateStages.WithProviders, UpdateStages.WithFirstPublishDate, UpdateStages.WithLastPublishDate, + UpdateStages.WithCustomVersion, UpdateStages.WithContentSchemaVersion, UpdateStages.WithIcon, + UpdateStages.WithThreatAnalysisTactics, UpdateStages.WithThreatAnalysisTechniques, + UpdateStages.WithPreviewImages, UpdateStages.WithPreviewImagesDark, UpdateStages.WithPackageId, + UpdateStages.WithPackageKind, UpdateStages.WithPackageName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TemplateModel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TemplateModel apply(Context context); + } + + /** + * The TemplateModel update stages. + */ + interface UpdateStages { + /** + * The stage of the TemplateModel update allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Etag of the azure resource. + * + * @param etag Etag of the azure resource. + * @return the next definition stage. + */ + Update withEtag(String etag); + } + + /** + * The stage of the TemplateModel update allowing to specify mainTemplate. + */ + interface WithMainTemplate { + /** + * Specifies the mainTemplate property: The JSON of the ARM template to deploy active content. Expandable.. + * + * @param mainTemplate The JSON of the ARM template to deploy active content. Expandable. + * @return the next definition stage. + */ + Update withMainTemplate(Object mainTemplate); + } + + /** + * The stage of the TemplateModel update allowing to specify contentId. + */ + interface WithContentId { + /** + * Specifies the contentId property: Static ID for the content. Used to identify dependencies and content + * from solutions or community. Hard-coded/static for out of the box content and solutions. Dynamic for + * user-created. This is the resource name. + * + * @param contentId Static ID for the content. Used to identify dependencies and content from solutions or + * community. Hard-coded/static for out of the box content and solutions. Dynamic for user-created. This is + * the resource name. + * @return the next definition stage. + */ + Update withContentId(String contentId); + } + + /** + * The stage of the TemplateModel update allowing to specify contentProductId. + */ + interface WithContentProductId { + /** + * Specifies the contentProductId property: Unique ID for the content. It should be generated based on the + * contentId of the package, contentId of the template, contentKind of the template and the contentVersion + * of the template. + * + * @param contentProductId Unique ID for the content. It should be generated based on the contentId of the + * package, contentId of the template, contentKind of the template and the contentVersion of the template. + * @return the next definition stage. + */ + Update withContentProductId(String contentProductId); + } + + /** + * The stage of the TemplateModel update allowing to specify packageVersion. + */ + interface WithPackageVersion { + /** + * Specifies the packageVersion property: Version of the package. Default and recommended format is numeric + * (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + * cannot guarantee any version checks. + * + * @param packageVersion Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, + * 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot + * guarantee any version checks. + * @return the next definition stage. + */ + Update withPackageVersion(String packageVersion); + } + + /** + * The stage of the TemplateModel update allowing to specify version. + */ + interface WithVersion { + /** + * Specifies the version property: Version of the content. Default and recommended format is numeric (e.g. + * 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we + * cannot guarantee any version checks. + * + * @param version Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, + * 1.0.0.0), following ARM metadata best practices. Can also be any string, but then we cannot guarantee any + * version checks. + * @return the next definition stage. + */ + Update withVersion(String version); + } + + /** + * The stage of the TemplateModel update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the template. + * + * @param displayName The display name of the template. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the TemplateModel update allowing to specify contentKind. + */ + interface WithContentKind { + /** + * Specifies the contentKind property: The kind of content the template is for.. + * + * @param contentKind The kind of content the template is for. + * @return the next definition stage. + */ + Update withContentKind(Kind contentKind); + } + + /** + * The stage of the TemplateModel update allowing to specify source. + */ + interface WithSource { + /** + * Specifies the source property: Source of the content. This is where/how it was created.. + * + * @param source Source of the content. This is where/how it was created. + * @return the next definition stage. + */ + Update withSource(MetadataSource source); + } + + /** + * The stage of the TemplateModel update allowing to specify author. + */ + interface WithAuthor { + /** + * Specifies the author property: The creator of the content item.. + * + * @param author The creator of the content item. + * @return the next definition stage. + */ + Update withAuthor(MetadataAuthor author); + } + + /** + * The stage of the TemplateModel update allowing to specify support. + */ + interface WithSupport { + /** + * Specifies the support property: Support information for the template - type, name, contact information. + * + * @param support Support information for the template - type, name, contact information. + * @return the next definition stage. + */ + Update withSupport(MetadataSupport support); + } + + /** + * The stage of the TemplateModel update allowing to specify dependencies. + */ + interface WithDependencies { + /** + * Specifies the dependencies property: Dependencies for the content item, what other content items it + * requires to work. Can describe more complex dependencies using a recursive/nested structure. For a single + * dependency an id/kind/version can be supplied or operator/criteria for complex formats.. + * + * @param dependencies Dependencies for the content item, what other content items it requires to work. Can + * describe more complex dependencies using a recursive/nested structure. For a single dependency an + * id/kind/version can be supplied or operator/criteria for complex formats. + * @return the next definition stage. + */ + Update withDependencies(MetadataDependencies dependencies); + } + + /** + * The stage of the TemplateModel update allowing to specify categories. + */ + interface WithCategories { + /** + * Specifies the categories property: Categories for the item. + * + * @param categories Categories for the item. + * @return the next definition stage. + */ + Update withCategories(MetadataCategories categories); + } + + /** + * The stage of the TemplateModel update allowing to specify providers. + */ + interface WithProviders { + /** + * Specifies the providers property: Providers for the content item. + * + * @param providers Providers for the content item. + * @return the next definition stage. + */ + Update withProviders(List providers); + } + + /** + * The stage of the TemplateModel update allowing to specify firstPublishDate. + */ + interface WithFirstPublishDate { + /** + * Specifies the firstPublishDate property: first publish date content item. + * + * @param firstPublishDate first publish date content item. + * @return the next definition stage. + */ + Update withFirstPublishDate(LocalDate firstPublishDate); + } + + /** + * The stage of the TemplateModel update allowing to specify lastPublishDate. + */ + interface WithLastPublishDate { + /** + * Specifies the lastPublishDate property: last publish date for the content item. + * + * @param lastPublishDate last publish date for the content item. + * @return the next definition stage. + */ + Update withLastPublishDate(LocalDate lastPublishDate); + } + + /** + * The stage of the TemplateModel update allowing to specify customVersion. + */ + interface WithCustomVersion { + /** + * Specifies the customVersion property: The custom version of the content. A optional free text. + * + * @param customVersion The custom version of the content. A optional free text. + * @return the next definition stage. + */ + Update withCustomVersion(String customVersion); + } + + /** + * The stage of the TemplateModel update allowing to specify contentSchemaVersion. + */ + interface WithContentSchemaVersion { + /** + * Specifies the contentSchemaVersion property: Schema version of the content. Can be used to distinguish + * between different flow based on the schema version. + * + * @param contentSchemaVersion Schema version of the content. Can be used to distinguish between different + * flow based on the schema version. + * @return the next definition stage. + */ + Update withContentSchemaVersion(String contentSchemaVersion); + } + + /** + * The stage of the TemplateModel update allowing to specify icon. + */ + interface WithIcon { + /** + * Specifies the icon property: the icon identifier. this id can later be fetched from the content metadata. + * + * @param icon the icon identifier. this id can later be fetched from the content metadata. + * @return the next definition stage. + */ + Update withIcon(String icon); + } + + /** + * The stage of the TemplateModel update allowing to specify threatAnalysisTactics. + */ + interface WithThreatAnalysisTactics { + /** + * Specifies the threatAnalysisTactics property: the tactics the resource covers. + * + * @param threatAnalysisTactics the tactics the resource covers. + * @return the next definition stage. + */ + Update withThreatAnalysisTactics(List threatAnalysisTactics); + } + + /** + * The stage of the TemplateModel update allowing to specify threatAnalysisTechniques. + */ + interface WithThreatAnalysisTechniques { + /** + * Specifies the threatAnalysisTechniques property: the techniques the resource covers, these have to be + * aligned with the tactics being used. + * + * @param threatAnalysisTechniques the techniques the resource covers, these have to be aligned with the + * tactics being used. + * @return the next definition stage. + */ + Update withThreatAnalysisTechniques(List threatAnalysisTechniques); + } + + /** + * The stage of the TemplateModel update allowing to specify previewImages. + */ + interface WithPreviewImages { + /** + * Specifies the previewImages property: preview image file names. These will be taken from the solution + * artifacts. + * + * @param previewImages preview image file names. These will be taken from the solution artifacts. + * @return the next definition stage. + */ + Update withPreviewImages(List previewImages); + } + + /** + * The stage of the TemplateModel update allowing to specify previewImagesDark. + */ + interface WithPreviewImagesDark { + /** + * Specifies the previewImagesDark property: preview image file names. These will be taken from the solution + * artifacts. used for dark theme support. + * + * @param previewImagesDark preview image file names. These will be taken from the solution artifacts. used + * for dark theme support. + * @return the next definition stage. + */ + Update withPreviewImagesDark(List previewImagesDark); + } + + /** + * The stage of the TemplateModel update allowing to specify packageId. + */ + interface WithPackageId { + /** + * Specifies the packageId property: the package Id contains this template. + * + * @param packageId the package Id contains this template. + * @return the next definition stage. + */ + Update withPackageId(String packageId); + } + + /** + * The stage of the TemplateModel update allowing to specify packageKind. + */ + interface WithPackageKind { + /** + * Specifies the packageKind property: the packageKind of the package contains this template. + * + * @param packageKind the packageKind of the package contains this template. + * @return the next definition stage. + */ + Update withPackageKind(PackageKind packageKind); + } + + /** + * The stage of the TemplateModel update allowing to specify packageName. + */ + interface WithPackageName { + /** + * Specifies the packageName property: the name of the package contains this template. + * + * @param packageName the name of the package contains this template. + * @return the next definition stage. + */ + Update withPackageName(String packageName); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TemplateModel refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TemplateModel refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatActor.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatActor.java new file mode 100644 index 000000000000..8770edacfb10 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatActor.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectCommonProperties; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Represents a threat actor in Azure Security Insights. + */ +@Immutable +public final class ThreatActor extends TIObjectInner { + /* + * The kind of the TI object + */ + private TIObjectKind kind = TIObjectKind.THREAT_ACTOR; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The properties of the TI object + */ + private TIObjectCommonProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ThreatActor class. + */ + public ThreatActor() { + } + + /** + * Get the kind property: The kind of the TI object. + * + * @return the kind value. + */ + @Override + public TIObjectKind kind() { + return this.kind; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of the TI object. + * + * @return the innerProperties value. + */ + private TIObjectCommonProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the data property: The core STIX object that this TI object represents. + * + * @return the data value. + */ + public Map data() { + return this.innerProperties() == null ? null : this.innerProperties().data(); + } + + /** + * Get the createdBy property: The UserInfo of the user/entity which originally created this TI object. + * + * @return the createdBy value. + */ + public UserInfo createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the source property: The source name for this TI object. + * + * @return the source value. + */ + public String source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Get the firstIngestedTimeUtc property: The timestamp for the first time this object was ingested. + * + * @return the firstIngestedTimeUtc value. + */ + public OffsetDateTime firstIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().firstIngestedTimeUtc(); + } + + /** + * Get the lastIngestedTimeUtc property: The timestamp for the last time this object was ingested. + * + * @return the lastIngestedTimeUtc value. + */ + public OffsetDateTime lastIngestedTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastIngestedTimeUtc(); + } + + /** + * Get the ingestionRulesVersion property: The ID of the rules version that was active when this TI object was last + * ingested. + * + * @return the ingestionRulesVersion value. + */ + public UUID ingestionRulesVersion() { + return this.innerProperties() == null ? null : this.innerProperties().ingestionRulesVersion(); + } + + /** + * Get the lastUpdateMethod property: The name of the method/application that initiated the last write to this TI + * object. + * + * @return the lastUpdateMethod value. + */ + public String lastUpdateMethod() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateMethod(); + } + + /** + * Get the lastModifiedBy property: The UserInfo of the user/entity which last modified this TI object. + * + * @return the lastModifiedBy value. + */ + public UserInfo lastModifiedBy() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy(); + } + + /** + * Get the lastUpdatedDateTimeUtc property: The timestamp for the last time this TI object was updated. + * + * @return the lastUpdatedDateTimeUtc value. + */ + public OffsetDateTime lastUpdatedDateTimeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateTimeUtc(); + } + + /** + * Get the relationshipHints property: A dictionary used to help follow relationships from this object to other STIX + * objects. The keys are field names from the STIX object (in the 'data' field), and the values are lists of sources + * that can be prepended to the object ID in order to efficiently locate the target TI object. + * + * @return the relationshipHints value. + */ + public List relationshipHints() { + return this.innerProperties() == null ? null : this.innerProperties().relationshipHints(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreatActor from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreatActor if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreatActor. + */ + public static ThreatActor fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThreatActor deserializedThreatActor = new ThreatActor(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedThreatActor.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedThreatActor.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedThreatActor.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedThreatActor.innerProperties = TIObjectCommonProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedThreatActor.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedThreatActor.kind = TIObjectKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedThreatActor; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceAlertRule.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceAlertRule.java new file mode 100644 index 000000000000..d9517db9d200 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceAlertRule.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleInner; +import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceAlertRuleProperties; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Represents Threat Intelligence alert rule. + */ +@Fluent +public final class ThreatIntelligenceAlertRule extends AlertRuleInner { + /* + * The kind of the alert rule + */ + private AlertRuleKind kind = AlertRuleKind.THREAT_INTELLIGENCE; + + /* + * Threat Intelligence alert rule properties + */ + private ThreatIntelligenceAlertRuleProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ThreatIntelligenceAlertRule class. + */ + public ThreatIntelligenceAlertRule() { + } + + /** + * Get the kind property: The kind of the alert rule. + * + * @return the kind value. + */ + @Override + public AlertRuleKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Threat Intelligence alert rule properties. + * + * @return the innerProperties value. + */ + private ThreatIntelligenceAlertRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ThreatIntelligenceAlertRule withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @return the alertRuleTemplateName value. + */ + public String alertRuleTemplateName() { + return this.innerProperties() == null ? null : this.innerProperties().alertRuleTemplateName(); + } + + /** + * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule. + * + * @param alertRuleTemplateName the alertRuleTemplateName value to set. + * @return the ThreatIntelligenceAlertRule object itself. + */ + public ThreatIntelligenceAlertRule withAlertRuleTemplateName(String alertRuleTemplateName) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleProperties(); + } + this.innerProperties().withAlertRuleTemplateName(alertRuleTemplateName); + return this; + } + + /** + * Get the description property: The description of the alert rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the displayName property: The display name for alerts created by this alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Determines whether this alert rule is enabled or disabled. + * + * @param enabled the enabled value to set. + * @return the ThreatIntelligenceAlertRule object itself. + */ + public ThreatIntelligenceAlertRule withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the lastModifiedUtc property: The last time that this alert has been modified. + * + * @return the lastModifiedUtc value. + */ + public OffsetDateTime lastModifiedUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc(); + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.innerProperties() == null ? null : this.innerProperties().tactics(); + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.innerProperties() == null ? null : this.innerProperties().techniques(); + } + + /** + * Get the subTechniques property: The sub-techniques of the alert rule. + * + * @return the subTechniques value. + */ + public List subTechniques() { + return this.innerProperties() == null ? null : this.innerProperties().subTechniques(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreatIntelligenceAlertRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreatIntelligenceAlertRule if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreatIntelligenceAlertRule. + */ + public static ThreatIntelligenceAlertRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThreatIntelligenceAlertRule deserializedThreatIntelligenceAlertRule = new ThreatIntelligenceAlertRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedThreatIntelligenceAlertRule.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedThreatIntelligenceAlertRule.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedThreatIntelligenceAlertRule.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedThreatIntelligenceAlertRule.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedThreatIntelligenceAlertRule.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedThreatIntelligenceAlertRule.kind = AlertRuleKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedThreatIntelligenceAlertRule.innerProperties + = ThreatIntelligenceAlertRuleProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedThreatIntelligenceAlertRule; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceAlertRuleTemplate.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceAlertRuleTemplate.java new file mode 100644 index 000000000000..478a864819d0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceAlertRuleTemplate.java @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleTemplateInner; +import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceAlertRuleTemplateProperties; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Represents Threat Intelligence alert rule template. + */ +@Fluent +public final class ThreatIntelligenceAlertRuleTemplate extends AlertRuleTemplateInner { + /* + * The kind of the alert rule + */ + private AlertRuleKind kind = AlertRuleKind.THREAT_INTELLIGENCE; + + /* + * Threat Intelligence alert rule template properties + */ + private ThreatIntelligenceAlertRuleTemplateProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ThreatIntelligenceAlertRuleTemplate class. + */ + public ThreatIntelligenceAlertRuleTemplate() { + } + + /** + * Get the kind property: The kind of the alert rule. + * + * @return the kind value. + */ + @Override + public AlertRuleKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Threat Intelligence alert rule template properties. + * + * @return the innerProperties value. + */ + private ThreatIntelligenceAlertRuleTemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the severity property: The severity for alerts created by this alert rule. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: The severity for alerts created by this alert rule. + * + * @param severity the severity value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate withSeverity(AlertSeverity severity) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the tactics property: The tactics of the alert rule. + * + * @return the tactics value. + */ + public List tactics() { + return this.innerProperties() == null ? null : this.innerProperties().tactics(); + } + + /** + * Set the tactics property: The tactics of the alert rule. + * + * @param tactics the tactics value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate withTactics(List tactics) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withTactics(tactics); + return this; + } + + /** + * Get the techniques property: The techniques of the alert rule. + * + * @return the techniques value. + */ + public List techniques() { + return this.innerProperties() == null ? null : this.innerProperties().techniques(); + } + + /** + * Set the techniques property: The techniques of the alert rule. + * + * @param techniques the techniques value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate withTechniques(List techniques) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withTechniques(techniques); + return this; + } + + /** + * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @return the alertRulesCreatedByTemplateCount value. + */ + public Integer alertRulesCreatedByTemplateCount() { + return this.innerProperties() == null ? null : this.innerProperties().alertRulesCreatedByTemplateCount(); + } + + /** + * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template. + * + * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate + withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount); + return this; + } + + /** + * Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated. + * + * @return the lastUpdatedDateUtc value. + */ + public OffsetDateTime lastUpdatedDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedDateUtc(); + } + + /** + * Get the createdDateUtc property: The time that this alert rule template has been added. + * + * @return the createdDateUtc value. + */ + public OffsetDateTime createdDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdDateUtc(); + } + + /** + * Get the description property: The description of the alert rule template. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the alert rule template. + * + * @param description the description value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the displayName property: The display name for alert rule template. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name for alert rule template. + * + * @param displayName the displayName value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the requiredDataConnectors property: The required data sources for this template. + * + * @return the requiredDataConnectors value. + */ + public List requiredDataConnectors() { + return this.innerProperties() == null ? null : this.innerProperties().requiredDataConnectors(); + } + + /** + * Set the requiredDataConnectors property: The required data sources for this template. + * + * @param requiredDataConnectors the requiredDataConnectors value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate + withRequiredDataConnectors(List requiredDataConnectors) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withRequiredDataConnectors(requiredDataConnectors); + return this; + } + + /** + * Get the status property: The alert rule template status. + * + * @return the status value. + */ + public TemplateStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The alert rule template status. + * + * @param status the status value to set. + * @return the ThreatIntelligenceAlertRuleTemplate object itself. + */ + public ThreatIntelligenceAlertRuleTemplate withStatus(TemplateStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new ThreatIntelligenceAlertRuleTemplateProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreatIntelligenceAlertRuleTemplate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreatIntelligenceAlertRuleTemplate if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreatIntelligenceAlertRuleTemplate. + */ + public static ThreatIntelligenceAlertRuleTemplate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThreatIntelligenceAlertRuleTemplate deserializedThreatIntelligenceAlertRuleTemplate + = new ThreatIntelligenceAlertRuleTemplate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplate.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplate.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplate.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplate.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplate.kind = AlertRuleKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedThreatIntelligenceAlertRuleTemplate.innerProperties + = ThreatIntelligenceAlertRuleTemplateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedThreatIntelligenceAlertRuleTemplate; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceCount.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceCount.java new file mode 100644 index 000000000000..056ff43cf15a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceCount.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceCountInner; + +/** + * An immutable client-side representation of ThreatIntelligenceCount. + */ +public interface ThreatIntelligenceCount { + /** + * Gets the count property: Count of all the threat intelligence objects on the workspace that match the provided + * query. + * + * @return the count value. + */ + int count(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceCountInner object. + * + * @return the inner object. + */ + ThreatIntelligenceCountInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceList.java new file mode 100644 index 000000000000..686c3d138288 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligenceList.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TIObjectInner; +import java.io.IOException; +import java.util.List; + +/** + * List all the threat intelligence objects on the workspace that match the provided query. + */ +@Fluent +public final class ThreatIntelligenceList implements JsonSerializable { + /* + * URL to fetch the next set of threat intelligence objects. + */ + private String nextLink; + + /* + * Array of threat intelligence objects on the workspace that match the provided query. + */ + private List value; + + /** + * Creates an instance of ThreatIntelligenceList class. + */ + public ThreatIntelligenceList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of threat intelligence objects. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of threat intelligence objects on the workspace that match the provided query. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of threat intelligence objects on the workspace that match the provided query. + * + * @param value the value value to set. + * @return the ThreatIntelligenceList object itself. + */ + public ThreatIntelligenceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ThreatIntelligenceList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThreatIntelligenceList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ThreatIntelligenceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ThreatIntelligenceList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ThreatIntelligenceList. + */ + public static ThreatIntelligenceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ThreatIntelligenceList deserializedThreatIntelligenceList = new ThreatIntelligenceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> TIObjectInner.fromJson(reader1)); + deserializedThreatIntelligenceList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedThreatIntelligenceList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedThreatIntelligenceList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligences.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligences.java new file mode 100644 index 000000000000..c01e847ea8a9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ThreatIntelligences.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ThreatIntelligences. + */ +public interface ThreatIntelligences { + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace along with {@link Response}. + */ + Response countWithResponse(String resourceGroupName, String workspaceName, TiType tiType, + CountQuery query, Context context); + + /** + * Gets the count of all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the count of all TI objects for the workspace. + */ + ThreatIntelligenceCount count(String resourceGroupName, String workspaceName, TiType tiType); + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedIterable}. + */ + PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType); + + /** + * Gets all TI objects for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tiType TI type. + * @param query The query to run on the TI objects in the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all TI objects for the workspace as paginated response with {@link PagedIterable}. + */ + PagedIterable query(String resourceGroupName, String workspaceName, TiType tiType, Query query, + Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiCheckRequirements.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiCheckRequirements.java new file mode 100644 index 000000000000..361861d12f42 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiCheckRequirements.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TiTaxiiCheckRequirementsProperties; +import java.io.IOException; + +/** + * Threat Intelligence TAXII data connector check requirements. + */ +@Fluent +public final class TiTaxiiCheckRequirements extends DataConnectorsCheckRequirements { + /* + * Describes the kind of connector to be checked. + */ + private DataConnectorKind kind = DataConnectorKind.THREAT_INTELLIGENCE_TAXII; + + /* + * Threat Intelligence TAXII check required properties. + */ + private TiTaxiiCheckRequirementsProperties innerProperties; + + /** + * Creates an instance of TiTaxiiCheckRequirements class. + */ + public TiTaxiiCheckRequirements() { + } + + /** + * Get the kind property: Describes the kind of connector to be checked. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Threat Intelligence TAXII check required properties. + * + * @return the innerProperties value. + */ + TiTaxiiCheckRequirementsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the TiTaxiiCheckRequirements object itself. + */ + public TiTaxiiCheckRequirements withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiCheckRequirementsProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TiTaxiiCheckRequirements from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TiTaxiiCheckRequirements if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TiTaxiiCheckRequirements. + */ + public static TiTaxiiCheckRequirements fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TiTaxiiCheckRequirements deserializedTiTaxiiCheckRequirements = new TiTaxiiCheckRequirements(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedTiTaxiiCheckRequirements.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedTiTaxiiCheckRequirements.innerProperties + = TiTaxiiCheckRequirementsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTiTaxiiCheckRequirements; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnector.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnector.java new file mode 100644 index 000000000000..641facc51f9f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnector.java @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; +import com.azure.resourcemanager.securityinsights.fluent.models.TiTaxiiDataConnectorProperties; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Data connector to pull Threat intelligence data from TAXII 2.0/2.1 server. + */ +@Fluent +public final class TiTaxiiDataConnector extends DataConnectorInner { + /* + * The data connector kind + */ + private DataConnectorKind kind = DataConnectorKind.THREAT_INTELLIGENCE_TAXII; + + /* + * Threat intelligence TAXII data connector properties. + */ + private TiTaxiiDataConnectorProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TiTaxiiDataConnector class. + */ + public TiTaxiiDataConnector() { + } + + /** + * Get the kind property: The data connector kind. + * + * @return the kind value. + */ + @Override + public DataConnectorKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Threat intelligence TAXII data connector properties. + * + * @return the innerProperties value. + */ + private TiTaxiiDataConnectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TiTaxiiDataConnector withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the workspaceId property: The workspace id. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.innerProperties() == null ? null : this.innerProperties().workspaceId(); + } + + /** + * Set the workspaceId property: The workspace id. + * + * @param workspaceId the workspaceId value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withWorkspaceId(String workspaceId) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withWorkspaceId(workspaceId); + return this; + } + + /** + * Get the friendlyName property: The friendly name for the TAXII server. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().friendlyName(); + } + + /** + * Set the friendlyName property: The friendly name for the TAXII server. + * + * @param friendlyName the friendlyName value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withFriendlyName(String friendlyName) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withFriendlyName(friendlyName); + return this; + } + + /** + * Get the taxiiServer property: The API root for the TAXII server. + * + * @return the taxiiServer value. + */ + public String taxiiServer() { + return this.innerProperties() == null ? null : this.innerProperties().taxiiServer(); + } + + /** + * Set the taxiiServer property: The API root for the TAXII server. + * + * @param taxiiServer the taxiiServer value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withTaxiiServer(String taxiiServer) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withTaxiiServer(taxiiServer); + return this; + } + + /** + * Get the collectionId property: The collection id of the TAXII server. + * + * @return the collectionId value. + */ + public String collectionId() { + return this.innerProperties() == null ? null : this.innerProperties().collectionId(); + } + + /** + * Set the collectionId property: The collection id of the TAXII server. + * + * @param collectionId the collectionId value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withCollectionId(String collectionId) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withCollectionId(collectionId); + return this; + } + + /** + * Get the username property: The userName for the TAXII server. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Set the username property: The userName for the TAXII server. + * + * @param username the username value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withUsername(String username) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withUsername(username); + return this; + } + + /** + * Get the password property: The password for the TAXII server. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().password(); + } + + /** + * Set the password property: The password for the TAXII server. + * + * @param password the password value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withPassword(String password) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withPassword(password); + return this; + } + + /** + * Get the taxiiLookbackPeriod property: The lookback period for the TAXII server. + * + * @return the taxiiLookbackPeriod value. + */ + public OffsetDateTime taxiiLookbackPeriod() { + return this.innerProperties() == null ? null : this.innerProperties().taxiiLookbackPeriod(); + } + + /** + * Set the taxiiLookbackPeriod property: The lookback period for the TAXII server. + * + * @param taxiiLookbackPeriod the taxiiLookbackPeriod value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withTaxiiLookbackPeriod(OffsetDateTime taxiiLookbackPeriod) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withTaxiiLookbackPeriod(taxiiLookbackPeriod); + return this; + } + + /** + * Get the pollingFrequency property: The polling frequency for the TAXII server. + * + * @return the pollingFrequency value. + */ + public PollingFrequency pollingFrequency() { + return this.innerProperties() == null ? null : this.innerProperties().pollingFrequency(); + } + + /** + * Set the pollingFrequency property: The polling frequency for the TAXII server. + * + * @param pollingFrequency the pollingFrequency value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withPollingFrequency(PollingFrequency pollingFrequency) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withPollingFrequency(pollingFrequency); + return this; + } + + /** + * Get the dataTypes property: The available data types for Threat Intelligence TAXII data connector. + * + * @return the dataTypes value. + */ + public TiTaxiiDataConnectorDataTypes dataTypes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTypes(); + } + + /** + * Set the dataTypes property: The available data types for Threat Intelligence TAXII data connector. + * + * @param dataTypes the dataTypes value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withDataTypes(TiTaxiiDataConnectorDataTypes dataTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withDataTypes(dataTypes); + return this; + } + + /** + * Get the tenantId property: The tenant id to connect to, and get the data from. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The tenant id to connect to, and get the data from. + * + * @param tenantId the tenantId value to set. + * @return the TiTaxiiDataConnector object itself. + */ + public TiTaxiiDataConnector withTenantId(String tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new TiTaxiiDataConnectorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TiTaxiiDataConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TiTaxiiDataConnector if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TiTaxiiDataConnector. + */ + public static TiTaxiiDataConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TiTaxiiDataConnector deserializedTiTaxiiDataConnector = new TiTaxiiDataConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTiTaxiiDataConnector.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTiTaxiiDataConnector.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTiTaxiiDataConnector.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedTiTaxiiDataConnector.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedTiTaxiiDataConnector.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedTiTaxiiDataConnector.kind = DataConnectorKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedTiTaxiiDataConnector.innerProperties = TiTaxiiDataConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTiTaxiiDataConnector; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnectorDataTypes.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnectorDataTypes.java new file mode 100644 index 000000000000..5044902e4cf9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnectorDataTypes.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The available data types for Threat Intelligence TAXII data connector. + */ +@Fluent +public final class TiTaxiiDataConnectorDataTypes implements JsonSerializable { + /* + * Data type for TAXII connector. + */ + private TiTaxiiDataConnectorDataTypesTaxiiClient taxiiClient; + + /** + * Creates an instance of TiTaxiiDataConnectorDataTypes class. + */ + public TiTaxiiDataConnectorDataTypes() { + } + + /** + * Get the taxiiClient property: Data type for TAXII connector. + * + * @return the taxiiClient value. + */ + public TiTaxiiDataConnectorDataTypesTaxiiClient taxiiClient() { + return this.taxiiClient; + } + + /** + * Set the taxiiClient property: Data type for TAXII connector. + * + * @param taxiiClient the taxiiClient value to set. + * @return the TiTaxiiDataConnectorDataTypes object itself. + */ + public TiTaxiiDataConnectorDataTypes withTaxiiClient(TiTaxiiDataConnectorDataTypesTaxiiClient taxiiClient) { + this.taxiiClient = taxiiClient; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (taxiiClient() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property taxiiClient in model TiTaxiiDataConnectorDataTypes")); + } else { + taxiiClient().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TiTaxiiDataConnectorDataTypes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("taxiiClient", this.taxiiClient); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TiTaxiiDataConnectorDataTypes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TiTaxiiDataConnectorDataTypes if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TiTaxiiDataConnectorDataTypes. + */ + public static TiTaxiiDataConnectorDataTypes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TiTaxiiDataConnectorDataTypes deserializedTiTaxiiDataConnectorDataTypes + = new TiTaxiiDataConnectorDataTypes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("taxiiClient".equals(fieldName)) { + deserializedTiTaxiiDataConnectorDataTypes.taxiiClient + = TiTaxiiDataConnectorDataTypesTaxiiClient.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTiTaxiiDataConnectorDataTypes; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnectorDataTypesTaxiiClient.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnectorDataTypesTaxiiClient.java new file mode 100644 index 000000000000..0b7374ec8d29 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiTaxiiDataConnectorDataTypesTaxiiClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Data type for TAXII connector. + */ +@Fluent +public final class TiTaxiiDataConnectorDataTypesTaxiiClient extends DataConnectorDataTypeCommon { + /** + * Creates an instance of TiTaxiiDataConnectorDataTypesTaxiiClient class. + */ + public TiTaxiiDataConnectorDataTypesTaxiiClient() { + } + + /** + * {@inheritDoc} + */ + @Override + public TiTaxiiDataConnectorDataTypesTaxiiClient withState(DataTypeState state) { + super.withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model TiTaxiiDataConnectorDataTypesTaxiiClient")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TiTaxiiDataConnectorDataTypesTaxiiClient.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", state() == null ? null : state().toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TiTaxiiDataConnectorDataTypesTaxiiClient from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TiTaxiiDataConnectorDataTypesTaxiiClient if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TiTaxiiDataConnectorDataTypesTaxiiClient. + */ + public static TiTaxiiDataConnectorDataTypesTaxiiClient fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TiTaxiiDataConnectorDataTypesTaxiiClient deserializedTiTaxiiDataConnectorDataTypesTaxiiClient + = new TiTaxiiDataConnectorDataTypesTaxiiClient(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedTiTaxiiDataConnectorDataTypesTaxiiClient + .withState(DataTypeState.fromString(reader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedTiTaxiiDataConnectorDataTypesTaxiiClient; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiType.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiType.java new file mode 100644 index 000000000000..425f2e045183 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TiType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for TiType. + */ +public final class TiType extends ExpandableStringEnum { + /** + * Static value main for TiType. + */ + public static final TiType MAIN = fromString("main"); + + /** + * Creates a new instance of TiType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TiType() { + } + + /** + * Creates or finds a TiType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TiType. + */ + public static TiType fromString(String name) { + return fromString(name, TiType.class); + } + + /** + * Gets known TiType values. + * + * @return known TiType values. + */ + public static Collection values() { + return values(TiType.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineAggregation.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineAggregation.java new file mode 100644 index 000000000000..81bcf7117c70 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineAggregation.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * timeline aggregation information per kind. + */ +@Fluent +public final class TimelineAggregation implements JsonSerializable { + /* + * the total items found for a kind + */ + private int count; + + /* + * the query kind + */ + private EntityTimelineKind kind; + + /** + * Creates an instance of TimelineAggregation class. + */ + public TimelineAggregation() { + } + + /** + * Get the count property: the total items found for a kind. + * + * @return the count value. + */ + public int count() { + return this.count; + } + + /** + * Set the count property: the total items found for a kind. + * + * @param count the count value to set. + * @return the TimelineAggregation object itself. + */ + public TimelineAggregation withCount(int count) { + this.count = count; + return this; + } + + /** + * Get the kind property: the query kind. + * + * @return the kind value. + */ + public EntityTimelineKind kind() { + return this.kind; + } + + /** + * Set the kind property: the query kind. + * + * @param kind the kind value to set. + * @return the TimelineAggregation object itself. + */ + public TimelineAggregation withKind(EntityTimelineKind kind) { + this.kind = kind; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (kind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property kind in model TimelineAggregation")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TimelineAggregation.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("count", this.count); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimelineAggregation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimelineAggregation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TimelineAggregation. + */ + public static TimelineAggregation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimelineAggregation deserializedTimelineAggregation = new TimelineAggregation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedTimelineAggregation.count = reader.getInt(); + } else if ("kind".equals(fieldName)) { + deserializedTimelineAggregation.kind = EntityTimelineKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTimelineAggregation; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineError.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineError.java new file mode 100644 index 000000000000..6a53e5619e18 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineError.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Timeline Query Errors. + */ +@Fluent +public final class TimelineError implements JsonSerializable { + /* + * the query kind + */ + private EntityTimelineKind kind; + + /* + * the query id + */ + private String queryId; + + /* + * the error message + */ + private String errorMessage; + + /** + * Creates an instance of TimelineError class. + */ + public TimelineError() { + } + + /** + * Get the kind property: the query kind. + * + * @return the kind value. + */ + public EntityTimelineKind kind() { + return this.kind; + } + + /** + * Set the kind property: the query kind. + * + * @param kind the kind value to set. + * @return the TimelineError object itself. + */ + public TimelineError withKind(EntityTimelineKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the queryId property: the query id. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: the query id. + * + * @param queryId the queryId value to set. + * @return the TimelineError object itself. + */ + public TimelineError withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the errorMessage property: the error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set the errorMessage property: the error message. + * + * @param errorMessage the errorMessage value to set. + * @return the TimelineError object itself. + */ + public TimelineError withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (kind() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property kind in model TimelineError")); + } + if (errorMessage() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property errorMessage in model TimelineError")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TimelineError.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeStringField("queryId", this.queryId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimelineError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimelineError if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TimelineError. + */ + public static TimelineError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimelineError deserializedTimelineError = new TimelineError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedTimelineError.kind = EntityTimelineKind.fromString(reader.getString()); + } else if ("errorMessage".equals(fieldName)) { + deserializedTimelineError.errorMessage = reader.getString(); + } else if ("queryId".equals(fieldName)) { + deserializedTimelineError.queryId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTimelineError; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineResultsMetadata.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineResultsMetadata.java new file mode 100644 index 000000000000..a3d1f03d0a4a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TimelineResultsMetadata.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Expansion result metadata. + */ +@Fluent +public final class TimelineResultsMetadata implements JsonSerializable { + /* + * the total items found for the timeline request + */ + private int totalCount; + + /* + * timeline aggregation per kind + */ + private List aggregations; + + /* + * information about the failure queries + */ + private List errors; + + /** + * Creates an instance of TimelineResultsMetadata class. + */ + public TimelineResultsMetadata() { + } + + /** + * Get the totalCount property: the total items found for the timeline request. + * + * @return the totalCount value. + */ + public int totalCount() { + return this.totalCount; + } + + /** + * Set the totalCount property: the total items found for the timeline request. + * + * @param totalCount the totalCount value to set. + * @return the TimelineResultsMetadata object itself. + */ + public TimelineResultsMetadata withTotalCount(int totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Get the aggregations property: timeline aggregation per kind. + * + * @return the aggregations value. + */ + public List aggregations() { + return this.aggregations; + } + + /** + * Set the aggregations property: timeline aggregation per kind. + * + * @param aggregations the aggregations value to set. + * @return the TimelineResultsMetadata object itself. + */ + public TimelineResultsMetadata withAggregations(List aggregations) { + this.aggregations = aggregations; + return this; + } + + /** + * Get the errors property: information about the failure queries. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Set the errors property: information about the failure queries. + * + * @param errors the errors value to set. + * @return the TimelineResultsMetadata object itself. + */ + public TimelineResultsMetadata withErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aggregations() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property aggregations in model TimelineResultsMetadata")); + } else { + aggregations().forEach(e -> e.validate()); + } + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TimelineResultsMetadata.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("totalCount", this.totalCount); + jsonWriter.writeArrayField("aggregations", this.aggregations, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("errors", this.errors, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimelineResultsMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimelineResultsMetadata if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TimelineResultsMetadata. + */ + public static TimelineResultsMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimelineResultsMetadata deserializedTimelineResultsMetadata = new TimelineResultsMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalCount".equals(fieldName)) { + deserializedTimelineResultsMetadata.totalCount = reader.getInt(); + } else if ("aggregations".equals(fieldName)) { + List aggregations + = reader.readArray(reader1 -> TimelineAggregation.fromJson(reader1)); + deserializedTimelineResultsMetadata.aggregations = aggregations; + } else if ("errors".equals(fieldName)) { + List errors = reader.readArray(reader1 -> TimelineError.fromJson(reader1)); + deserializedTimelineResultsMetadata.errors = errors; + } else { + reader.skipChildren(); + } + } + + return deserializedTimelineResultsMetadata; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRun.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRun.java new file mode 100644 index 000000000000..0b64f76d1ee4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRun.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An immutable client-side representation of TriggeredAnalyticsRuleRun. + */ +public interface TriggeredAnalyticsRuleRun { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag of the azure resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the executionTimeUtc property: The executionTimeUtc property. + * + * @return the executionTimeUtc value. + */ + OffsetDateTime executionTimeUtc(); + + /** + * Gets the ruleId property: The ruleId property. + * + * @return the ruleId value. + */ + String ruleId(); + + /** + * Gets the triggeredAnalyticsRuleRunId property: The triggeredAnalyticsRuleRunId property. + * + * @return the triggeredAnalyticsRuleRunId value. + */ + String triggeredAnalyticsRuleRunId(); + + /** + * Gets the provisioningState property: The triggered analytics rule run provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the ruleRunAdditionalData property: Dictionary of <any>. + * + * @return the ruleRunAdditionalData value. + */ + Map ruleRunAdditionalData(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner object. + * + * @return the inner object. + */ + TriggeredAnalyticsRuleRunInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRunOperations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRunOperations.java new file mode 100644 index 000000000000..0c7f2391fa03 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRunOperations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of TriggeredAnalyticsRuleRunOperations. + */ +public interface TriggeredAnalyticsRuleRunOperations { + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String ruleRunId, Context context); + + /** + * Gets the triggered analytics rule run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param ruleRunId the triggered rule id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the triggered analytics rule run. + */ + TriggeredAnalyticsRuleRun get(String resourceGroupName, String workspaceName, String ruleRunId); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRuns.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRuns.java new file mode 100644 index 000000000000..da1b5636343d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/TriggeredAnalyticsRuleRuns.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.TriggeredAnalyticsRuleRunInner; +import java.io.IOException; +import java.util.List; + +/** + * The triggered analytics rule run array. + */ +@Fluent +public final class TriggeredAnalyticsRuleRuns implements JsonSerializable { + /* + * The value property. + */ + private List value; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of TriggeredAnalyticsRuleRuns class. + */ + public TriggeredAnalyticsRuleRuns() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the TriggeredAnalyticsRuleRuns object itself. + */ + public TriggeredAnalyticsRuleRuns withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model TriggeredAnalyticsRuleRuns")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TriggeredAnalyticsRuleRuns.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TriggeredAnalyticsRuleRuns from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TriggeredAnalyticsRuleRuns if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TriggeredAnalyticsRuleRuns. + */ + public static TriggeredAnalyticsRuleRuns fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TriggeredAnalyticsRuleRuns deserializedTriggeredAnalyticsRuleRuns = new TriggeredAnalyticsRuleRuns(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> TriggeredAnalyticsRuleRunInner.fromJson(reader1)); + deserializedTriggeredAnalyticsRuleRuns.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTriggeredAnalyticsRuleRuns.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTriggeredAnalyticsRuleRuns; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Ueba.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Ueba.java new file mode 100644 index 000000000000..0cd2a4d04aaa --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Ueba.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.SettingsInner; +import com.azure.resourcemanager.securityinsights.fluent.models.UebaProperties; +import java.io.IOException; +import java.util.List; + +/** + * Settings with single toggle. + */ +@Fluent +public final class Ueba extends SettingsInner { + /* + * The kind of the setting + */ + private SettingKind kind = SettingKind.UEBA; + + /* + * Ueba properties + */ + private UebaProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of Ueba class. + */ + public Ueba() { + } + + /** + * Get the kind property: The kind of the setting. + * + * @return the kind value. + */ + @Override + public SettingKind kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Ueba properties. + * + * @return the innerProperties value. + */ + private UebaProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public Ueba withEtag(String etag) { + super.withEtag(etag); + return this; + } + + /** + * Get the dataSources property: The relevant data sources that enriched by ueba. + * + * @return the dataSources value. + */ + public List dataSources() { + return this.innerProperties() == null ? null : this.innerProperties().dataSources(); + } + + /** + * Set the dataSources property: The relevant data sources that enriched by ueba. + * + * @param dataSources the dataSources value to set. + * @return the Ueba object itself. + */ + public Ueba withDataSources(List dataSources) { + if (this.innerProperties() == null) { + this.innerProperties = new UebaProperties(); + } + this.innerProperties().withDataSources(dataSources); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", etag()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Ueba from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Ueba if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Ueba. + */ + public static Ueba fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Ueba deserializedUeba = new Ueba(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedUeba.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedUeba.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedUeba.type = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedUeba.withEtag(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedUeba.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedUeba.kind = SettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedUeba.innerProperties = UebaProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUeba; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UebaDataSources.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UebaDataSources.java new file mode 100644 index 000000000000..cbe81f38e6ab --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UebaDataSources.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The data source that enriched by ueba. + */ +public final class UebaDataSources extends ExpandableStringEnum { + /** + * Static value AuditLogs for UebaDataSources. + */ + public static final UebaDataSources AUDIT_LOGS = fromString("AuditLogs"); + + /** + * Static value AzureActivity for UebaDataSources. + */ + public static final UebaDataSources AZURE_ACTIVITY = fromString("AzureActivity"); + + /** + * Static value SecurityEvent for UebaDataSources. + */ + public static final UebaDataSources SECURITY_EVENT = fromString("SecurityEvent"); + + /** + * Static value SigninLogs for UebaDataSources. + */ + public static final UebaDataSources SIGNIN_LOGS = fromString("SigninLogs"); + + /** + * Creates a new instance of UebaDataSources value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UebaDataSources() { + } + + /** + * Creates or finds a UebaDataSources from its string representation. + * + * @param name a name to look for. + * @return the corresponding UebaDataSources. + */ + public static UebaDataSources fromString(String name) { + return fromString(name, UebaDataSources.class); + } + + /** + * Gets known UebaDataSources values. + * + * @return known UebaDataSources values. + */ + public static Collection values() { + return values(UebaDataSources.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UndoActionPayload.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UndoActionPayload.java new file mode 100644 index 000000000000..3c47f6f54bfd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UndoActionPayload.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the undo action. + */ +@Fluent +public final class UndoActionPayload implements JsonSerializable { + /* + * The action ID of the original action that was performed and now need to undo + */ + private String actionId; + + /** + * Creates an instance of UndoActionPayload class. + */ + public UndoActionPayload() { + } + + /** + * Get the actionId property: The action ID of the original action that was performed and now need to undo. + * + * @return the actionId value. + */ + public String actionId() { + return this.actionId; + } + + /** + * Set the actionId property: The action ID of the original action that was performed and now need to undo. + * + * @param actionId the actionId value to set. + * @return the UndoActionPayload object itself. + */ + public UndoActionPayload withActionId(String actionId) { + this.actionId = actionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionId", this.actionId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UndoActionPayload from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UndoActionPayload if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UndoActionPayload. + */ + public static UndoActionPayload fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UndoActionPayload deserializedUndoActionPayload = new UndoActionPayload(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionId".equals(fieldName)) { + deserializedUndoActionPayload.actionId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUndoActionPayload; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UnlockUserAction.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UnlockUserAction.java new file mode 100644 index 000000000000..b36b145faad4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UnlockUserAction.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.ActionInner; +import java.io.IOException; + +/** + * Represents an unlock user action. + */ +@Fluent +public final class UnlockUserAction extends ActionInner { + /* + * The actions kind + */ + private ListActionKind kind = ListActionKind.UNLOCK_USER; + + /* + * The user to unlock + */ + private String user; + + /* + * The reason of the failure of the action. Empty if the action is successful. + */ + private String failureReason; + + /** + * Creates an instance of UnlockUserAction class. + */ + public UnlockUserAction() { + } + + /** + * Get the kind property: The actions kind. + * + * @return the kind value. + */ + @Override + public ListActionKind kind() { + return this.kind; + } + + /** + * Get the user property: The user to unlock. + * + * @return the user value. + */ + public String user() { + return this.user; + } + + /** + * Set the user property: The user to unlock. + * + * @param user the user value to set. + * @return the UnlockUserAction object itself. + */ + public UnlockUserAction withUser(String user) { + this.user = user; + return this; + } + + /** + * Get the failureReason property: The reason of the failure of the action. Empty if the action is successful. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Set the failureReason property: The reason of the failure of the action. Empty if the action is successful. + * + * @param failureReason the failureReason value to set. + * @return the UnlockUserAction object itself. + */ + public UnlockUserAction withFailureReason(String failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("user", this.user); + jsonWriter.writeStringField("failureReason", this.failureReason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnlockUserAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnlockUserAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UnlockUserAction. + */ + public static UnlockUserAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnlockUserAction deserializedUnlockUserAction = new UnlockUserAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedUnlockUserAction.kind = ListActionKind.fromString(reader.getString()); + } else if ("user".equals(fieldName)) { + deserializedUnlockUserAction.user = reader.getString(); + } else if ("failureReason".equals(fieldName)) { + deserializedUnlockUserAction.failureReason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUnlockUserAction; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Updates.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Updates.java new file mode 100644 index 000000000000..c42f4c632e48 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Updates.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of Updates. + */ +public interface Updates { + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object along with {@link Response}. + */ + Response recommendationWithResponse(String resourceGroupName, String workspaceName, + UUID recommendationId, RecommendationPatch recommendationPatch, Context context); + + /** + * Patch a recommendation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param recommendationId Recommendation Id. + * @param recommendationPatch Recommendation Fields to Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation object. + */ + Recommendation recommendation(String resourceGroupName, String workspaceName, UUID recommendationId, + RecommendationPatch recommendationPatch); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UrlEntity.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UrlEntity.java index c6ea788a480b..b881f5f04692 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UrlEntity.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/UrlEntity.java @@ -9,6 +9,7 @@ import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.EntityInner; import com.azure.resourcemanager.securityinsights.fluent.models.UrlEntityProperties; import java.io.IOException; import java.util.Map; @@ -17,7 +18,7 @@ * Represents a url entity. */ @Immutable -public final class UrlEntity extends Entity { +public final class UrlEntity extends EntityInner { /* * The kind of the entity. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ValidationError.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ValidationError.java new file mode 100644 index 000000000000..663a7da5f18a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/ValidationError.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes an error encountered in the file during validation. + */ +@Fluent +public final class ValidationError implements JsonSerializable { + /* + * The number of the record that has the error. + */ + private Integer recordIndex; + + /* + * A list of descriptions of the error. + */ + private List errorMessages; + + /** + * Creates an instance of ValidationError class. + */ + public ValidationError() { + } + + /** + * Get the recordIndex property: The number of the record that has the error. + * + * @return the recordIndex value. + */ + public Integer recordIndex() { + return this.recordIndex; + } + + /** + * Set the recordIndex property: The number of the record that has the error. + * + * @param recordIndex the recordIndex value to set. + * @return the ValidationError object itself. + */ + public ValidationError withRecordIndex(Integer recordIndex) { + this.recordIndex = recordIndex; + return this; + } + + /** + * Get the errorMessages property: A list of descriptions of the error. + * + * @return the errorMessages value. + */ + public List errorMessages() { + return this.errorMessages; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("recordIndex", this.recordIndex); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ValidationError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ValidationError if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ValidationError. + */ + public static ValidationError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ValidationError deserializedValidationError = new ValidationError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recordIndex".equals(fieldName)) { + deserializedValidationError.recordIndex = reader.getNullable(JsonReader::getInt); + } else if ("errorMessages".equals(fieldName)) { + List errorMessages = reader.readArray(reader1 -> reader1.getString()); + deserializedValidationError.errorMessages = errorMessages; + } else { + reader.skipChildren(); + } + } + + return deserializedValidationError; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Version.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Version.java new file mode 100644 index 000000000000..1bfb647d8510 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Version.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The version of the source control. + */ +public final class Version extends ExpandableStringEnum { + /** + * Static value V1 for Version. + */ + public static final Version V1 = fromString("V1"); + + /** + * Static value V2 for Version. + */ + public static final Version V2 = fromString("V2"); + + /** + * Creates a new instance of Version value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Version() { + } + + /** + * Creates or finds a Version from its string representation. + * + * @param name a name to look for. + * @return the corresponding Version. + */ + public static Version fromString(String name) { + return fromString(name, Version.class); + } + + /** + * Gets known Version values. + * + * @return known Version values. + */ + public static Collection values() { + return values(Version.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Warning.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Warning.java new file mode 100644 index 000000000000..c68d1e5c46bd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Warning.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.resourcemanager.securityinsights.fluent.models.WarningInner; + +/** + * An immutable client-side representation of Warning. + */ +public interface Warning { + /** + * Gets the warning property: Warning data. + * + * @return the warning value. + */ + WarningBody warning(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.WarningInner object. + * + * @return the inner object. + */ + WarningInner innerModel(); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WarningBody.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WarningBody.java new file mode 100644 index 000000000000..29a6686295bf --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WarningBody.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Warning details. + */ +@Immutable +public final class WarningBody implements JsonSerializable { + /* + * An identifier for the warning. Codes are invariant and are intended to be consumed programmatically. + */ + private WarningCode code; + + /* + * A message describing the warning, intended to be suitable for display in a user interface. + */ + private String message; + + /* + * The details property. + */ + private List details; + + /** + * Creates an instance of WarningBody class. + */ + public WarningBody() { + } + + /** + * Get the code property: An identifier for the warning. Codes are invariant and are intended to be consumed + * programmatically. + * + * @return the code value. + */ + public WarningCode code() { + return this.code; + } + + /** + * Get the message property: A message describing the warning, intended to be suitable for display in a user + * interface. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the details property: The details property. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WarningBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WarningBody if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the WarningBody. + */ + public static WarningBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WarningBody deserializedWarningBody = new WarningBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedWarningBody.code = WarningCode.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedWarningBody.message = reader.getString(); + } else if ("details".equals(fieldName)) { + List details = reader.readArray(reader1 -> WarningBody.fromJson(reader1)); + deserializedWarningBody.details = details; + } else { + reader.skipChildren(); + } + } + + return deserializedWarningBody; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WarningCode.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WarningCode.java new file mode 100644 index 000000000000..f7b6af89c347 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WarningCode.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of repository. + */ +public final class WarningCode extends ExpandableStringEnum { + /** + * Static value SourceControlWarning_DeleteServicePrincipal for WarningCode. + */ + public static final WarningCode SOURCE_CONTROL_WARNING_DELETE_SERVICE_PRINCIPAL + = fromString("SourceControlWarning_DeleteServicePrincipal"); + + /** + * Static value SourceControlWarning_DeletePipelineFromAzureDevOps for WarningCode. + */ + public static final WarningCode SOURCE_CONTROL_WARNING_DELETE_PIPELINE_FROM_AZURE_DEV_OPS + = fromString("SourceControlWarning_DeletePipelineFromAzureDevOps"); + + /** + * Static value SourceControlWarning_DeleteWorkflowAndSecretFromGitHub for WarningCode. + */ + public static final WarningCode SOURCE_CONTROL_WARNING_DELETE_WORKFLOW_AND_SECRET_FROM_GIT_HUB + = fromString("SourceControlWarning_DeleteWorkflowAndSecretFromGitHub"); + + /** + * Static value SourceControlWarning_DeleteRoleAssignment for WarningCode. + */ + public static final WarningCode SOURCE_CONTROL_WARNING_DELETE_ROLE_ASSIGNMENT + = fromString("SourceControlWarning_DeleteRoleAssignment"); + + /** + * Static value SourceControl_DeletedWithWarnings for WarningCode. + */ + public static final WarningCode SOURCE_CONTROL_DELETED_WITH_WARNINGS + = fromString("SourceControl_DeletedWithWarnings"); + + /** + * Creates a new instance of WarningCode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WarningCode() { + } + + /** + * Creates or finds a WarningCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding WarningCode. + */ + public static WarningCode fromString(String name) { + return fromString(name, WarningCode.class); + } + + /** + * Gets known WarningCode values. + * + * @return known WarningCode values. + */ + public static Collection values() { + return values(WarningCode.class); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlist.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlist.java index 88127a5662c8..977cb6367ae5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlist.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlist.java @@ -72,11 +72,18 @@ public interface Watchlist { String provider(); /** - * Gets the source property: The source of the watchlist. + * Gets the source property: The filename of the watchlist, called 'source'. * * @return the source value. */ - Source source(); + String source(); + + /** + * Gets the sourceType property: The sourceType of the watchlist. + * + * @return the sourceType value. + */ + SourceType sourceType(); /** * Gets the created property: The time the watchlist was created. @@ -156,17 +163,15 @@ public interface Watchlist { String tenantId(); /** - * Gets the numberOfLinesToSkip property: The number of lines in a csv content to skip before the header. + * Gets the numberOfLinesToSkip property: The number of lines in a csv/tsv content to skip before the header. * * @return the numberOfLinesToSkip value. */ Integer numberOfLinesToSkip(); /** - * Gets the rawContent property: The raw content that represents to watchlist items to create. Example : This line - * will be skipped - * header1,header2 - * value1,value2. + * Gets the rawContent property: The raw content that represents to watchlist items to create. In case of csv/tsv + * content type, it's the content of the file that will parsed by the endpoint. * * @return the rawContent value. */ @@ -182,20 +187,27 @@ public interface Watchlist { String itemsSearchKey(); /** - * Gets the contentType property: The content type of the raw content. For now, only text/csv is valid. + * Gets the contentType property: The content type of the raw content. Example : text/csv or text/tsv. * * @return the contentType value. */ String contentType(); /** - * Gets the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. **Note** : When - * a Watchlist upload status is InProgress, the Watchlist cannot be deleted. + * Gets the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. Pls note : When + * a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. * * @return the uploadStatus value. */ String uploadStatus(); + /** + * Gets the provisioningState property: The triggered analytics rule run provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + /** * Gets the name of the resource group. * @@ -245,14 +257,15 @@ interface WithParentResource { * The stage of the Watchlist definition which contains all the minimum required properties for the resource to * be created, but also allows for any other optional properties to be specified. */ - interface WithCreate - extends DefinitionStages.WithEtag, DefinitionStages.WithWatchlistId, DefinitionStages.WithDisplayName, - DefinitionStages.WithProvider, DefinitionStages.WithSource, DefinitionStages.WithCreated, - DefinitionStages.WithUpdated, DefinitionStages.WithCreatedBy, DefinitionStages.WithUpdatedBy, - DefinitionStages.WithDescription, DefinitionStages.WithWatchlistType, DefinitionStages.WithWatchlistAlias, - DefinitionStages.WithIsDeleted, DefinitionStages.WithLabels, DefinitionStages.WithDefaultDuration, - DefinitionStages.WithTenantId, DefinitionStages.WithNumberOfLinesToSkip, DefinitionStages.WithRawContent, - DefinitionStages.WithItemsSearchKey, DefinitionStages.WithContentType, DefinitionStages.WithUploadStatus { + interface WithCreate extends DefinitionStages.WithEtag, DefinitionStages.WithWatchlistId, + DefinitionStages.WithDisplayName, DefinitionStages.WithProvider, DefinitionStages.WithSource, + DefinitionStages.WithSourceType, DefinitionStages.WithCreated, DefinitionStages.WithUpdated, + DefinitionStages.WithCreatedBy, DefinitionStages.WithUpdatedBy, DefinitionStages.WithDescription, + DefinitionStages.WithWatchlistType, DefinitionStages.WithWatchlistAlias, DefinitionStages.WithIsDeleted, + DefinitionStages.WithLabels, DefinitionStages.WithDefaultDuration, DefinitionStages.WithTenantId, + DefinitionStages.WithNumberOfLinesToSkip, DefinitionStages.WithRawContent, + DefinitionStages.WithItemsSearchKey, DefinitionStages.WithContentType, DefinitionStages.WithUploadStatus, + DefinitionStages.WithProvisioningState { /** * Executes the create request. * @@ -326,12 +339,25 @@ interface WithProvider { */ interface WithSource { /** - * Specifies the source property: The source of the watchlist. + * Specifies the source property: The filename of the watchlist, called 'source'. + * + * @param source The filename of the watchlist, called 'source'. + * @return the next definition stage. + */ + WithCreate withSource(String source); + } + + /** + * The stage of the Watchlist definition allowing to specify sourceType. + */ + interface WithSourceType { + /** + * Specifies the sourceType property: The sourceType of the watchlist. * - * @param source The source of the watchlist. + * @param sourceType The sourceType of the watchlist. * @return the next definition stage. */ - WithCreate withSource(Source source); + WithCreate withSourceType(SourceType sourceType); } /** @@ -483,10 +509,10 @@ interface WithTenantId { */ interface WithNumberOfLinesToSkip { /** - * Specifies the numberOfLinesToSkip property: The number of lines in a csv content to skip before the + * Specifies the numberOfLinesToSkip property: The number of lines in a csv/tsv content to skip before the * header. * - * @param numberOfLinesToSkip The number of lines in a csv content to skip before the header. + * @param numberOfLinesToSkip The number of lines in a csv/tsv content to skip before the header. * @return the next definition stage. */ WithCreate withNumberOfLinesToSkip(Integer numberOfLinesToSkip); @@ -497,15 +523,11 @@ interface WithNumberOfLinesToSkip { */ interface WithRawContent { /** - * Specifies the rawContent property: The raw content that represents to watchlist items to create. Example - * : This line will be skipped - * header1,header2 - * value1,value2. + * Specifies the rawContent property: The raw content that represents to watchlist items to create. In case + * of csv/tsv content type, it's the content of the file that will parsed by the endpoint. * - * @param rawContent The raw content that represents to watchlist items to create. Example : This line will - * be skipped - * header1,header2 - * value1,value2. + * @param rawContent The raw content that represents to watchlist items to create. In case of csv/tsv + * content type, it's the content of the file that will parsed by the endpoint. * @return the next definition stage. */ WithCreate withRawContent(String rawContent); @@ -533,9 +555,9 @@ interface WithItemsSearchKey { */ interface WithContentType { /** - * Specifies the contentType property: The content type of the raw content. For now, only text/csv is valid. + * Specifies the contentType property: The content type of the raw content. Example : text/csv or text/tsv . * - * @param contentType The content type of the raw content. For now, only text/csv is valid. + * @param contentType The content type of the raw content. Example : text/csv or text/tsv. * @return the next definition stage. */ WithCreate withContentType(String contentType); @@ -547,14 +569,27 @@ interface WithContentType { interface WithUploadStatus { /** * Specifies the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. - * **Note** : When a Watchlist upload status is InProgress, the Watchlist cannot be deleted. + * Pls note : When a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. * - * @param uploadStatus The status of the Watchlist upload : New, InProgress or Complete. **Note** : When a - * Watchlist upload status is InProgress, the Watchlist cannot be deleted. + * @param uploadStatus The status of the Watchlist upload : New, InProgress or Complete. Pls note : When a + * Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. * @return the next definition stage. */ WithCreate withUploadStatus(String uploadStatus); } + + /** + * The stage of the Watchlist definition allowing to specify provisioningState. + */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: The triggered analytics rule run provisioning state. + * + * @param provisioningState The triggered analytics rule run provisioning state. + * @return the next definition stage. + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } } /** @@ -568,12 +603,12 @@ interface WithUploadStatus { * The template for Watchlist update. */ interface Update extends UpdateStages.WithEtag, UpdateStages.WithWatchlistId, UpdateStages.WithDisplayName, - UpdateStages.WithProvider, UpdateStages.WithSource, UpdateStages.WithCreated, UpdateStages.WithUpdated, - UpdateStages.WithCreatedBy, UpdateStages.WithUpdatedBy, UpdateStages.WithDescription, + UpdateStages.WithProvider, UpdateStages.WithSource, UpdateStages.WithSourceType, UpdateStages.WithCreated, + UpdateStages.WithUpdated, UpdateStages.WithCreatedBy, UpdateStages.WithUpdatedBy, UpdateStages.WithDescription, UpdateStages.WithWatchlistType, UpdateStages.WithWatchlistAlias, UpdateStages.WithIsDeleted, UpdateStages.WithLabels, UpdateStages.WithDefaultDuration, UpdateStages.WithTenantId, UpdateStages.WithNumberOfLinesToSkip, UpdateStages.WithRawContent, UpdateStages.WithItemsSearchKey, - UpdateStages.WithContentType, UpdateStages.WithUploadStatus { + UpdateStages.WithContentType, UpdateStages.WithUploadStatus, UpdateStages.WithProvisioningState { /** * Executes the update request. * @@ -651,12 +686,25 @@ interface WithProvider { */ interface WithSource { /** - * Specifies the source property: The source of the watchlist. + * Specifies the source property: The filename of the watchlist, called 'source'. + * + * @param source The filename of the watchlist, called 'source'. + * @return the next definition stage. + */ + Update withSource(String source); + } + + /** + * The stage of the Watchlist update allowing to specify sourceType. + */ + interface WithSourceType { + /** + * Specifies the sourceType property: The sourceType of the watchlist. * - * @param source The source of the watchlist. + * @param sourceType The sourceType of the watchlist. * @return the next definition stage. */ - Update withSource(Source source); + Update withSourceType(SourceType sourceType); } /** @@ -808,10 +856,10 @@ interface WithTenantId { */ interface WithNumberOfLinesToSkip { /** - * Specifies the numberOfLinesToSkip property: The number of lines in a csv content to skip before the + * Specifies the numberOfLinesToSkip property: The number of lines in a csv/tsv content to skip before the * header. * - * @param numberOfLinesToSkip The number of lines in a csv content to skip before the header. + * @param numberOfLinesToSkip The number of lines in a csv/tsv content to skip before the header. * @return the next definition stage. */ Update withNumberOfLinesToSkip(Integer numberOfLinesToSkip); @@ -822,15 +870,11 @@ interface WithNumberOfLinesToSkip { */ interface WithRawContent { /** - * Specifies the rawContent property: The raw content that represents to watchlist items to create. Example - * : This line will be skipped - * header1,header2 - * value1,value2. + * Specifies the rawContent property: The raw content that represents to watchlist items to create. In case + * of csv/tsv content type, it's the content of the file that will parsed by the endpoint. * - * @param rawContent The raw content that represents to watchlist items to create. Example : This line will - * be skipped - * header1,header2 - * value1,value2. + * @param rawContent The raw content that represents to watchlist items to create. In case of csv/tsv + * content type, it's the content of the file that will parsed by the endpoint. * @return the next definition stage. */ Update withRawContent(String rawContent); @@ -858,9 +902,9 @@ interface WithItemsSearchKey { */ interface WithContentType { /** - * Specifies the contentType property: The content type of the raw content. For now, only text/csv is valid. + * Specifies the contentType property: The content type of the raw content. Example : text/csv or text/tsv . * - * @param contentType The content type of the raw content. For now, only text/csv is valid. + * @param contentType The content type of the raw content. Example : text/csv or text/tsv. * @return the next definition stage. */ Update withContentType(String contentType); @@ -872,14 +916,27 @@ interface WithContentType { interface WithUploadStatus { /** * Specifies the uploadStatus property: The status of the Watchlist upload : New, InProgress or Complete. - * **Note** : When a Watchlist upload status is InProgress, the Watchlist cannot be deleted. + * Pls note : When a Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. * - * @param uploadStatus The status of the Watchlist upload : New, InProgress or Complete. **Note** : When a - * Watchlist upload status is InProgress, the Watchlist cannot be deleted. + * @param uploadStatus The status of the Watchlist upload : New, InProgress or Complete. Pls note : When a + * Watchlist upload status is equal to InProgress, the Watchlist cannot be deleted. * @return the next definition stage. */ Update withUploadStatus(String uploadStatus); } + + /** + * The stage of the Watchlist update allowing to specify provisioningState. + */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: The triggered analytics rule run provisioning state. + * + * @param provisioningState The triggered analytics rule run provisioning state. + * @return the next definition stage. + */ + Update withProvisioningState(ProvisioningState provisioningState); + } } /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItem.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItem.java index af231efc49c9..070dd4d9d7b8 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItem.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItem.java @@ -158,7 +158,7 @@ interface WithParentResource { * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @return the next definition stage. */ WithCreate withExistingWatchlist(String resourceGroupName, String workspaceName, String watchlistAlias); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItemList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItemList.java index b10c9382e8c2..a82fb1a808c6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItemList.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItemList.java @@ -20,7 +20,7 @@ @Fluent public final class WatchlistItemList implements JsonSerializable { /* - * URL to fetch the next set of watchlist items. + * URL to fetch the next set of watchlist item. */ private String nextLink; @@ -36,7 +36,7 @@ public WatchlistItemList() { } /** - * Get the nextLink property: URL to fetch the next set of watchlist items. + * Get the nextLink property: URL to fetch the next set of watchlist item. * * @return the nextLink value. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItems.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItems.java index e91a9a81e84f..814ad742de3a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItems.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WatchlistItems.java @@ -13,11 +13,11 @@ */ public interface WatchlistItems { /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -26,11 +26,11 @@ public interface WatchlistItems { PagedIterable list(String resourceGroupName, String workspaceName, String watchlistAlias); /** - * Get all watchlist Items. + * Gets all watchlist Items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies * a starting point to use for subsequent calls. Optional. @@ -44,32 +44,32 @@ PagedIterable list(String resourceGroupName, String workspaceName String skipToken, Context context); /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item along with {@link Response}. + * @return a watchlist, without its watchlist items along with {@link Response}. */ Response getWithResponse(String resourceGroupName, String workspaceName, String watchlistAlias, String watchlistItemId, Context context); /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item. + * @return a watchlist, without its watchlist items. */ WatchlistItem get(String resourceGroupName, String workspaceName, String watchlistAlias, String watchlistItemId); @@ -78,8 +78,8 @@ Response getWithResponse(String resourceGroupName, String workspa * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -94,8 +94,8 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param watchlistItemId The watchlist item id (GUID). + * @param watchlistAlias Watchlist Alias. + * @param watchlistItemId Watchlist Item Id (GUID). * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -103,25 +103,25 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName void delete(String resourceGroupName, String workspaceName, String watchlistAlias, String watchlistItemId); /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item along with {@link Response}. + * @return a watchlist, without its watchlist items along with {@link Response}. */ WatchlistItem getById(String id); /** - * Get a watchlist item. + * Gets a watchlist, without its watchlist items. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a watchlist item along with {@link Response}. + * @return a watchlist, without its watchlist items along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlists.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlists.java index 8be909784bad..93a1f84fa05e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlists.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Watchlists.java @@ -13,7 +13,7 @@ */ public interface Watchlists { /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -25,7 +25,7 @@ public interface Watchlists { PagedIterable list(String resourceGroupName, String workspaceName); /** - * Get all watchlists, without watchlist items. + * Gets all watchlists, without watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. @@ -41,11 +41,11 @@ public interface Watchlists { PagedIterable list(String resourceGroupName, String workspaceName, String skipToken, Context context); /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -56,11 +56,11 @@ Response getWithResponse(String resourceGroupName, String workspaceNa Context context); /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -73,30 +73,28 @@ Response getWithResponse(String resourceGroupName, String workspaceNa * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. - * @param context The context to associate with this operation. + * @param watchlistAlias Watchlist Alias. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. */ - Response deleteWithResponse(String resourceGroupName, String workspaceName, String watchlistAlias, - Context context); + void delete(String resourceGroupName, String workspaceName, String watchlistAlias); /** * Delete a watchlist. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param workspaceName The name of the workspace. - * @param watchlistAlias The watchlist alias. + * @param watchlistAlias Watchlist Alias. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void delete(String resourceGroupName, String workspaceName, String watchlistAlias); + void delete(String resourceGroupName, String workspaceName, String watchlistAlias, Context context); /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -107,7 +105,7 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName Watchlist getById(String id); /** - * Get a watchlist, without its watchlist items. + * Gets a watchlist, without its watchlist items. * * @param id the resource ID. * @param context The context to associate with this operation. @@ -136,9 +134,8 @@ Response deleteWithResponse(String resourceGroupName, String workspaceName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. */ - Response deleteByIdWithResponse(String id, Context context); + void deleteByIdWithResponse(String id, Context context); /** * Begins definition for a new Watchlist resource. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Webhook.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Webhook.java new file mode 100644 index 000000000000..ec3f79c058a1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/Webhook.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Detail about the webhook object. + */ +@Fluent +public final class Webhook implements JsonSerializable { + /* + * Unique identifier for the webhook. + */ + private String webhookId; + + /* + * URL that gets invoked by the webhook. + */ + private String webhookUrl; + + /* + * Time when the webhook secret was updated. + */ + private OffsetDateTime webhookSecretUpdateTime; + + /* + * A flag to instruct the backend service to rotate webhook secret. + */ + private Boolean rotateWebhookSecret; + + /** + * Creates an instance of Webhook class. + */ + public Webhook() { + } + + /** + * Get the webhookId property: Unique identifier for the webhook. + * + * @return the webhookId value. + */ + public String webhookId() { + return this.webhookId; + } + + /** + * Get the webhookUrl property: URL that gets invoked by the webhook. + * + * @return the webhookUrl value. + */ + public String webhookUrl() { + return this.webhookUrl; + } + + /** + * Get the webhookSecretUpdateTime property: Time when the webhook secret was updated. + * + * @return the webhookSecretUpdateTime value. + */ + public OffsetDateTime webhookSecretUpdateTime() { + return this.webhookSecretUpdateTime; + } + + /** + * Get the rotateWebhookSecret property: A flag to instruct the backend service to rotate webhook secret. + * + * @return the rotateWebhookSecret value. + */ + public Boolean rotateWebhookSecret() { + return this.rotateWebhookSecret; + } + + /** + * Set the rotateWebhookSecret property: A flag to instruct the backend service to rotate webhook secret. + * + * @param rotateWebhookSecret the rotateWebhookSecret value to set. + * @return the Webhook object itself. + */ + public Webhook withRotateWebhookSecret(Boolean rotateWebhookSecret) { + this.rotateWebhookSecret = rotateWebhookSecret; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("rotateWebhookSecret", this.rotateWebhookSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Webhook from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Webhook if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Webhook. + */ + public static Webhook fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Webhook deserializedWebhook = new Webhook(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("webhookId".equals(fieldName)) { + deserializedWebhook.webhookId = reader.getString(); + } else if ("webhookUrl".equals(fieldName)) { + deserializedWebhook.webhookUrl = reader.getString(); + } else if ("webhookSecretUpdateTime".equals(fieldName)) { + deserializedWebhook.webhookSecretUpdateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("rotateWebhookSecret".equals(fieldName)) { + deserializedWebhook.rotateWebhookSecret = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedWebhook; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignment.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignment.java new file mode 100644 index 000000000000..9c8c821f1f0c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignment.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerAssignmentInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * An immutable client-side representation of WorkspaceManagerAssignment. + */ +public interface WorkspaceManagerAssignment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Resource Etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the targetResourceName property: The resource name of the workspace manager group targeted by the workspace + * manager assignment. + * + * @return the targetResourceName value. + */ + String targetResourceName(); + + /** + * Gets the lastJobEndTime property: The time the last job associated to this assignment ended at. + * + * @return the lastJobEndTime value. + */ + OffsetDateTime lastJobEndTime(); + + /** + * Gets the lastJobProvisioningState property: State of the last job associated to this assignment. + * + * @return the lastJobProvisioningState value. + */ + ProvisioningState lastJobProvisioningState(); + + /** + * Gets the items property: List of resources included in this workspace manager assignment. + * + * @return the items value. + */ + List items(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerAssignmentInner object. + * + * @return the inner object. + */ + WorkspaceManagerAssignmentInner innerModel(); + + /** + * The entirety of the WorkspaceManagerAssignment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The WorkspaceManagerAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the WorkspaceManagerAssignment definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the WorkspaceManagerAssignment definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the WorkspaceManagerAssignment definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTargetResourceName, DefinitionStages.WithItems { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspaceManagerAssignment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspaceManagerAssignment create(Context context); + } + + /** + * The stage of the WorkspaceManagerAssignment definition allowing to specify targetResourceName. + */ + interface WithTargetResourceName { + /** + * Specifies the targetResourceName property: The resource name of the workspace manager group targeted by + * the workspace manager assignment. + * + * @param targetResourceName The resource name of the workspace manager group targeted by the workspace + * manager assignment. + * @return the next definition stage. + */ + WithCreate withTargetResourceName(String targetResourceName); + } + + /** + * The stage of the WorkspaceManagerAssignment definition allowing to specify items. + */ + interface WithItems { + /** + * Specifies the items property: List of resources included in this workspace manager assignment. + * + * @param items List of resources included in this workspace manager assignment. + * @return the next definition stage. + */ + WithCreate withItems(List items); + } + } + + /** + * Begins update for the WorkspaceManagerAssignment resource. + * + * @return the stage of resource update. + */ + WorkspaceManagerAssignment.Update update(); + + /** + * The template for WorkspaceManagerAssignment update. + */ + interface Update extends UpdateStages.WithTargetResourceName, UpdateStages.WithItems { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspaceManagerAssignment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspaceManagerAssignment apply(Context context); + } + + /** + * The WorkspaceManagerAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the WorkspaceManagerAssignment update allowing to specify targetResourceName. + */ + interface WithTargetResourceName { + /** + * Specifies the targetResourceName property: The resource name of the workspace manager group targeted by + * the workspace manager assignment. + * + * @param targetResourceName The resource name of the workspace manager group targeted by the workspace + * manager assignment. + * @return the next definition stage. + */ + Update withTargetResourceName(String targetResourceName); + } + + /** + * The stage of the WorkspaceManagerAssignment update allowing to specify items. + */ + interface WithItems { + /** + * Specifies the items property: List of resources included in this workspace manager assignment. + * + * @param items List of resources included in this workspace manager assignment. + * @return the next definition stage. + */ + Update withItems(List items); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspaceManagerAssignment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspaceManagerAssignment refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignmentJobs.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignmentJobs.java new file mode 100644 index 000000000000..e26abf0b05ef --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignmentJobs.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of WorkspaceManagerAssignmentJobs. + */ +public interface WorkspaceManagerAssignmentJobs { + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName); + + /** + * Get all jobs for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all jobs for the specified workspace manager assignment as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, + String orderby, Integer top, String skipToken, Context context); + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job along with {@link Response}. + */ + Response createWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context); + + /** + * Create a job for the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the assignment job. + */ + Job create(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, + String jobName, Context context); + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + Job get(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, String jobName); + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, String jobName, Context context); + + /** + * Deletes the specified job from the specified workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName, String jobName); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignmentList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignmentList.java new file mode 100644 index 000000000000..97272ed2e742 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignmentList.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerAssignmentInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the workspace manager assignments. + */ +@Fluent +public final class WorkspaceManagerAssignmentList implements JsonSerializable { + /* + * URL to fetch the next set of workspace manager assignments. + */ + private String nextLink; + + /* + * Array of workspace manager assignments. + */ + private List value; + + /** + * Creates an instance of WorkspaceManagerAssignmentList class. + */ + public WorkspaceManagerAssignmentList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of workspace manager assignments. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of workspace manager assignments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of workspace manager assignments. + * + * @param value the value value to set. + * @return the WorkspaceManagerAssignmentList object itself. + */ + public WorkspaceManagerAssignmentList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model WorkspaceManagerAssignmentList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerAssignmentList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerAssignmentList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerAssignmentList if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerAssignmentList. + */ + public static WorkspaceManagerAssignmentList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerAssignmentList deserializedWorkspaceManagerAssignmentList + = new WorkspaceManagerAssignmentList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkspaceManagerAssignmentInner.fromJson(reader1)); + deserializedWorkspaceManagerAssignmentList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspaceManagerAssignmentList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerAssignmentList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignments.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignments.java new file mode 100644 index 000000000000..ebdfe99e716c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerAssignments.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of WorkspaceManagerAssignments. + */ +public interface WorkspaceManagerAssignments { + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager assignments for the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context); + + /** + * Gets a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment. + */ + WorkspaceManagerAssignment get(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName); + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerAssignmentName, Context context); + + /** + * Deletes a workspace manager assignment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerAssignmentName The name of the workspace manager assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String workspaceManagerAssignmentName); + + /** + * Gets a workspace manager assignment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment along with {@link Response}. + */ + WorkspaceManagerAssignment getById(String id); + + /** + * Gets a workspace manager assignment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager assignment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workspace manager assignment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a workspace manager assignment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspaceManagerAssignment resource. + * + * @param name resource name. + * @return the first stage of the new WorkspaceManagerAssignment definition. + */ + WorkspaceManagerAssignment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfiguration.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfiguration.java new file mode 100644 index 000000000000..c516b8c6a4a5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfiguration.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerConfigurationInner; + +/** + * An immutable client-side representation of WorkspaceManagerConfiguration. + */ +public interface WorkspaceManagerConfiguration { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Resource Etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the mode property: The current mode of the workspace manager configuration. + * + * @return the mode value. + */ + Mode mode(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerConfigurationInner + * object. + * + * @return the inner object. + */ + WorkspaceManagerConfigurationInner innerModel(); + + /** + * The entirety of the WorkspaceManagerConfiguration definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The WorkspaceManagerConfiguration definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the WorkspaceManagerConfiguration definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the WorkspaceManagerConfiguration definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the WorkspaceManagerConfiguration definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithMode { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspaceManagerConfiguration create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspaceManagerConfiguration create(Context context); + } + + /** + * The stage of the WorkspaceManagerConfiguration definition allowing to specify mode. + */ + interface WithMode { + /** + * Specifies the mode property: The current mode of the workspace manager configuration. + * + * @param mode The current mode of the workspace manager configuration. + * @return the next definition stage. + */ + WithCreate withMode(Mode mode); + } + } + + /** + * Begins update for the WorkspaceManagerConfiguration resource. + * + * @return the stage of resource update. + */ + WorkspaceManagerConfiguration.Update update(); + + /** + * The template for WorkspaceManagerConfiguration update. + */ + interface Update extends UpdateStages.WithMode { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspaceManagerConfiguration apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspaceManagerConfiguration apply(Context context); + } + + /** + * The WorkspaceManagerConfiguration update stages. + */ + interface UpdateStages { + /** + * The stage of the WorkspaceManagerConfiguration update allowing to specify mode. + */ + interface WithMode { + /** + * Specifies the mode property: The current mode of the workspace manager configuration. + * + * @param mode The current mode of the workspace manager configuration. + * @return the next definition stage. + */ + Update withMode(Mode mode); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspaceManagerConfiguration refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspaceManagerConfiguration refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfigurationList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfigurationList.java new file mode 100644 index 000000000000..a8a1b59f0b3d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfigurationList.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerConfigurationInner; +import java.io.IOException; +import java.util.List; + +/** + * List all the workspace manager configurations for the workspace. + */ +@Fluent +public final class WorkspaceManagerConfigurationList implements JsonSerializable { + /* + * URL to fetch the next set of workspace manager configurations. + */ + private String nextLink; + + /* + * Array of workspace manager configurations. + */ + private List value; + + /** + * Creates an instance of WorkspaceManagerConfigurationList class. + */ + public WorkspaceManagerConfigurationList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of workspace manager configurations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of workspace manager configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of workspace manager configurations. + * + * @param value the value value to set. + * @return the WorkspaceManagerConfigurationList object itself. + */ + public WorkspaceManagerConfigurationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model WorkspaceManagerConfigurationList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerConfigurationList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerConfigurationList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerConfigurationList if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerConfigurationList. + */ + public static WorkspaceManagerConfigurationList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerConfigurationList deserializedWorkspaceManagerConfigurationList + = new WorkspaceManagerConfigurationList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkspaceManagerConfigurationInner.fromJson(reader1)); + deserializedWorkspaceManagerConfigurationList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspaceManagerConfigurationList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerConfigurationList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfigurations.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfigurations.java new file mode 100644 index 000000000000..5a4f36b33d8f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerConfigurations.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of WorkspaceManagerConfigurations. + */ +public interface WorkspaceManagerConfigurations { + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all workspace manager configurations for a Sentinel workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager configurations for a Sentinel workspace as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context); + + /** + * Gets a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration. + */ + WorkspaceManagerConfiguration get(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName); + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerConfigurationName, Context context); + + /** + * Deletes a workspace manager configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerConfigurationName The name of the workspace manager configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String workspaceManagerConfigurationName); + + /** + * Gets a workspace manager configuration. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration along with {@link Response}. + */ + WorkspaceManagerConfiguration getById(String id); + + /** + * Gets a workspace manager configuration. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager configuration along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workspace manager configuration. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a workspace manager configuration. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspaceManagerConfiguration resource. + * + * @param name resource name. + * @return the first stage of the new WorkspaceManagerConfiguration definition. + */ + WorkspaceManagerConfiguration.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroup.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroup.java new file mode 100644 index 000000000000..28d233d46393 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroup.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerGroupInner; +import java.util.List; + +/** + * An immutable client-side representation of WorkspaceManagerGroup. + */ +public interface WorkspaceManagerGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Resource Etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: The description of the workspace manager group. + * + * @return the description value. + */ + String description(); + + /** + * Gets the displayName property: The display name of the workspace manager group. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the memberResourceNames property: The names of the workspace manager members participating in this group. + * + * @return the memberResourceNames value. + */ + List memberResourceNames(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerGroupInner object. + * + * @return the inner object. + */ + WorkspaceManagerGroupInner innerModel(); + + /** + * The entirety of the WorkspaceManagerGroup definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The WorkspaceManagerGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the WorkspaceManagerGroup definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the WorkspaceManagerGroup definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the WorkspaceManagerGroup definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, + DefinitionStages.WithMemberResourceNames { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspaceManagerGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspaceManagerGroup create(Context context); + } + + /** + * The stage of the WorkspaceManagerGroup definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the workspace manager group. + * + * @param description The description of the workspace manager group. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the WorkspaceManagerGroup definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the workspace manager group. + * + * @param displayName The display name of the workspace manager group. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the WorkspaceManagerGroup definition allowing to specify memberResourceNames. + */ + interface WithMemberResourceNames { + /** + * Specifies the memberResourceNames property: The names of the workspace manager members participating in + * this group.. + * + * @param memberResourceNames The names of the workspace manager members participating in this group. + * @return the next definition stage. + */ + WithCreate withMemberResourceNames(List memberResourceNames); + } + } + + /** + * Begins update for the WorkspaceManagerGroup resource. + * + * @return the stage of resource update. + */ + WorkspaceManagerGroup.Update update(); + + /** + * The template for WorkspaceManagerGroup update. + */ + interface Update + extends UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithMemberResourceNames { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspaceManagerGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspaceManagerGroup apply(Context context); + } + + /** + * The WorkspaceManagerGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the WorkspaceManagerGroup update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description of the workspace manager group. + * + * @param description The description of the workspace manager group. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the WorkspaceManagerGroup update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the workspace manager group. + * + * @param displayName The display name of the workspace manager group. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the WorkspaceManagerGroup update allowing to specify memberResourceNames. + */ + interface WithMemberResourceNames { + /** + * Specifies the memberResourceNames property: The names of the workspace manager members participating in + * this group.. + * + * @param memberResourceNames The names of the workspace manager members participating in this group. + * @return the next definition stage. + */ + Update withMemberResourceNames(List memberResourceNames); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspaceManagerGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspaceManagerGroup refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroupList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroupList.java new file mode 100644 index 000000000000..e18e6d69d209 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroupList.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerGroupInner; +import java.io.IOException; +import java.util.List; + +/** + * List of all the workspace manager groups. + */ +@Fluent +public final class WorkspaceManagerGroupList implements JsonSerializable { + /* + * URL to fetch the next set of workspace manager groups. + */ + private String nextLink; + + /* + * Array of workspace manager groups. + */ + private List value; + + /** + * Creates an instance of WorkspaceManagerGroupList class. + */ + public WorkspaceManagerGroupList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of workspace manager groups. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of workspace manager groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of workspace manager groups. + * + * @param value the value value to set. + * @return the WorkspaceManagerGroupList object itself. + */ + public WorkspaceManagerGroupList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property value in model WorkspaceManagerGroupList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerGroupList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerGroupList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerGroupList if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerGroupList. + */ + public static WorkspaceManagerGroupList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerGroupList deserializedWorkspaceManagerGroupList = new WorkspaceManagerGroupList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkspaceManagerGroupInner.fromJson(reader1)); + deserializedWorkspaceManagerGroupList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspaceManagerGroupList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerGroupList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroups.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroups.java new file mode 100644 index 000000000000..c9e710887111 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerGroups.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of WorkspaceManagerGroups. + */ +public interface WorkspaceManagerGroups { + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all workspace manager groups in the Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager groups in the Sentinel workspace manager as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerGroupName, Context context); + + /** + * Gets a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group. + */ + WorkspaceManagerGroup get(String resourceGroupName, String workspaceName, String workspaceManagerGroupName); + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String workspaceManagerGroupName, + Context context); + + /** + * Deletes a workspace manager group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerGroupName The name of the workspace manager group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String workspaceManagerGroupName); + + /** + * Gets a workspace manager group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group along with {@link Response}. + */ + WorkspaceManagerGroup getById(String id); + + /** + * Gets a workspace manager group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workspace manager group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a workspace manager group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspaceManagerGroup resource. + * + * @param name resource name. + * @return the first stage of the new WorkspaceManagerGroup definition. + */ + WorkspaceManagerGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMember.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMember.java new file mode 100644 index 000000000000..8b247712ba40 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMember.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerMemberInner; + +/** + * An immutable client-side representation of WorkspaceManagerMember. + */ +public interface WorkspaceManagerMember { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Resource Etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the targetWorkspaceResourceId property: Fully qualified resource ID of the target Sentinel workspace joining + * the given Sentinel workspace manager. + * + * @return the targetWorkspaceResourceId value. + */ + String targetWorkspaceResourceId(); + + /** + * Gets the targetWorkspaceTenantId property: Tenant id of the target Sentinel workspace joining the given Sentinel + * workspace manager. + * + * @return the targetWorkspaceTenantId value. + */ + String targetWorkspaceTenantId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerMemberInner object. + * + * @return the inner object. + */ + WorkspaceManagerMemberInner innerModel(); + + /** + * The entirety of the WorkspaceManagerMember definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The WorkspaceManagerMember definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the WorkspaceManagerMember definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the WorkspaceManagerMember definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the WorkspaceManagerMember definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTargetWorkspaceResourceId, DefinitionStages.WithTargetWorkspaceTenantId { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspaceManagerMember create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspaceManagerMember create(Context context); + } + + /** + * The stage of the WorkspaceManagerMember definition allowing to specify targetWorkspaceResourceId. + */ + interface WithTargetWorkspaceResourceId { + /** + * Specifies the targetWorkspaceResourceId property: Fully qualified resource ID of the target Sentinel + * workspace joining the given Sentinel workspace manager. + * + * @param targetWorkspaceResourceId Fully qualified resource ID of the target Sentinel workspace joining the + * given Sentinel workspace manager. + * @return the next definition stage. + */ + WithCreate withTargetWorkspaceResourceId(String targetWorkspaceResourceId); + } + + /** + * The stage of the WorkspaceManagerMember definition allowing to specify targetWorkspaceTenantId. + */ + interface WithTargetWorkspaceTenantId { + /** + * Specifies the targetWorkspaceTenantId property: Tenant id of the target Sentinel workspace joining the + * given Sentinel workspace manager. + * + * @param targetWorkspaceTenantId Tenant id of the target Sentinel workspace joining the given Sentinel + * workspace manager. + * @return the next definition stage. + */ + WithCreate withTargetWorkspaceTenantId(String targetWorkspaceTenantId); + } + } + + /** + * Begins update for the WorkspaceManagerMember resource. + * + * @return the stage of resource update. + */ + WorkspaceManagerMember.Update update(); + + /** + * The template for WorkspaceManagerMember update. + */ + interface Update extends UpdateStages.WithTargetWorkspaceResourceId, UpdateStages.WithTargetWorkspaceTenantId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspaceManagerMember apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspaceManagerMember apply(Context context); + } + + /** + * The WorkspaceManagerMember update stages. + */ + interface UpdateStages { + /** + * The stage of the WorkspaceManagerMember update allowing to specify targetWorkspaceResourceId. + */ + interface WithTargetWorkspaceResourceId { + /** + * Specifies the targetWorkspaceResourceId property: Fully qualified resource ID of the target Sentinel + * workspace joining the given Sentinel workspace manager. + * + * @param targetWorkspaceResourceId Fully qualified resource ID of the target Sentinel workspace joining the + * given Sentinel workspace manager. + * @return the next definition stage. + */ + Update withTargetWorkspaceResourceId(String targetWorkspaceResourceId); + } + + /** + * The stage of the WorkspaceManagerMember update allowing to specify targetWorkspaceTenantId. + */ + interface WithTargetWorkspaceTenantId { + /** + * Specifies the targetWorkspaceTenantId property: Tenant id of the target Sentinel workspace joining the + * given Sentinel workspace manager. + * + * @param targetWorkspaceTenantId Tenant id of the target Sentinel workspace joining the given Sentinel + * workspace manager. + * @return the next definition stage. + */ + Update withTargetWorkspaceTenantId(String targetWorkspaceTenantId); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspaceManagerMember refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspaceManagerMember refresh(Context context); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMembers.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMembers.java new file mode 100644 index 000000000000..aee183fe34f9 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMembers.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of WorkspaceManagerMembers. + */ +public interface WorkspaceManagerMembers { + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName); + + /** + * Gets all workspace manager members that exist for the given Sentinel workspace manager. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param orderby Sorts the results. Optional. + * @param top Returns only the first n results. Optional. + * @param skipToken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies + * a starting point to use for subsequent calls. Optional. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all workspace manager members that exist for the given Sentinel workspace manager as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String workspaceName, String orderby, + Integer top, String skipToken, Context context); + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String workspaceManagerMemberName, Context context); + + /** + * Gets a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member. + */ + WorkspaceManagerMember get(String resourceGroupName, String workspaceName, String workspaceManagerMemberName); + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, String workspaceManagerMemberName, + Context context); + + /** + * Deletes a workspace manager member. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspaceManagerMemberName The name of the workspace manager member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String workspaceManagerMemberName); + + /** + * Gets a workspace manager member. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member along with {@link Response}. + */ + WorkspaceManagerMember getById(String id); + + /** + * Gets a workspace manager member. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workspace manager member along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workspace manager member. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a workspace manager member. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspaceManagerMember resource. + * + * @param name resource name. + * @return the first stage of the new WorkspaceManagerMember definition. + */ + WorkspaceManagerMember.DefinitionStages.Blank define(String name); +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMembersList.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMembersList.java new file mode 100644 index 000000000000..2505c0e1a648 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/WorkspaceManagerMembersList.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.securityinsights.fluent.models.WorkspaceManagerMemberInner; +import java.io.IOException; +import java.util.List; + +/** + * List of workspace manager members. + */ +@Fluent +public final class WorkspaceManagerMembersList implements JsonSerializable { + /* + * URL to fetch the next set of workspace manager members + */ + private String nextLink; + + /* + * Array of workspace manager members + */ + private List value; + + /** + * Creates an instance of WorkspaceManagerMembersList class. + */ + public WorkspaceManagerMembersList() { + } + + /** + * Get the nextLink property: URL to fetch the next set of workspace manager members. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: Array of workspace manager members. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of workspace manager members. + * + * @param value the value value to set. + * @return the WorkspaceManagerMembersList object itself. + */ + public WorkspaceManagerMembersList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model WorkspaceManagerMembersList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceManagerMembersList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceManagerMembersList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceManagerMembersList if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceManagerMembersList. + */ + public static WorkspaceManagerMembersList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceManagerMembersList deserializedWorkspaceManagerMembersList = new WorkspaceManagerMembersList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkspaceManagerMemberInner.fromJson(reader1)); + deserializedWorkspaceManagerMembersList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspaceManagerMembersList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceManagerMembersList; + }); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-securityinsights/proxy-config.json b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-securityinsights/proxy-config.json index e40df8530087..bdba07296f8e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-securityinsights/proxy-config.json +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-securityinsights/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.securityinsights.implementation.ActionsClientImpl$ActionsService"],["com.azure.resourcemanager.securityinsights.implementation.AlertRuleTemplatesClientImpl$AlertRuleTemplatesService"],["com.azure.resourcemanager.securityinsights.implementation.AlertRulesClientImpl$AlertRulesService"],["com.azure.resourcemanager.securityinsights.implementation.AutomationRulesClientImpl$AutomationRulesService"],["com.azure.resourcemanager.securityinsights.implementation.BookmarksClientImpl$BookmarksService"],["com.azure.resourcemanager.securityinsights.implementation.DataConnectorsClientImpl$DataConnectorsService"],["com.azure.resourcemanager.securityinsights.implementation.IncidentCommentsClientImpl$IncidentCommentsService"],["com.azure.resourcemanager.securityinsights.implementation.IncidentRelationsClientImpl$IncidentRelationsService"],["com.azure.resourcemanager.securityinsights.implementation.IncidentsClientImpl$IncidentsService"],["com.azure.resourcemanager.securityinsights.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.securityinsights.implementation.SecurityMLAnalyticsSettingsClientImpl$SecurityMLAnalyticsSettingsService"],["com.azure.resourcemanager.securityinsights.implementation.SentinelOnboardingStatesClientImpl$SentinelOnboardingStatesService"],["com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorMetricsClientImpl$ThreatIntelligenceIndicatorMetricsService"],["com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsClientImpl$ThreatIntelligenceIndicatorsService"],["com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsOperationsClientImpl$ThreatIntelligenceIndicatorsOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.WatchlistItemsClientImpl$WatchlistItemsService"],["com.azure.resourcemanager.securityinsights.implementation.WatchlistsClientImpl$WatchlistsService"]] \ No newline at end of file +[["com.azure.resourcemanager.securityinsights.implementation.ActionsClientImpl$ActionsService"],["com.azure.resourcemanager.securityinsights.implementation.AlertRuleOperationsClientImpl$AlertRuleOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.AlertRuleTemplatesClientImpl$AlertRuleTemplatesService"],["com.azure.resourcemanager.securityinsights.implementation.AlertRulesClientImpl$AlertRulesService"],["com.azure.resourcemanager.securityinsights.implementation.AutomationRulesClientImpl$AutomationRulesService"],["com.azure.resourcemanager.securityinsights.implementation.BillingStatisticsClientImpl$BillingStatisticsService"],["com.azure.resourcemanager.securityinsights.implementation.BookmarkOperationsClientImpl$BookmarkOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.BookmarkRelationsClientImpl$BookmarkRelationsService"],["com.azure.resourcemanager.securityinsights.implementation.BookmarksClientImpl$BookmarksService"],["com.azure.resourcemanager.securityinsights.implementation.BusinessApplicationAgentOperationsClientImpl$BusinessApplicationAgentOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.BusinessApplicationAgentsClientImpl$BusinessApplicationAgentsService"],["com.azure.resourcemanager.securityinsights.implementation.ContentPackageOperationsClientImpl$ContentPackageOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.ContentPackagesClientImpl$ContentPackagesService"],["com.azure.resourcemanager.securityinsights.implementation.ContentTemplateOperationsClientImpl$ContentTemplateOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.ContentTemplatesClientImpl$ContentTemplatesService"],["com.azure.resourcemanager.securityinsights.implementation.DataConnectorDefinitionsClientImpl$DataConnectorDefinitionsService"],["com.azure.resourcemanager.securityinsights.implementation.DataConnectorsCheckRequirementsOperationsClientImpl$DataConnectorsCheckRequirementsOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.DataConnectorsClientImpl$DataConnectorsService"],["com.azure.resourcemanager.securityinsights.implementation.EntitiesClientImpl$EntitiesService"],["com.azure.resourcemanager.securityinsights.implementation.EntitiesGetTimelinesClientImpl$EntitiesGetTimelinesService"],["com.azure.resourcemanager.securityinsights.implementation.EntitiesRelationsClientImpl$EntitiesRelationsService"],["com.azure.resourcemanager.securityinsights.implementation.EntityQueriesClientImpl$EntityQueriesService"],["com.azure.resourcemanager.securityinsights.implementation.EntityQueryTemplatesClientImpl$EntityQueryTemplatesService"],["com.azure.resourcemanager.securityinsights.implementation.EntityRelationsClientImpl$EntityRelationsService"],["com.azure.resourcemanager.securityinsights.implementation.FileImportsClientImpl$FileImportsService"],["com.azure.resourcemanager.securityinsights.implementation.GetRecommendationsClientImpl$GetRecommendationsService"],["com.azure.resourcemanager.securityinsights.implementation.GetTriggeredAnalyticsRuleRunsClientImpl$GetTriggeredAnalyticsRuleRunsService"],["com.azure.resourcemanager.securityinsights.implementation.GetsClientImpl$GetsService"],["com.azure.resourcemanager.securityinsights.implementation.HuntCommentsClientImpl$HuntCommentsService"],["com.azure.resourcemanager.securityinsights.implementation.HuntRelationsClientImpl$HuntRelationsService"],["com.azure.resourcemanager.securityinsights.implementation.HuntsClientImpl$HuntsService"],["com.azure.resourcemanager.securityinsights.implementation.IncidentCommentsClientImpl$IncidentCommentsService"],["com.azure.resourcemanager.securityinsights.implementation.IncidentRelationsClientImpl$IncidentRelationsService"],["com.azure.resourcemanager.securityinsights.implementation.IncidentTasksClientImpl$IncidentTasksService"],["com.azure.resourcemanager.securityinsights.implementation.IncidentsClientImpl$IncidentsService"],["com.azure.resourcemanager.securityinsights.implementation.MetadatasClientImpl$MetadatasService"],["com.azure.resourcemanager.securityinsights.implementation.OfficeConsentsClientImpl$OfficeConsentsService"],["com.azure.resourcemanager.securityinsights.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.securityinsights.implementation.ProductPackageOperationsClientImpl$ProductPackageOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.ProductPackagesClientImpl$ProductPackagesService"],["com.azure.resourcemanager.securityinsights.implementation.ProductSettingsClientImpl$ProductSettingsService"],["com.azure.resourcemanager.securityinsights.implementation.ProductTemplateOperationsClientImpl$ProductTemplateOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.ProductTemplatesClientImpl$ProductTemplatesService"],["com.azure.resourcemanager.securityinsights.implementation.ReevaluatesClientImpl$ReevaluatesService"],["com.azure.resourcemanager.securityinsights.implementation.ResourceProvidersClientImpl$ResourceProvidersService"],["com.azure.resourcemanager.securityinsights.implementation.SecurityMLAnalyticsSettingsClientImpl$SecurityMLAnalyticsSettingsService"],["com.azure.resourcemanager.securityinsights.implementation.SentinelOnboardingStatesClientImpl$SentinelOnboardingStatesService"],["com.azure.resourcemanager.securityinsights.implementation.SourceControlsClientImpl$SourceControlsService"],["com.azure.resourcemanager.securityinsights.implementation.SourceControlsOperationsClientImpl$SourceControlsOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.SystemsClientImpl$SystemsService"],["com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorMetricsClientImpl$ThreatIntelligenceIndicatorMetricsService"],["com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsClientImpl$ThreatIntelligenceIndicatorsService"],["com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligenceIndicatorsOperationsClientImpl$ThreatIntelligenceIndicatorsOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.ThreatIntelligencesClientImpl$ThreatIntelligencesService"],["com.azure.resourcemanager.securityinsights.implementation.TriggeredAnalyticsRuleRunOperationsClientImpl$TriggeredAnalyticsRuleRunOperationsService"],["com.azure.resourcemanager.securityinsights.implementation.UpdatesClientImpl$UpdatesService"],["com.azure.resourcemanager.securityinsights.implementation.WatchlistItemsClientImpl$WatchlistItemsService"],["com.azure.resourcemanager.securityinsights.implementation.WatchlistsClientImpl$WatchlistsService"],["com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerAssignmentJobsClientImpl$WorkspaceManagerAssignmentJobsService"],["com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerAssignmentsClientImpl$WorkspaceManagerAssignmentsService"],["com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerConfigurationsClientImpl$WorkspaceManagerConfigurationsService"],["com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerGroupsClientImpl$WorkspaceManagerGroupsService"],["com.azure.resourcemanager.securityinsights.implementation.WorkspaceManagerMembersClientImpl$WorkspaceManagerMembersService"]] \ No newline at end of file diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/resources/azure-resourcemanager-securityinsights.properties b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/resources/azure-resourcemanager-securityinsights.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/resources/azure-resourcemanager-securityinsights.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsCreateOrUpdateSamples.java index fd706a92d74b..f73ab7a97e64 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsCreateOrUpdateSamples.java @@ -10,8 +10,8 @@ public final class ActionsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * CreateActionOfAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/CreateActionOfAlertRule.json */ /** * Sample code: Creates or updates an action of alert rule. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsDeleteSamples.java index e70fa3228b3d..7266657be7cf 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsDeleteSamples.java @@ -10,8 +10,8 @@ public final class ActionsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * DeleteActionOfAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/DeleteActionOfAlertRule.json */ /** * Sample code: Delete an action of alert rule. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsGetSamples.java index ca712c031428..645fe078a7ca 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsGetSamples.java @@ -10,8 +10,8 @@ public final class ActionsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * GetActionOfAlertRuleById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/GetActionOfAlertRuleById.json */ /** * Sample code: Get an action of alert rule. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsListByAlertRuleSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsListByAlertRuleSamples.java index db2e1d02a5b2..96308a99dbfa 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsListByAlertRuleSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ActionsListByAlertRuleSamples.java @@ -10,8 +10,8 @@ public final class ActionsListByAlertRuleSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/actions/ - * GetAllActionsByAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * actions/GetAllActionsByAlertRule.json */ /** * Sample code: Get all actions of alert rule. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleOperationTriggerRuleRunSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleOperationTriggerRuleRunSamples.java new file mode 100644 index 000000000000..dab52221b866 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleOperationTriggerRuleRunSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.AnalyticsRuleRunTrigger; +import java.time.OffsetDateTime; + +/** + * Samples for AlertRuleOperation TriggerRuleRun. + */ +public final class AlertRuleOperationTriggerRuleRunSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * triggeredAnalyticsRuleRuns/triggerRuleRun_Post.json + */ + /** + * Sample code: triggerRuleRun_Post. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void triggerRuleRunPost(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRuleOperations() + .triggerRuleRun("myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", + new AnalyticsRuleRunTrigger().withExecutionTimeUtc(OffsetDateTime.parse("2022-12-22T15:37:03.074Z")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesGetSamples.java index 68568bbbdc44..ef43c713e0ae 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesGetSamples.java @@ -10,7 +10,7 @@ public final class AlertRuleTemplatesGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * alertRuleTemplates/GetAlertRuleTemplateById.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListSamples.java index 48ae592d8eaf..a3cbdc7c4ab9 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListSamples.java @@ -10,7 +10,7 @@ public final class AlertRuleTemplatesListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * alertRuleTemplates/GetAlertRuleTemplates.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesCreateOrUpdateSamples.java index 828baed88798..2ed37fae6e7d 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesCreateOrUpdateSamples.java @@ -6,6 +6,8 @@ import com.azure.resourcemanager.securityinsights.models.AlertDetail; import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; +import com.azure.resourcemanager.securityinsights.models.AlertProperty; +import com.azure.resourcemanager.securityinsights.models.AlertPropertyMapping; import com.azure.resourcemanager.securityinsights.models.AlertSeverity; import com.azure.resourcemanager.securityinsights.models.AttackTactic; import com.azure.resourcemanager.securityinsights.models.EntityMapping; @@ -14,12 +16,18 @@ import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; import com.azure.resourcemanager.securityinsights.models.FieldMapping; import com.azure.resourcemanager.securityinsights.models.FusionAlertRule; +import com.azure.resourcemanager.securityinsights.models.FusionSourceSettings; +import com.azure.resourcemanager.securityinsights.models.FusionSourceSubTypeSetting; +import com.azure.resourcemanager.securityinsights.models.FusionSubTypeSeverityFilter; +import com.azure.resourcemanager.securityinsights.models.FusionSubTypeSeverityFiltersItem; import com.azure.resourcemanager.securityinsights.models.GroupingConfiguration; import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; import com.azure.resourcemanager.securityinsights.models.MatchingMethod; import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRule; import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; +import com.azure.resourcemanager.securityinsights.models.NrtAlertRule; import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRule; +import com.azure.resourcemanager.securityinsights.models.SentinelEntityMapping; import com.azure.resourcemanager.securityinsights.models.TriggerOperator; import java.time.Duration; import java.util.Arrays; @@ -32,8 +40,8 @@ public final class AlertRulesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * CreateFusionAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateFusionAlertRule.json */ /** * Sample code: Creates or updates a Fusion alert rule. @@ -46,14 +54,123 @@ public final class AlertRulesCreateOrUpdateSamples { .createOrUpdateWithResponse("myRg", "myWorkspace", "myFirstFusionRule", new FusionAlertRule().withEtag("3d00c3ca-0000-0100-0000-5d42d5010000") .withAlertRuleTemplateName("f71aba3d-28fb-450b-b192-4e76a83015c8") - .withEnabled(true), + .withEnabled(true) + .withSourceSettings(Arrays.asList( + new FusionSourceSettings().withEnabled(true).withSourceName("Anomalies"), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Alert providers") + .withSourceSubTypes(Arrays.asList( + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Active Directory Identity Protection") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender for IoT") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft 365 Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Cloud App Security") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Endpoint") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Identity") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Office 365") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Sentinel scheduled analytics rules") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))))), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Raw logs from other sources") + .withSourceSubTypes(Arrays.asList(new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Palo Alto Networks") + .withSeverityFilters(new FusionSubTypeSeverityFilter()))))), com.azure.core.util.Context.NONE); } /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * CreateMicrosoftSecurityIncidentCreationAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateMicrosoftSecurityIncidentCreationAlertRule.json */ /** * Sample code: Creates or updates a MicrosoftSecurityIncidentCreation rule. @@ -73,8 +190,8 @@ public static void createsOrUpdatesAMicrosoftSecurityIncidentCreationRule( /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * CreateScheduledAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateScheduledAlertRule.json */ /** * Sample code: Creates or updates a Scheduled alert rule. @@ -92,6 +209,7 @@ public static void createsOrUpdatesAScheduledAlertRule( .withSuppressionDuration(Duration.parse("PT1H")) .withSuppressionEnabled(false) .withTactics(Arrays.asList(AttackTactic.PERSISTENCE, AttackTactic.LATERAL_MOVEMENT)) + .withTechniques(Arrays.asList("T1037", "T1021")) .withIncidentConfiguration(new IncidentConfiguration().withCreateIncident(true) .withGroupingConfiguration(new GroupingConfiguration().withEnabled(true) .withReopenClosedIncident(false) @@ -116,9 +234,182 @@ public static void createsOrUpdatesAScheduledAlertRule( new EntityMapping().withEntityType(EntityMappingType.IP) .withFieldMappings(Arrays .asList(new FieldMapping().withIdentifier("Address").withColumnName("ComputerIP"))))) - .withAlertDetailsOverride( - new AlertDetailsOverride().withAlertDisplayNameFormat("Alert from {{Computer}}") - .withAlertDescriptionFormat("Suspicious activity was made by {{ComputerIP}}")), + .withAlertDetailsOverride(new AlertDetailsOverride() + .withAlertDisplayNameFormat("Alert from {{Computer}}") + .withAlertDescriptionFormat("Suspicious activity was made by {{ComputerIP}}") + .withAlertDynamicProperties(Arrays.asList( + new AlertPropertyMapping().withAlertProperty(AlertProperty.PRODUCT_COMPONENT_NAME) + .withValue("ProductComponentNameCustomColumn"), + new AlertPropertyMapping().withAlertProperty(AlertProperty.PRODUCT_NAME) + .withValue("ProductNameCustomColumn"), + new AlertPropertyMapping().withAlertProperty(AlertProperty.ALERT_LINK).withValue("Link")))) + .withSentinelEntitiesMappings( + Arrays.asList(new SentinelEntityMapping().withColumnName("Entities"))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateFusionAlertRuleWithFusionScenarioExclusion.json + */ + /** + * Sample code: Creates or updates a Fusion alert rule with scenario exclusion pattern. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAFusionAlertRuleWithScenarioExclusionPattern( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .createOrUpdateWithResponse("myRg", "myWorkspace", "myFirstFusionRule", + new FusionAlertRule().withEtag("3d00c3ca-0000-0100-0000-5d42d5010000") + .withAlertRuleTemplateName("f71aba3d-28fb-450b-b192-4e76a83015c8") + .withEnabled(true) + .withSourceSettings(Arrays.asList( + new FusionSourceSettings().withEnabled(true).withSourceName("Anomalies"), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Alert providers") + .withSourceSubTypes(Arrays.asList( + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Active Directory Identity Protection") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Defender for IoT") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft 365 Defender") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Cloud App Security") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Endpoint") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Identity") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Microsoft Defender for Office 365") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))), + new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Azure Sentinel scheduled analytics rules") + .withSeverityFilters(new FusionSubTypeSeverityFilter().withFilters(Arrays.asList( + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.HIGH) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.MEDIUM) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.LOW) + .withEnabled(true), + new FusionSubTypeSeverityFiltersItem().withSeverity(AlertSeverity.INFORMATIONAL) + .withEnabled(true)))))), + new FusionSourceSettings().withEnabled(true) + .withSourceName("Raw logs from other sources") + .withSourceSubTypes(Arrays.asList(new FusionSourceSubTypeSetting().withEnabled(true) + .withSourceSubTypeName("Palo Alto Networks") + .withSeverityFilters(new FusionSubTypeSeverityFilter()))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/CreateNrtAlertRule.json + */ + /** + * Sample code: Creates or updates a Nrt alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesANrtAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new NrtAlertRule().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDescription("") + .withQuery( + "ProtectionStatus | extend HostCustomEntity = Computer | extend IPCustomEntity = ComputerIP_Hidden") + .withTactics(Arrays.asList(AttackTactic.PERSISTENCE, AttackTactic.LATERAL_MOVEMENT)) + .withTechniques(Arrays.asList("T1037", "T1021")) + .withDisplayName("Rule2") + .withEnabled(true) + .withSuppressionDuration(Duration.parse("PT1H")) + .withSuppressionEnabled(false) + .withSeverity(AlertSeverity.HIGH) + .withIncidentConfiguration(new IncidentConfiguration().withCreateIncident(true) + .withGroupingConfiguration(new GroupingConfiguration().withEnabled(true) + .withReopenClosedIncident(false) + .withLookbackDuration(Duration.parse("PT5H")) + .withMatchingMethod(MatchingMethod.SELECTED) + .withGroupByEntities(Arrays.asList(EntityMappingType.HOST, EntityMappingType.ACCOUNT)))) + .withEventGroupingSettings( + new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.ALERT_PER_RESULT)), com.azure.core.util.Context.NONE); } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesDeleteSamples.java index 908680c73e21..bbff926a0b49 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesDeleteSamples.java @@ -10,8 +10,8 @@ public final class AlertRulesDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * DeleteAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/DeleteAlertRule.json */ /** * Sample code: Delete an alert rule. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesGetSamples.java index e5d45b989808..9e58e26c56a0 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesGetSamples.java @@ -10,8 +10,8 @@ public final class AlertRulesGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetScheduledAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetScheduledAlertRule.json */ /** * Sample code: Get a Scheduled alert rule. @@ -27,8 +27,24 @@ public final class AlertRulesGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetFusionAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetNrtAlertRule.json + */ + /** + * Sample code: Get an Nrt alert rule. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnNrtAlertRule(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.alertRules() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetFusionAlertRule.json */ /** * Sample code: Get a Fusion alert rule. @@ -42,8 +58,8 @@ public static void getAFusionAlertRule(com.azure.resourcemanager.securityinsight /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetMicrosoftSecurityIncidentCreationAlertRule.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetMicrosoftSecurityIncidentCreationAlertRule.json */ /** * Sample code: Get a MicrosoftSecurityIncidentCreation rule. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListSamples.java index 3c4b8ec5faea..2ba021243451 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListSamples.java @@ -10,8 +10,8 @@ public final class AlertRulesListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/alertRules/ - * GetAllAlertRules.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * alertRules/GetAllAlertRules.json */ /** * Sample code: Get all alert rules. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesCreateOrUpdateSamples.java index 81452ad72363..61e8b8b3a7b6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesCreateOrUpdateSamples.java @@ -14,7 +14,7 @@ public final class AutomationRulesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * automationRules/AutomationRules_CreateOrUpdate.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesDeleteSamples.java index 4bb2caff7701..9cceb063f15c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesDeleteSamples.java @@ -10,7 +10,7 @@ public final class AutomationRulesDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * automationRules/AutomationRules_Delete.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesGetSamples.java index c2a4c35bbef2..6f33bd527b18 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesGetSamples.java @@ -10,7 +10,7 @@ public final class AutomationRulesGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * automationRules/AutomationRules_Get.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListSamples.java index 350525fdb8b4..e8cbfa62198a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListSamples.java @@ -10,7 +10,7 @@ public final class AutomationRulesListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * automationRules/AutomationRules_List.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BillingStatisticsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BillingStatisticsGetSamples.java new file mode 100644 index 000000000000..6d0217843e6f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BillingStatisticsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BillingStatistics Get. + */ +public final class BillingStatisticsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * billingStatistics/GetBillingStatistic.json + */ + /** + * Sample code: Get a billing statistic. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getABillingStatistic(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.billingStatistics() + .getWithResponse("myRg", "myWorkspace", "sapSolutionUsage", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BillingStatisticsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BillingStatisticsListSamples.java new file mode 100644 index 000000000000..d12d3f6e2f58 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BillingStatisticsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BillingStatistics List. + */ +public final class BillingStatisticsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * billingStatistics/GetAllBillingStatistics.json + */ + /** + * Sample code: Get all Microsoft Sentinel billing statistics. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllMicrosoftSentinelBillingStatistics( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.billingStatistics().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkOperationExpandSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkOperationExpandSamples.java new file mode 100644 index 000000000000..7d476dbdf2e3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkOperationExpandSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.BookmarkExpandParameters; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** + * Samples for BookmarkOperation Expand. + */ +public final class BookmarkOperationExpandSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/expand/PostExpandBookmark.json + */ + /** + * Sample code: Expand an bookmark. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void expandAnBookmark(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkOperations() + .expandWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new BookmarkExpandParameters().withEndTime(OffsetDateTime.parse("2020-01-24T17:21:00.000Z")) + .withExpansionId(UUID.fromString("27f76e63-c41b-480f-bb18-12ad2e011d49")) + .withStartTime(OffsetDateTime.parse("2019-12-25T17:21:00.000Z")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..df65950b7846 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BookmarkRelations CreateOrUpdate. + */ +public final class BookmarkRelationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/CreateBookmarkRelation.json + */ + /** + * Sample code: Creates or updates a bookmark relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesABookmarkRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") + .withExistingBookmark("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096") + .withRelatedResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsDeleteSamples.java new file mode 100644 index 000000000000..b067a583e324 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BookmarkRelations Delete. + */ +public final class BookmarkRelationsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/DeleteBookmarkRelation.json + */ + /** + * Sample code: Delete the bookmark relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteTheBookmarkRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .deleteWithResponse("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsGetSamples.java new file mode 100644 index 000000000000..cfc7461f3350 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BookmarkRelations Get. + */ +public final class BookmarkRelationsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/GetBookmarkRelationByName.json + */ + /** + * Sample code: Get a bookmark relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getABookmarkRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .getWithResponse("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsListSamples.java new file mode 100644 index 000000000000..e68feccbd34b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarkRelationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BookmarkRelations List. + */ +public final class BookmarkRelationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/relations/GetAllBookmarkRelations.json + */ + /** + * Sample code: Get all bookmark relations. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllBookmarkRelations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.bookmarkRelations() + .list("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", null, null, null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksCreateOrUpdateSamples.java index 07494d304755..a6e753c9c833 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksCreateOrUpdateSamples.java @@ -4,6 +4,9 @@ package com.azure.resourcemanager.securityinsights.generated; +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.BookmarkEntityMappings; +import com.azure.resourcemanager.securityinsights.models.EntityFieldMapping; import com.azure.resourcemanager.securityinsights.models.UserInfo; import java.time.OffsetDateTime; import java.util.Arrays; @@ -15,8 +18,8 @@ public final class BookmarksCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * CreateBookmark.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/CreateBookmark.json */ /** * Sample code: Creates or updates a bookmark. @@ -29,15 +32,20 @@ public final class BookmarksCreateOrUpdateSamples { .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") .withExistingWorkspace("myRg", "myWorkspace") .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withCreated(OffsetDateTime.parse("2019-01-01T13:15:30Z")) + .withCreated(OffsetDateTime.parse("2021-09-01T13:15:30Z")) .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) .withDisplayName("My bookmark") .withLabels(Arrays.asList("Tag1", "Tag2")) .withNotes("Found a suspicious activity") .withQuery("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)") .withQueryResult("Security Event query result") - .withUpdated(OffsetDateTime.parse("2019-01-01T13:15:30Z")) + .withUpdated(OffsetDateTime.parse("2021-09-01T13:15:30Z")) .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) + .withEntityMappings(Arrays.asList(new BookmarkEntityMappings().withEntityType("Account") + .withFieldMappings(Arrays + .asList(new EntityFieldMapping().withIdentifier("Fullname").withValue("johndoe@microsoft.com"))))) + .withTactics(Arrays.asList(AttackTactic.EXECUTION)) + .withTechniques(Arrays.asList("T1609")) .create(); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksDeleteSamples.java index 106c4df6e57f..5cac754d7fc5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksDeleteSamples.java @@ -10,8 +10,8 @@ public final class BookmarksDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * DeleteBookmark.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/DeleteBookmark.json */ /** * Sample code: Delete a bookmark. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksGetSamples.java index c978501d0371..037770ea4f42 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksGetSamples.java @@ -10,8 +10,8 @@ public final class BookmarksGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * GetBookmarkById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/GetBookmarkById.json */ /** * Sample code: Get a bookmark. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksListSamples.java index 44ad5c604c26..ce92c648c4f6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BookmarksListSamples.java @@ -10,8 +10,8 @@ public final class BookmarksListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/bookmarks/ - * GetBookmarks.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * bookmarks/GetBookmarks.json */ /** * Sample code: Get all bookmarks. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentOperationGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentOperationGetSamples.java new file mode 100644 index 000000000000..4d3ecf35244c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentOperationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BusinessApplicationAgentOperation Get. + */ +public final class BusinessApplicationAgentOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgent_Get.json + */ + /** + * Sample code: BusinessApplicationAgent_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + businessApplicationAgentGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgentOperations() + .getWithResponse("myRg", "myWorkspace", "3d69632b-0b60-4af3-8720-77f01a25d34a", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..2e1d7588c508 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.AgentConfiguration; + +/** + * Samples for BusinessApplicationAgents CreateOrUpdate. + */ +public final class BusinessApplicationAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgents_CreateOrUpdate.json + */ + /** + * Sample code: BusinessApplicationAgents_CreateOrUpdate. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void businessApplicationAgentsCreateOrUpdate( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgents() + .define("3d69632b-0b60-4af3-8720-77f01a25d34a") + .withExistingWorkspace("myRg", "myWorkspace") + .withConfiguration((AgentConfiguration) null) + .withDisplayName((String) null) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsDeleteSamples.java new file mode 100644 index 000000000000..c2e58350be0f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BusinessApplicationAgents Delete. + */ +public final class BusinessApplicationAgentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgents_Delete.json + */ + /** + * Sample code: BusinessApplicationAgents_Delete. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + businessApplicationAgentsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgents() + .deleteWithResponse("myRg", "myWorkspace", "3d69632b-0b60-4af3-8720-77f01a25d34a", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsListSamples.java new file mode 100644 index 000000000000..08f3059fb384 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/BusinessApplicationAgentsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for BusinessApplicationAgents List. + */ +public final class BusinessApplicationAgentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/BusinessApplicationAgents_List.json + */ + /** + * Sample code: BusinessApplicationAgents_List. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + businessApplicationAgentsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.businessApplicationAgents().list("myRg", "myWorkspace", null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackageOperationInstallSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackageOperationInstallSamples.java new file mode 100644 index 000000000000..eb565a592f71 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackageOperationInstallSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.PackageKind; + +/** + * Samples for ContentPackageOperation Install. + */ +public final class ContentPackageOperationInstallSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/InstallPackage.json + */ + /** + * Sample code: Install a package to the workspace. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + installAPackageToTheWorkspace(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackageOperations() + .define("str.azure-sentinel-solution-str") + .withExistingWorkspace("myRg", "myWorkspace") + .withContentId("str.azure-sentinel-solution-str") + .withContentProductId("str.azure-sentinel-solution-str-sl-igl6jawr4gwmu") + .withContentKind(PackageKind.SOLUTION) + .withVersion("2.0.0") + .withDisplayName("str") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackageOperationUninstallSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackageOperationUninstallSamples.java new file mode 100644 index 000000000000..9933618b5840 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackageOperationUninstallSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ContentPackageOperation Uninstall. + */ +public final class ContentPackageOperationUninstallSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/UninstallPackage.json + */ + /** + * Sample code: Uninstall a package from the workspace. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + uninstallAPackageFromTheWorkspace(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackageOperations() + .uninstallWithResponse("myRg", "myWorkspace", "str.azure-sentinel-solution-str", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackagesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackagesGetSamples.java new file mode 100644 index 000000000000..0aa3817b6f84 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackagesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ContentPackages Get. + */ +public final class ContentPackagesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetPackageById.json + */ + /** + * Sample code: Get installed packages by id. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getInstalledPackagesById(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackages() + .getWithResponse("myRg", "myWorkspace", "str.azure-sentinel-solution-str", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackagesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackagesListSamples.java new file mode 100644 index 000000000000..caa49a6c99b1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentPackagesListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ContentPackages List. + */ +public final class ContentPackagesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetPackages.json + */ + /** + * Sample code: Get all available packages. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllAvailablePackages(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentPackages() + .list("myRg", "myWorkspace", null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationDeleteSamples.java new file mode 100644 index 000000000000..035615586c21 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ContentTemplateOperation Delete. + */ +public final class ContentTemplateOperationDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/DeleteTemplate.json + */ + /** + * Sample code: Delete metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentTemplateOperations() + .deleteWithResponse("myRg", "myWorkspace", "8365ebfe-a381-45b7-ad08-7d818070e11f", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationGetSamples.java new file mode 100644 index 000000000000..a4cf6eb153b2 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ContentTemplateOperation Get. + */ +public final class ContentTemplateOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetTemplateById.json + */ + /** + * Sample code: Get a template. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getATemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentTemplateOperations() + .getWithResponse("myRg", "myWorkspace", "8365ebfe-a381-45b7-ad08-7d818070e11f", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationInstallSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationInstallSamples.java new file mode 100644 index 000000000000..6510866d12cd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplateOperationInstallSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.PackageKind; +import com.azure.resourcemanager.securityinsights.models.SourceKind; +import com.azure.resourcemanager.securityinsights.models.SupportTier; +import java.io.IOException; + +/** + * Samples for ContentTemplateOperation Install. + */ +public final class ContentTemplateOperationInstallSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/InstallTemplate.json + */ + /** + * Sample code: Get a template. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getATemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) + throws IOException { + manager.contentTemplateOperations() + .define("str.azure-sentinel-solution-str") + .withExistingWorkspace("myRg", "myWorkspace") + .withMainTemplate(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"$schema\":\"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\"contentVersion\":\"1.0.1\",\"resources\":[{\"name\":\"8365ebfe-a381-45b7-ad08-7d818070e11f\",\"type\":\"Microsoft.SecurityInsights/AlertRuleTemplates\",\"apiVersion\":\"2022-04-01-preview\",\"kind\":\"Scheduled\",\"location\":\"[parameters('workspace-location')]\",\"properties\":{\"description\":\"Creates an incident when a large number of Critical/High severity CrowdStrike Falcon sensor detections is triggered by a single user\",\"displayName\":\"Critical or High Severity Detections by User\",\"enabled\":false,\"query\":\"...\",\"queryFrequency\":\"PT1H\",\"queryPeriod\":\"PT1H\",\"severity\":\"High\",\"status\":\"Available\",\"suppressionDuration\":\"PT1H\",\"suppressionEnabled\":false,\"triggerOperator\":\"GreaterThan\",\"triggerThreshold\":0}},{\"name\":\"[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split([resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', 8365ebfe-a381-45b7-ad08-7d818070e11f)],'/'))))]\",\"type\":\"Microsoft.OperationalInsights/workspaces/providers/metadata\",\"apiVersion\":\"2022-01-01-preview\",\"properties\":{\"description\":\"CrowdStrike Falcon Endpoint Protection Analytics Rule 1\",\"author\":{\"name\":\"Microsoft\",\"email\":\"support@microsoft.com\"},\"contentId\":\"4465ebde-b381-45f7-ad08-7d818070a11c\",\"kind\":\"AnalyticsRule\",\"parentId\":\"[resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', 8365ebfe-a381-45b7-ad08-7d818070e11f)]\",\"source\":{\"name\":\"str\",\"kind\":\"Solution\",\"sourceId\":\"str.azure-sentinel-solution-str\"},\"support\":{\"name\":\"Microsoft Corporation\",\"email\":\"support@microsoft.com\",\"link\":\"https://support.microsoft.com/\",\"tier\":\"Microsoft\"},\"version\":\"1.0.0\"}}]}", + Object.class, SerializerEncoding.JSON)) + .withContentId("8365ebfe-a381-45b7-ad08-7d818070e11f") + .withContentProductId("str.azure-sentinel-solution-str-ar-cbfe4fndz66bi") + .withPackageVersion("1.0.0") + .withVersion("1.0.1") + .withDisplayName("API Protection workbook template") + .withContentKind(Kind.ANALYTICS_RULE) + .withSource(new MetadataSource().withKind(SourceKind.SOLUTION) + .withName("str") + .withSourceId("str.azure-sentinel-solution-str")) + .withAuthor(new MetadataAuthor().withName("Microsoft").withEmail("support@microsoft.com")) + .withSupport(new MetadataSupport().withTier(SupportTier.MICROSOFT) + .withName("Microsoft Corporation") + .withEmail("support@microsoft.com") + .withLink("https://support.microsoft.com/")) + .withPackageId("str.azure-sentinel-solution-str") + .withPackageKind(PackageKind.SOLUTION) + .withPackageName("str") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplatesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplatesListSamples.java new file mode 100644 index 000000000000..a87b4afc7d08 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ContentTemplatesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ContentTemplates List. + */ +public final class ContentTemplatesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetTemplates.json + */ + /** + * Sample code: Get all installed templates. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllInstalledTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.contentTemplates() + .list("myRg", "myWorkspace", null, null, null, null, null, null, null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a7b58d0b2542 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsCreateOrUpdateSamples.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.ConnectivityCriterion; +import com.azure.resourcemanager.securityinsights.models.ConnectorDataType; +import com.azure.resourcemanager.securityinsights.models.ConnectorDefinitionsAvailability; +import com.azure.resourcemanager.securityinsights.models.ConnectorDefinitionsPermissions; +import com.azure.resourcemanager.securityinsights.models.ConnectorDefinitionsResourceProvider; +import com.azure.resourcemanager.securityinsights.models.CustomPermissionDetails; +import com.azure.resourcemanager.securityinsights.models.CustomizableConnectorDefinition; +import com.azure.resourcemanager.securityinsights.models.CustomizableConnectorUiConfig; +import com.azure.resourcemanager.securityinsights.models.GraphQuery; +import com.azure.resourcemanager.securityinsights.models.InstructionStep; +import com.azure.resourcemanager.securityinsights.models.InstructionStepDetails; +import com.azure.resourcemanager.securityinsights.models.ProviderPermissionsScope; +import com.azure.resourcemanager.securityinsights.models.ResourceProviderRequiredPermissions; +import java.io.IOException; +import java.util.Arrays; + +/** + * Samples for DataConnectorDefinitions CreateOrUpdate. + */ +public final class DataConnectorDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/CreateCustomizableDataConnectorDefinition.json + */ + /** + * Sample code: Create data connector definition. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createDataConnectorDefinition( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectorDefinitions() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new CustomizableConnectorDefinition().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withConnectorUiConfig(new CustomizableConnectorUiConfig().withTitle("GitHub Enterprise Audit Log") + .withPublisher("GitHub") + .withDescriptionMarkdown( + "The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process.") + .withGraphQueries(Arrays.asList(new GraphQuery().withMetricName("Total events received") + .withLegend("GitHub audit log events") + .withBaseQuery("GitHubAuditLogPolling_CL"))) + .withDataTypes(Arrays.asList(new ConnectorDataType().withName("GitHubAuditLogPolling_CL") + .withLastDataReceivedQuery( + "GitHubAuditLogPolling_CL \n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"))) + .withConnectivityCriteria(Arrays.asList(new ConnectivityCriterion().withType("IsConnectedQuery") + .withValue(Arrays.asList( + "GitHubAuditLogPolling_CL \n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)")))) + .withAvailability(new ConnectorDefinitionsAvailability().withStatus(1).withIsPreview(false)) + .withPermissions(new ConnectorDefinitionsPermissions() + .withResourceProvider(Arrays.asList(new ConnectorDefinitionsResourceProvider() + .withProvider("Microsoft.OperationalInsights/workspaces") + .withPermissionsDisplayText("read and write permissions are required.") + .withProviderDisplayName("Workspace") + .withScope(ProviderPermissionsScope.WORKSPACE) + .withRequiredPermissions(new ResourceProviderRequiredPermissions().withRead(false) + .withWrite(true) + .withDelete(false) + .withAction(false)))) + .withCustoms(Arrays.asList(new CustomPermissionDetails() + .withName("GitHub API personal token Key") + .withDescription( + "You need access to GitHub personal token, the key should have 'admin:org' scope")))) + .withInstructionSteps(Arrays.asList(new InstructionStep() + .withTitle("Connect GitHub Enterprise Audit Log to Azure Sentinel") + .withDescription( + "Enable GitHub audit Logs. \n Follow [this](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create or find your personal key") + .withInstructions(Arrays.asList(new InstructionStepDetails() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"clientIdLabel\":\"Client ID\",\"clientSecretLabel\":\"Client Secret\",\"connectButtonLabel\":\"Connect\",\"disconnectButtonLabel\":\"Disconnect\"}", + Object.class, SerializerEncoding.JSON)) + .withType("OAuthForm")))))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsDeleteSamples.java new file mode 100644 index 000000000000..313848bbf162 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for DataConnectorDefinitions Delete. + */ +public final class DataConnectorDefinitionsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/DeleteDataConnectorDefinitionById.json + */ + /** + * Sample code: Delete data connector definition. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteDataConnectorDefinition(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorDefinitions() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsGetSamples.java new file mode 100644 index 000000000000..e252964930d7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for DataConnectorDefinitions Get. + */ +public final class DataConnectorDefinitionsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/GetCustomizableDataConnectorDefinitionById.json + */ + /** + * Sample code: Get customize data connector definition. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getCustomizeDataConnectorDefinition( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorDefinitions() + .getWithResponse("myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsListSamples.java new file mode 100644 index 000000000000..e1daa145cb71 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDefinitionsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for DataConnectorDefinitions List. + */ +public final class DataConnectorDefinitionsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectorDefinitions/GetDataConnectorDefinitions.json + */ + /** + * Sample code: Get all data connector definitions. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllDataConnectorDefinitions(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorDefinitions().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCheckRequirementsOperationPostSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCheckRequirementsOperationPostSamples.java new file mode 100644 index 000000000000..183da57db991 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCheckRequirementsOperationPostSamples.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.AadCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.AscCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.Dynamics365CheckRequirements; +import com.azure.resourcemanager.securityinsights.models.IoTCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.McasCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.MstiCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.MtpCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.OfficeAtpCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.OfficeIrmCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBICheckRequirements; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditCheckRequirements; +import com.azure.resourcemanager.securityinsights.models.TICheckRequirements; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiCheckRequirements; + +/** + * Samples for DataConnectorsCheckRequirementsOperation Post. + */ +public final class DataConnectorsCheckRequirementsOperationPostSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOfficeATP.json + */ + /** + * Sample code: Check requirements for OfficeATP. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForOfficeATP(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new OfficeAtpCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOffice365Project.json + */ + /** + * Sample code: Check requirements for Office365Project. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForOffice365Project( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new Office365ProjectCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureActiveDirectoryNoAuthorization.json + */ + /** + * Sample code: Check requirements for AADIP (Azure Active Directory Identity Protection) - no authorization. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForAADIPAzureActiveDirectoryIdentityProtectionNoAuthorization( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AadCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftCloudAppSecurity.json + */ + /** + * Sample code: Check requirements for Mcas. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForMcas(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new McasCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsIoT.json + */ + /** + * Sample code: Check requirements for IoT. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForIoT(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new IoTCheckRequirements().withSubscriptionId("c0688291-89d7-4bed-87a2-a7b1bff43f4c"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMdatp.json + */ + /** + * Sample code: Check requirements for Mdatp. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForMdatp(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new McasCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureSecurityCenter.json + */ + /** + * Sample code: Check requirements for ASC. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForASC(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AscCheckRequirements().withSubscriptionId("c0688291-89d7-4bed-87a2-a7b1bff43f4c"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftPurviewInformationProtection.json + */ + /** + * Sample code: Check requirements for MicrosoftPurviewInformationProtection. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForMicrosoftPurviewInformationProtection( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", new MicrosoftPurviewInformationProtectionCheckRequirements() + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftThreatProtection.json + */ + /** + * Sample code: Check requirements for MicrosoftThreatProtection. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForMicrosoftThreatProtection( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new MtpCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsThreatIntelligenceTaxii.json + */ + /** + * Sample code: Check requirements for TI Taxii. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForTITaxii(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new TiTaxiiCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOfficeIRM.json + */ + /** + * Sample code: Check requirements for OfficeIRM. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForOfficeIRM(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new OfficeIrmCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsMicrosoftThreatIntelligence.json + */ + /** + * Sample code: Check requirements for MicrosoftThreatIntelligence. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForMicrosoftThreatIntelligence( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new MstiCheckRequirements().withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsPurviewAudit.json + */ + /** + * Sample code: Check requirements for PurviewAudit. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForPurviewAudit(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new PurviewAuditCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureActiveDirectory.json + */ + /** + * Sample code: Check requirements for AADIP (Azure Active Directory Identity Protection). + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForAADIPAzureActiveDirectoryIdentityProtection( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AadCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsOfficePowerBI.json + */ + /** + * Sample code: Check requirements for OfficePowerBI. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForOfficePowerBI(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new OfficePowerBICheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsDynamics365.json + */ + /** + * Sample code: Check requirements for Dynamics365. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForDynamics365(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new Dynamics365CheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsAzureActiveDirectoryNoLicense.json + */ + /** + * Sample code: Check requirements for AADIP (Azure Active Directory Identity Protection) - no license. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void checkRequirementsForAADIPAzureActiveDirectoryIdentityProtectionNoLicense( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new AadCheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CheckRequirementsThreatIntelligence.json + */ + /** + * Sample code: Check requirements for TI. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + checkRequirementsForTI(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectorsCheckRequirementsOperations() + .postWithResponse("myRg", "myWorkspace", + new TICheckRequirements().withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsConnectSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsConnectSamples.java new file mode 100644 index 000000000000..e45364d14671 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsConnectSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.ConnectAuthKind; +import com.azure.resourcemanager.securityinsights.models.DataConnectorConnectBody; +import java.io.IOException; +import java.util.Arrays; + +/** + * Samples for DataConnectors Connect. + */ +public final class DataConnectorsConnectSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/ConnectAPIPollingV2Logs.json + */ + /** + * Sample code: Connect an APIPolling V2 logs data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void connectAnAPIPollingV2LogsDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .connectWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new DataConnectorConnectBody().withKind(ConnectAuthKind.APIKEY) + .withApiKey("fakeTokenPlaceholder") + .withDataCollectionEndpoint("https://test.eastus.ingest.monitor.azure.com") + .withDataCollectionRuleImmutableId("dcr-34adsj9o7d6f9de204478b9cgb43b631") + .withOutputStream("Custom-MyTableRawData") + .withRequestConfigUserInputValues(Arrays.asList(SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"displayText\":\"Organization Name\",\"placeHolderName\":\"{{placeHolder1}}\",\"placeHolderValue\":\"somePlaceHolderValue\",\"requestObjectKey\":\"apiEndpoint\"}", + Object.class, SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/ConnectAPIPolling.json + */ + /** + * Sample code: Connect an APIPolling data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void connectAnAPIPollingDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .connectWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new DataConnectorConnectBody().withKind(ConnectAuthKind.APIKEY) + .withApiKey("fakeTokenPlaceholder") + .withRequestConfigUserInputValues(Arrays.asList(SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"displayText\":\"Organization Name\",\"placeHolderName\":\"{{placeHolder1}}\",\"placeHolderValue\":\"somePlaceHolderValue\",\"requestObjectKey\":\"apiEndpoint\"}", + Object.class, SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCreateOrUpdateSamples.java index 32e7aa82e357..6934c36af5e8 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCreateOrUpdateSamples.java @@ -4,16 +4,76 @@ package com.azure.resourcemanager.securityinsights.generated; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.securityinsights.models.Availability; +import com.azure.resourcemanager.securityinsights.models.AvailabilityStatus; +import com.azure.resourcemanager.securityinsights.models.CodelessApiPollingDataConnector; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingAuthProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingConfigProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingPagingProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingRequestProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessConnectorPollingResponseProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigProperties; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesDataTypesItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesGraphQueriesItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesInstructionStepsItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiConnectorConfigPropertiesSampleQueriesItem; +import com.azure.resourcemanager.securityinsights.models.CodelessUiDataConnector; +import com.azure.resourcemanager.securityinsights.models.ConnectivityType; import com.azure.resourcemanager.securityinsights.models.DataTypeState; +import com.azure.resourcemanager.securityinsights.models.DcrConfiguration; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnector; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities; +import com.azure.resourcemanager.securityinsights.models.GcpAuthProperties; +import com.azure.resourcemanager.securityinsights.models.GcpDataConnector; +import com.azure.resourcemanager.securityinsights.models.GcpRequestProperties; +import com.azure.resourcemanager.securityinsights.models.InstructionStepsInstructionsItem; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.MicrosoftPurviewInformationProtectionDataConnector; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnector; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnector; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnectorDataTypesAlerts; +import com.azure.resourcemanager.securityinsights.models.MtpDataConnectorDataTypesIncidents; +import com.azure.resourcemanager.securityinsights.models.MtpFilteredProviders; +import com.azure.resourcemanager.securityinsights.models.MtpProvider; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.Office365ProjectDataConnector; import com.azure.resourcemanager.securityinsights.models.OfficeDataConnector; import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypes; import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesExchange; import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesSharePoint; import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesTeams; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.OfficePowerBIDataConnector; +import com.azure.resourcemanager.securityinsights.models.PermissionProviderScope; +import com.azure.resourcemanager.securityinsights.models.Permissions; +import com.azure.resourcemanager.securityinsights.models.PermissionsCustomsItem; +import com.azure.resourcemanager.securityinsights.models.PermissionsResourceProviderItem; +import com.azure.resourcemanager.securityinsights.models.PollingFrequency; +import com.azure.resourcemanager.securityinsights.models.ProviderName; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditConnectorDataTypesLogs; +import com.azure.resourcemanager.securityinsights.models.PurviewAuditDataConnector; +import com.azure.resourcemanager.securityinsights.models.RequiredPermissions; +import com.azure.resourcemanager.securityinsights.models.SettingType; import com.azure.resourcemanager.securityinsights.models.TIDataConnector; import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes; import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypesIndicators; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnector; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnectorDataTypes; +import com.azure.resourcemanager.securityinsights.models.TiTaxiiDataConnectorDataTypesTaxiiClient; +import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; /** * Samples for DataConnectors CreateOrUpdate. @@ -21,7 +81,283 @@ public final class DataConnectorsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateMicrosoftThreatProtectionDataConnetor.json + */ + /** + * Sample code: Creates or updates a MicrosoftThreatProtection data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAMicrosoftThreatProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new MtpDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new MtpDataConnectorDataTypes() + .withIncidents(new MtpDataConnectorDataTypesIncidents().withState(DataTypeState.DISABLED)) + .withAlerts(new MtpDataConnectorDataTypesAlerts().withState(DataTypeState.ENABLED))) + .withFilteredProviders(new MtpFilteredProviders() + .withAlerts(Arrays.asList(MtpProvider.MICROSOFT_DEFENDER_FOR_CLOUD_APPS))) + .withTenantId("178265c4-3136-4ff6-8ed1-b5b62b4cb5f5"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreatePurviewAuditDataConnector.json + */ + /** + * Sample code: Creates or updates a PurviewAudit data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAPurviewAuditDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new PurviewAuditDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withConnectorDefinitionName("PowerAutomate") + .withSourceType("MicrosoftFlow") + .withDcrConfig(new DcrConfiguration().withDataCollectionEndpoint( + "https://microsoft-sentinel-datacollectionendpoint-123m.westeurope-1.ingest.monitor.azure.com") + .withDataCollectionRuleImmutableId("dcr-de21b053bd5a44beb99a256c9db85023") + .withStreamName("OFFICEPOWERAUTOMATE_RESTAPI")) + .withDataTypes(new PurviewAuditConnectorDataTypes() + .withLogs(new PurviewAuditConnectorDataTypesLogs().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateDynamics365DataConnetor.json + */ + /** + * Sample code: Creates or updates a Dynamics365 data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesADynamics365DataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "c2541efb-c9a6-47fe-9501-87d1017d1512", + new Dynamics365DataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new Dynamics365DataConnectorDataTypes() + .withDynamics365CdsActivities(new Dynamics365DataConnectorDataTypesDynamics365CdsActivities() + .withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateGenericUI.json + */ + /** + * Sample code: Creates or updates a GenericUI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAGenericUIDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new CodelessUiDataConnector().withConnectorUiConfig(new CodelessUiConnectorConfigProperties() + .withTitle("Qualys Vulnerability Management (CCP DEMO)") + .withPublisher("Qualys") + .withDescriptionMarkdown( + "The [Qualys Vulnerability Management (VM)](https://www.qualys.com/apps/vulnerability-management/) data connector provides the capability to ingest vulnerability host detection data into Azure Sentinel through the Qualys API. The connector provides visibility into host detection data from vulerability scans. This connector provides Azure Sentinel the capability to view dashboards, create custom alerts, and improve investigation ") + .withGraphQueriesTableName("QualysHostDetection_CL") + .withGraphQueries(Arrays.asList( + new CodelessUiConnectorConfigPropertiesGraphQueriesItem().withMetricName("Total data received") + .withLegend("{{graphQueriesTableName}}") + .withBaseQuery("{{graphQueriesTableName}}"))) + .withSampleQueries(Arrays.asList(new CodelessUiConnectorConfigPropertiesSampleQueriesItem() + .withDescription("Top 10 Vulerabilities detected") + .withQuery( + "{{graphQueriesTableName}}\n | mv-expand todynamic(Detections_s)\n | extend Vulnerability = tostring(Detections_s.Results)\n | summarize count() by Vulnerability\n | top 10 by count_"))) + .withDataTypes(Arrays.asList(new CodelessUiConnectorConfigPropertiesDataTypesItem() + .withName("{{graphQueriesTableName}}") + .withLastDataReceivedQuery( + "{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"))) + .withConnectivityCriteria( + Arrays.asList(new CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem() + .withType(ConnectivityType.IS_CONNECTED_QUERY) + .withValue(Arrays.asList( + "{{graphQueriesTableName}}\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)")))) + .withAvailability(new Availability().withStatus(AvailabilityStatus.ONE).withIsPreview(true)) + .withPermissions(new Permissions() + .withResourceProvider(Arrays.asList(new PermissionsResourceProviderItem() + .withProvider(ProviderName.MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES) + .withPermissionsDisplayText("read and write permissions on the workspace are required.") + .withProviderDisplayName("Workspace") + .withScope(PermissionProviderScope.WORKSPACE) + .withRequiredPermissions(new RequiredPermissions() + .withWrite(true) + .withRead(true) + .withDelete(true)), + new PermissionsResourceProviderItem() + .withProvider(ProviderName.MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES_SHARED_KEYS) + .withPermissionsDisplayText( + "read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key).") + .withProviderDisplayName("Keys") + .withScope(PermissionProviderScope.WORKSPACE) + .withRequiredPermissions(new RequiredPermissions().withAction(true)))) + .withCustoms(Arrays.asList(new PermissionsCustomsItem() + .withName("Microsoft.Web/sites permissions") + .withDescription( + "Read and write permissions to Azure Functions to create a Function App is required. [See the documentation to learn more about Azure Functions](https://docs.microsoft.com/azure/azure-functions/)."), + new PermissionsCustomsItem().withName("Qualys API Key") + .withDescription( + "A Qualys VM API username and password is required. [See the documentation to learn more about Qualys VM API](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf).")))) + .withInstructionSteps(Arrays.asList(new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("") + .withDescription( + ">**NOTE:** This connector uses Azure Functions to connect to Qualys VM to pull its logs into Azure Sentinel. This might result in additional data ingestion costs. Check the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/) for details."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + ">**(Optional Step)** Securely store workspace and API authorization key(s) or token(s) in Azure Key Vault. Azure Key Vault provides a secure mechanism to store and retrieve key values. [Follow these instructions](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) to use Azure Key Vault with an Azure Function App."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**STEP 1 - Configuration steps for the Qualys VM API**\n\n1. Log into the Qualys Vulnerability Management console with an administrator account, select the **Users** tab and the **Users** subtab. \n2. Click on the **New** drop-down menu and select **Users..**\n3. Create a username and password for the API account. \n4. In the **User Roles** tab, ensure the account role is set to **Manager** and access is allowed to **GUI** and **API**\n4. Log out of the administrator account and log into the console with the new API credentials for validation, then log out of the API account. \n5. Log back into the console using an administrator account and modify the API accounts User Roles, removing access to **GUI**. \n6. Save all changes."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**STEP 2 - Choose ONE from the following two deployment options to deploy the connector and the associated Azure Function**\n\n>**IMPORTANT:** Before deploying the Qualys VM connector, have the Workspace ID and Workspace Primary Key (can be copied from the following), as well as the Qualys VM API Authorization Key(s), readily available.") + .withInstructions(Arrays.asList( + new InstructionStepsInstructionsItem() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"fillWith\":[\"WorkspaceId\"],\"label\":\"Workspace ID\"}", + Object.class, SerializerEncoding.JSON)) + .withType(SettingType.COPYABLE_LABEL), + new InstructionStepsInstructionsItem() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"fillWith\":[\"PrimaryKey\"],\"label\":\"Primary Key\"}", + Object.class, SerializerEncoding.JSON)) + .withType(SettingType.COPYABLE_LABEL))), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("Option 1 - Azure Resource Manager (ARM) Template") + .withDescription( + "Use this method for automated deployment of the Qualys VM connector using an ARM Tempate.\n\n1. Click the **Deploy to Azure** button below. \n\n\t[![Deploy To Azure](https://aka.ms/deploytoazurebutton)](https://aka.ms/sentinelqualysvmazuredeploy)\n2. Select the preferred **Subscription**, **Resource Group** and **Location**. \n3. Enter the **Workspace ID**, **Workspace Key**, **API Username**, **API Password** , update the **URI**, and any additional URI **Filter Parameters** (each filter should be separated by an \"&\" symbol, no spaces.) \n> - Enter the URI that corresponds to your region. The complete list of API Server URLs can be [found here](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf#G4.735348) -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format. \n - The default **Time Interval** is set to pull the last five (5) minutes of data. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly (in the function.json file, post deployment) to prevent overlapping data ingestion. \n> - Note: If using Azure Key Vault secrets for any of the values above, use the`@Microsoft.KeyVault(SecretUri={Security Identifier})`schema in place of the string values. Refer to [Key Vault references documentation](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) for further details. \n4. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n5. Click **Purchase** to deploy."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("Option 2 - Manual Deployment of Azure Functions") + .withDescription( + "Use the following step-by-step instructions to deploy the Quayls VM connector manually with Azure Functions."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**1. Create a Function App**\n\n1. From the Azure Portal, navigate to [Function App](https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.Web%2Fsites/kind/functionapp), and select **+ Add**.\n2. In the **Basics** tab, ensure Runtime stack is set to **Powershell Core**. \n3. In the **Hosting** tab, ensure the **Consumption (Serverless)** plan type is selected.\n4. Make other preferrable configuration changes, if needed, then click **Create**."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**2. Import Function App Code**\n\n1. In the newly created Function App, select **Functions** on the left pane and click **+ New Function**.\n2. Select **Timer Trigger**.\n3. Enter a unique Function **Name** and leave the default cron schedule of every 5 minutes, then click **Create**.\n5. Click on **Code + Test** on the left pane. \n6. Copy the [Function App Code](https://aka.ms/sentinelqualysvmazurefunctioncode) and paste into the Function App `run.ps1` editor.\n7. Click **Save**."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**3. Configure the Function App**\n\n1. In the Function App, select the Function App Name and select **Configuration**.\n2. In the **Application settings** tab, select **+ New application setting**.\n3. Add each of the following seven (7) application settings individually, with their respective string values (case-sensitive): \n\t\tapiUsername\n\t\tapiPassword\n\t\tworkspaceID\n\t\tworkspaceKey\n\t\turi\n\t\tfilterParameters\n\t\ttimeInterval\n> - Enter the URI that corresponds to your region. The complete list of API Server URLs can be [found here](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf#G4.735348). The `uri` value must follow the following schema: `https:///api/2.0/fo/asset/host/vm/detection/?action=list&vm_processed_after=` -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format.\n> - Add any additional filter parameters, for the `filterParameters` variable, that need to be appended to the URI. Each parameter should be seperated by an \"&\" symbol and should not include any spaces.\n> - Set the `timeInterval` (in minutes) to the value of `5` to correspond to the Timer Trigger of every `5` minutes. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly to prevent overlapping data ingestion.\n> - Note: If using Azure Key Vault, use the`@Microsoft.KeyVault(SecretUri={Security Identifier})`schema in place of the string values. Refer to [Key Vault references documentation](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) for further details.\n4. Once all application settings have been entered, click **Save**."), + new CodelessUiConnectorConfigPropertiesInstructionStepsItem().withTitle("") + .withDescription( + "**4. Configure the host.json**.\n\nDue to the potentially large amount of Qualys host detection data being ingested, it can cause the execution time to surpass the default Function App timeout of five (5) minutes. Increase the default timeout duration to the maximum of ten (10) minutes, under the Consumption Plan, to allow more time for the Function App to execute.\n\n1. In the Function App, select the Function App Name and select the **App Service Editor** blade.\n2. Click **Go** to open the editor, then select the **host.json** file under the **wwwroot** directory.\n3. Add the line `\"functionTimeout\": \"00:10:00\",` above the `managedDependancy` line \n4. Ensure **SAVED** appears on the top right corner of the editor, then exit the editor.\n\n> NOTE: If a longer timeout duration is required, consider upgrading to an [App Service Plan](https://docs.microsoft.com/azure/azure-functions/functions-scale#timeout)")))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateOffice365ProjectDataConnetor.json + */ + /** + * Sample code: Creates or updates an Office365 Project data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAnOffice365ProjectDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new Office365ProjectDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new Office365ProjectConnectorDataTypes() + .withLogs(new Office365ProjectConnectorDataTypesLogs().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateGoogleCloudPlatform.json + */ + /** + * Sample code: Creates or updates a GCP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAGCPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + new GcpDataConnector().withConnectorDefinitionName("GcpConnector") + .withAuth(new GcpAuthProperties() + .withServiceAccountEmail("sentinel-service-account@project-id.iam.gserviceaccount.com") + .withProjectNumber("123456789012") + .withWorkloadIdentityProviderId("sentinel-identity-provider")) + .withRequest(new GcpRequestProperties().withProjectId("project-id") + .withSubscriptionNames(Arrays.asList("sentinel-subscription"))) + .withDcrConfig(new DcrConfiguration().withDataCollectionEndpoint( + "https://microsoft-sentinel-datacollectionendpoint-123m.westeurope-1.ingest.monitor.azure.com") + .withDataCollectionRuleImmutableId("dcr-de21b053bd5a44beb99a256c9db85023") + .withStreamName("SENTINEL_GCP_AUDIT_LOGS")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateMicrosoftThreatIntelligenceDataConnector.json + */ + /** + * Sample code: Creates or updates a Microsoft Threat Intelligence data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAMicrosoftThreatIntelligenceDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + new MstiDataConnector() + .withDataTypes(new MstiDataConnectorDataTypes().withMicrosoftEmergingThreatFeed( + new MstiDataConnectorDataTypesMicrosoftEmergingThreatFeed().withState(DataTypeState.ENABLED) + .withLookbackPeriod("1970-01-01T00:00:00.000Z"))) + .withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateMicrosoftPurviewInformationProtectionDataConnetor.json + */ + /** + * Sample code: Creates or updates an MicrosoftPurviewInformationProtection data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAnMicrosoftPurviewInformationProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new MicrosoftPurviewInformationProtectionDataConnector() + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new MicrosoftPurviewInformationProtectionConnectorDataTypes() + .withLogs(new MicrosoftPurviewInformationProtectionConnectorDataTypesLogs() + .withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * dataConnectors/CreateOfficeDataConnetor.json */ /** @@ -34,17 +370,67 @@ public static void createsOrUpdatesAnOffice365DataConnector( manager.dataConnectors() .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", new OfficeDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") - .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8") .withDataTypes(new OfficeDataConnectorDataTypes() .withExchange(new OfficeDataConnectorDataTypesExchange().withState(DataTypeState.ENABLED)) .withSharePoint(new OfficeDataConnectorDataTypesSharePoint().withState(DataTypeState.ENABLED)) - .withTeams(new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.ENABLED))), + .withTeams(new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), com.azure.core.util.Context.NONE); } /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateOfficePowerBIDataConnector.json + */ + /** + * Sample code: Creates or updates an Office PowerBI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAnOfficePowerBIDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new OfficePowerBIDataConnector().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDataTypes(new OfficePowerBIConnectorDataTypes() + .withLogs(new OfficePowerBIConnectorDataTypesLogs().withState(DataTypeState.ENABLED))) + .withTenantId("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateThreatIntelligenceTaxiiDataConnector.json + */ + /** + * Sample code: Creates or updates a Threat Intelligence Taxii data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAThreatIntelligenceTaxiiDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + new TiTaxiiDataConnector().withEtag("d12423f6-a60b-4ca5-88c0-feb1a182d0f0") + .withWorkspaceId("dd124572-4962-4495-9bd2-9dade12314b4") + .withFriendlyName("testTaxii") + .withTaxiiServer("https://limo.anomali.com/api/v1/taxii2/feeds") + .withCollectionId("135") + .withUsername("--") + .withPassword("fakeTokenPlaceholder") + .withTaxiiLookbackPeriod(OffsetDateTime.parse("2020-01-01T13:00:30.123Z")) + .withPollingFrequency(PollingFrequency.ONCE_ADAY) + .withDataTypes(new TiTaxiiDataConnectorDataTypes().withTaxiiClient( + new TiTaxiiDataConnectorDataTypesTaxiiClient().withState(DataTypeState.ENABLED))) + .withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * dataConnectors/CreateThreatIntelligenceDataConnector.json */ /** @@ -56,10 +442,96 @@ public static void createsOrUpdatesAnThreatIntelligencePlatformDataConnector( com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.dataConnectors() .createOrUpdateWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - new TIDataConnector().withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b") - .withTipLookbackPeriod(OffsetDateTime.parse("2020-01-01T13:00:30.123Z")) + new TIDataConnector().withTipLookbackPeriod(OffsetDateTime.parse("2020-01-01T13:00:30.123Z")) .withDataTypes(new TIDataConnectorDataTypes() - .withIndicators(new TIDataConnectorDataTypesIndicators().withState(DataTypeState.ENABLED))), + .withIndicators(new TIDataConnectorDataTypesIndicators().withState(DataTypeState.ENABLED))) + .withTenantId("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/CreateAPIPolling.json + */ + /** + * Sample code: Creates or updates a APIPolling data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAAPIPollingDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { + manager.dataConnectors() + .createOrUpdateWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + new CodelessApiPollingDataConnector().withConnectorUiConfig(new CodelessUiConnectorConfigProperties() + .withTitle("GitHub Enterprise Audit Log") + .withPublisher("GitHub") + .withDescriptionMarkdown( + "The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process.") + .withGraphQueriesTableName("GitHubAuditLogPolling_CL") + .withGraphQueries(Arrays.asList(new CodelessUiConnectorConfigPropertiesGraphQueriesItem() + .withMetricName("Total events received") + .withLegend("GitHub audit log events") + .withBaseQuery("{{graphQueriesTableName}}"))) + .withSampleQueries(Arrays + .asList(new CodelessUiConnectorConfigPropertiesSampleQueriesItem().withDescription("All logs") + .withQuery("{{graphQueriesTableName}}\n | take 10 "))) + .withDataTypes(Arrays.asList(new CodelessUiConnectorConfigPropertiesDataTypesItem() + .withName("{{graphQueriesTableName}}") + .withLastDataReceivedQuery( + "{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"))) + .withConnectivityCriteria( + Arrays.asList(new CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem() + .withType(ConnectivityType.fromString("SentinelKindsV2")) + .withValue(Arrays.asList()))) + .withAvailability(new Availability().withStatus(AvailabilityStatus.ONE).withIsPreview(true)) + .withPermissions( + new Permissions() + .withResourceProvider(Arrays.asList(new PermissionsResourceProviderItem() + .withProvider(ProviderName.MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES) + .withPermissionsDisplayText("read and write permissions are required.") + .withProviderDisplayName("Workspace") + .withScope(PermissionProviderScope.WORKSPACE) + .withRequiredPermissions(new RequiredPermissions() + .withWrite(true) + .withRead(true) + .withDelete(true)))) + .withCustoms(Arrays.asList(new PermissionsCustomsItem() + .withName("GitHub API personal token Key") + .withDescription( + "You need access to GitHub personal token, the key should have 'admin:org' scope")))) + .withInstructionSteps(Arrays.asList(new CodelessUiConnectorConfigPropertiesInstructionStepsItem() + .withTitle("Connect GitHub Enterprise Audit Log to Azure Sentinel") + .withDescription( + "Enable GitHub audit Logs. \n Follow [this](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create or find your personal key") + .withInstructions(Arrays.asList(new InstructionStepsInstructionsItem() + .withParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"enable\":\"true\",\"userRequestPlaceHoldersInput\":[{\"displayText\":\"Organization Name\",\"placeHolderName\":\"{{placeHolder1}}\",\"placeHolderValue\":\"\",\"requestObjectKey\":\"apiEndpoint\"}]}", + Object.class, SerializerEncoding.JSON)) + .withType(SettingType.fromString("APIKey"))))))) + .withPollingConfig(new CodelessConnectorPollingConfigProperties() + .withAuth(new CodelessConnectorPollingAuthProperties().withAuthType("APIKey") + .withApiKeyName("fakeTokenPlaceholder") + .withApiKeyIdentifier("fakeTokenPlaceholder")) + .withRequest(new CodelessConnectorPollingRequestProperties() + .withApiEndpoint("https://api.github.com/organizations/{{placeHolder1}}/audit-log") + .withRateLimitQps(50) + .withQueryWindowInMin(15) + .withHttpMethod("Get") + .withQueryTimeFormat("yyyy-MM-ddTHH:mm:ssZ") + .withRetryCount(2) + .withTimeoutInSeconds(60) + .withHeaders(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"Accept\":\"application/json\",\"User-Agent\":\"Scuba\"}", Object.class, + SerializerEncoding.JSON)) + .withQueryParameters(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("{\"phrase\":\"created:{_QueryWindowStartTime}..{_QueryWindowEndTime}\"}", + Object.class, SerializerEncoding.JSON))) + .withPaging(new CodelessConnectorPollingPagingProperties().withPagingType("LinkHeader") + .withPageSizeParaName("per_page")) + .withResponse( + new CodelessConnectorPollingResponseProperties().withEventsJsonPaths(Arrays.asList("$")))), com.azure.core.util.Context.NONE); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDeleteSamples.java index 5cdfb61c46e7..88781235a1d2 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDeleteSamples.java @@ -10,7 +10,75 @@ public final class DataConnectorsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteOffice365ProjectDataConnetor.json + */ + /** + * Sample code: Delete an Office365 Project data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAnOffice365ProjectDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteMicrosoftPurviewInformationProtectionDataConnetor.json + */ + /** + * Sample code: Delete an MicrosoftPurviewInformationProtection data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAnMicrosoftPurviewInformationProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteGoogleCloudPlatform.json + */ + /** + * Sample code: Delete a GCP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAGCPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteGenericUI.json + */ + /** + * Sample code: Delete a GenericUI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAGenericUIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * dataConnectors/DeleteOfficeDataConnetor.json */ /** @@ -24,4 +92,72 @@ public final class DataConnectorsDeleteSamples { .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeletePurviewAuditDataConnector.json + */ + /** + * Sample code: Delete a PurviewAudit data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAPurviewAuditDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteOfficePowerBIDataConnetor.json + */ + /** + * Sample code: Delete an Office PowerBI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAnOfficePowerBIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteAPIPolling.json + */ + /** + * Sample code: Delete a APIPolling data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAAPIPollingDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DeleteMicrosoftThreatIntelligenceDataConnector.json + */ + /** + * Sample code: Delete an MicrosoftThreatIntelligence data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAnMicrosoftThreatIntelligenceDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .deleteWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDisconnectSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDisconnectSamples.java new file mode 100644 index 000000000000..8873c9462833 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDisconnectSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for DataConnectors Disconnect. + */ +public final class DataConnectorsDisconnectSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/DisconnectAPIPolling.json + */ + /** + * Sample code: Disconnect an APIPolling data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void disconnectAnAPIPollingDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .disconnectWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsGetSamples.java index cc51ec8a70da..1501ee074786 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsGetSamples.java @@ -10,33 +10,67 @@ public final class DataConnectorsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetAzureSecurityCenterById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAzureActiveDirectoryById.json */ /** - * Sample code: Get a ASC data connector. + * Sample code: Get an AADIP (Azure Active Directory Identity Protection) data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnAADIPAzureActiveDirectoryIdentityProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOffice365ProjectDataConnetorById.json + */ + /** + * Sample code: Get an Office365 Project data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAASCDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + getAnOffice365ProjectDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetOfficeDataConnetorById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetGenericUI.json */ /** - * Sample code: Get an Office365 data connector. + * Sample code: Get a GenericUI data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAnOffice365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + getAGenericUIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetPurviewAuditDataConnectorById.json + */ + /** + * Sample code: Get a PurviewAudit data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAPurviewAuditDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.dataConnectors() .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); @@ -44,7 +78,41 @@ public final class DataConnectorsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOffice365AdvancedThreatProtectionById.json + */ + /** + * Sample code: Get an Office ATP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnOfficeATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "3d3e955e-33eb-401d-89a7-251c81ddd660", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetIoTById.json + */ + /** + * Sample code: Get a IoT data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAIoTDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "d2e5dc7a-f3a2-429d-954b-939fa8c2932e", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * dataConnectors/GetMicrosoftCloudAppSecurityById.json */ /** @@ -61,7 +129,74 @@ public final class DataConnectorsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetThreatIntelligenceTaxiiById.json + */ + /** + * Sample code: Get a TI Taxii data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getATITaxiiDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c39bb458-02a7-4b3f-b0c8-71a1d2692652", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftThreatIntelligenceById.json + */ + /** + * Sample code: Get a MicrosoftThreatIntelligence data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMicrosoftThreatIntelligenceDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAzureSecurityCenterById.json + */ + /** + * Sample code: Get a ASC data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAASCDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetThreatIntelligenceById.json + */ + /** + * Sample code: Get a TI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getATIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * dataConnectors/GetAmazonWebServicesCloudTrailById.json */ /** @@ -78,7 +213,58 @@ public final class DataConnectorsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json + */ + /** + * Sample code: Get a MDATP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAMDATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "06b3ccb8-1384-4bcc-aec7-852f6d57161b", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftThreatProtectionById.json + */ + /** + * Sample code: Get a MicrosoftThreatProtection data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMicrosoftThreatProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftPurviewInformationProtectionDataConnetorById.json + */ + /** + * Sample code: Get a MicrosoftPurviewInformationProtection data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMicrosoftPurviewInformationProtectionDataConnector( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * dataConnectors/GetAzureAdvancedThreatProtectionById.json */ /** @@ -95,51 +281,137 @@ public final class DataConnectorsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAPIPolling.json */ /** - * Sample code: Get a MDATP data connector. + * Sample code: Get a APIPolling data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAMDATPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + getAAPIPollingDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "06b3ccb8-1384-4bcc-aec7-852f6d57161b", + .getWithResponse("myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", com.azure.core.util.Context.NONE); } /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetThreatIntelligenceById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetMicrosoftInsiderRiskManagementById.json */ /** - * Sample code: Get a TI data connector. + * Sample code: Get an Office IRM data connector. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getATIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void + getAnOfficeIRMDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", + .getWithResponse("myRg", "myWorkspace", "3d3e955e-33eb-401d-89a7-251c81ddd660", com.azure.core.util.Context.NONE); } /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ - * dataConnectors/GetAzureActiveDirectoryById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetDynamics365DataConnectorById.json */ /** - * Sample code: Get an AAD data connector. + * Sample code: Get a Dynamics365 data connector. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAnAADDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + getADynamics365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.dataConnectors() - .getWithResponse("myRg", "myWorkspace", "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d", + .getWithResponse("myRg", "myWorkspace", "c2541efb-c9a6-47fe-9501-87d1017d1512", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOfficeDataConnetorById.json + */ + /** + * Sample code: Get an Office365 data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnOffice365DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetGoogleCloudPlatformById.json + */ + /** + * Sample code: Get a GCP data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAGCPDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "GCP_fce27b90-d6f5-4d30-991a-af509a2b50a1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetAmazonWebServicesS3ById.json + */ + /** + * Sample code: Get an Aws S3 data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnAwsS3DataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "afef3743-0c88-469c-84ff-ca2e87dc1e48", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetRestApiPollerById.json + */ + /** + * Sample code: Get a RestApiPoller data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getARestApiPollerDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "RestApiPoller_fce27b90-d6f5-4d30-991a-af509a2b50a1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * dataConnectors/GetOfficePowerBIDataConnetorById.json + */ + /** + * Sample code: Get an Office365 PowerBI data connector. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnOffice365PowerBIDataConnector(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.dataConnectors() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsListSamples.java index 9c026cce1dd5..e6c32a5b4fbc 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsListSamples.java @@ -10,7 +10,7 @@ public final class DataConnectorsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * dataConnectors/GetDataConnectors.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesExpandSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesExpandSamples.java new file mode 100644 index 000000000000..e50ebeed6971 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesExpandSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EntityExpandParameters; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** + * Samples for Entities Expand. + */ +public final class EntitiesExpandSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/expand/PostExpandEntity.json + */ + /** + * Sample code: Expand an entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void expandAnEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .expandWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + new EntityExpandParameters().withEndTime(OffsetDateTime.parse("2019-05-26T00:00:00.000Z")) + .withExpansionId(UUID.fromString("a77992f3-25e9-4d01-99a4-5ff606cc410a")) + .withStartTime(OffsetDateTime.parse("2019-04-25T00:00:00.000Z")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetInsightsSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetInsightsSamples.java new file mode 100644 index 000000000000..ab1438f8ec0d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetInsightsSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EntityGetInsightsParameters; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; + +/** + * Samples for Entities GetInsights. + */ +public final class EntitiesGetInsightsSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/insights/PostGetInsights.json + */ + /** + * Sample code: Entity Insight. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void entityInsight(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getInsightsWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + new EntityGetInsightsParameters().withStartTime(OffsetDateTime.parse("2021-09-01T00:00:00.000Z")) + .withEndTime(OffsetDateTime.parse("2021-10-01T00:00:00.000Z")) + .withAddDefaultExtendedTimeRange(false) + .withInsightQueryIds(Arrays.asList(UUID.fromString("cae8d0aa-aa45-4d53-8d88-17dd64ffd4e4"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetSamples.java new file mode 100644 index 000000000000..cdf301b62639 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetSamples.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Entities Get. + */ +public final class EntitiesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetSubmissionMailEntityById.json + */ + /** + * Sample code: Get a submissionMail entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getASubmissionMailEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetDnsEntityById.json + */ + /** + * Sample code: Get a dns entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getADnsEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "f4e74920-f2c0-4412-a45f-66d94fdf01f8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetFileHashEntityById.json + */ + /** + * Sample code: Get a file hash entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAFileHashEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "ea359fa6-c1e5-f878-e105-6344f3e399a1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetIoTDeviceEntityById.json + */ + /** + * Sample code: Get an IoT device entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnIoTDeviceEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetRegistryKeyEntityById.json + */ + /** + * Sample code: Get a registry key entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getARegistryKeyEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMailboxEntityById.json + */ + /** + * Sample code: Get a mailbox entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMailboxEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMalwareEntityById.json + */ + /** + * Sample code: Get a malware entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAMalwareEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "af378b21-b4aa-4fe7-bc70-13f8621a322f", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetSecurityAlertEntityById.json + */ + /** + * Sample code: Get a security alert entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getASecurityAlertEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "4aa486e0-6f85-41af-99ea-7acdce7be6c8", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetIpEntityById.json + */ + /** + * Sample code: Get an ip entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnIpEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetAccountEntityById.json + */ + /** + * Sample code: Get an account entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnAccountEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetCloudApplicationEntityById.json + */ + /** + * Sample code: Get a cloud application entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getACloudApplicationEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetFileEntityById.json + */ + /** + * Sample code: Get a file entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAFileEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "af378b21-b4aa-4fe7-bc70-13f8621a322f", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetRegistryValueEntityById.json + */ + /** + * Sample code: Get a registry value entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getARegistryValueEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "dc44bd11-b348-4d76-ad29-37bf7aa41356", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetUrlEntityById.json + */ + /** + * Sample code: Get a url entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAUrlEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMailClusterEntityById.json + */ + /** + * Sample code: Get a mailCluster entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAMailClusterEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetSecurityGroupEntityById.json + */ + /** + * Sample code: Get a security group entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getASecurityGroupEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetMailMessageEntityById.json + */ + /** + * Sample code: Get a mailMessage entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAMailMessageEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetAzureResourceEntityById.json + */ + /** + * Sample code: Get an azure resource entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnAzureResourceEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetHostEntityById.json + */ + /** + * Sample code: Get a host entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAHostEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetProcessEntityById.json + */ + /** + * Sample code: Get a process entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAProcessEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .getWithResponse("myRg", "myWorkspace", "7264685c-038c-42c6-948c-38e14ef1fb98", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetTimelineListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetTimelineListSamples.java new file mode 100644 index 000000000000..a63ca6391db8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesGetTimelineListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EntityTimelineParameters; +import java.time.OffsetDateTime; + +/** + * Samples for EntitiesGetTimeline List. + */ +public final class EntitiesGetTimelineListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/timeline/PostTimelineEntity.json + */ + /** + * Sample code: Entity timeline. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void entityTimeline(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entitiesGetTimelines() + .listWithResponse("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", + new EntityTimelineParameters().withStartTime(OffsetDateTime.parse("2021-09-01T00:00:00.000Z")) + .withEndTime(OffsetDateTime.parse("2021-10-01T00:00:00.000Z")) + .withNumberOfBucket(4), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesListSamples.java new file mode 100644 index 000000000000..1998cdb0513a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Entities List. + */ +public final class EntitiesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetEntities.json + */ + /** + * Sample code: Get all entities. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllEntities(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesQueriesSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesQueriesSamples.java new file mode 100644 index 000000000000..2169d1e91851 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesQueriesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EntityItemQueryKind; + +/** + * Samples for Entities Queries. + */ +public final class EntitiesQueriesSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/GetQueries.json + */ + /** + * Sample code: Get Entity Query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .queries("myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", EntityItemQueryKind.INSIGHT, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesRelationsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesRelationsListSamples.java new file mode 100644 index 000000000000..67e310568fd1 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesRelationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for EntitiesRelations List. + */ +public final class EntitiesRelationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/relations/GetAllEntityRelations.json + */ + /** + * Sample code: Get all relations of an entity. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllRelationsOfAnEntity(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entitiesRelations() + .list("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", null, null, null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesRunPlaybookSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesRunPlaybookSamples.java new file mode 100644 index 000000000000..dabadf66d629 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntitiesRunPlaybookSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Entities RunPlaybook. + */ +public final class EntitiesRunPlaybookSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * manualTrigger/Entities_RunPlaybook.json + */ + /** + * Sample code: Entities_RunPlaybook. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void entitiesRunPlaybook(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entities() + .runPlaybookWithResponse("myRg", "myWorkspace", "72e01a22-5cd2-4139-a149-9f2736ff2ar2", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..1a770b3a9ae7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesCreateOrUpdateSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.ActivityCustomEntityQuery; +import com.azure.resourcemanager.securityinsights.models.ActivityEntityQueriesPropertiesQueryDefinitions; +import com.azure.resourcemanager.securityinsights.models.EntityType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EntityQueries CreateOrUpdate. + */ +public final class EntityQueriesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/CreateEntityQueryActivity.json + */ + /** + * Sample code: Creates or updates an Activity entity query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAnActivityEntityQuery( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .createOrUpdateWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + new ActivityCustomEntityQuery().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withTitle("An account was deleted on this host") + .withContent("On '{{Computer}}' the account '{{TargetAccount}}' was deleted by '{{AddedBy}}'") + .withDescription("Account deleted on host") + .withQueryDefinitions(new ActivityEntityQueriesPropertiesQueryDefinitions().withQuery( + "let GetAccountActions = (v_Host_Name:string, v_Host_NTDomain:string, v_Host_DnsDomain:string, v_Host_AzureID:string, v_Host_OMSAgentID:string){\nSecurityEvent\n| where EventID in (4725, 4726, 4767, 4720, 4722, 4723, 4724)\n// parsing for Host to handle variety of conventions coming from data\n| extend Host_HostName = case(\nComputer has '@', tostring(split(Computer, '@')[0]),\nComputer has '\\\\', tostring(split(Computer, '\\\\')[1]),\nComputer has '.', tostring(split(Computer, '.')[0]),\nComputer\n)\n| extend Host_NTDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', tostring(split(Computer, '.')[-2]), \nComputer\n)\n| extend Host_DnsDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', strcat_array(array_slice(split(Computer,'.'),-2,-1),'.'), \nComputer\n)\n| where (Host_HostName =~ v_Host_Name and Host_NTDomain =~ v_Host_NTDomain) \nor (Host_HostName =~ v_Host_Name and Host_DnsDomain =~ v_Host_DnsDomain) \nor v_Host_AzureID =~ _ResourceId \nor v_Host_OMSAgentID == SourceComputerId\n| project TimeGenerated, EventID, Activity, Computer, TargetAccount, TargetUserName, TargetDomainName, TargetSid, SubjectUserName, SubjectUserSid, _ResourceId, SourceComputerId\n| extend AddedBy = SubjectUserName\n// Future support for Activities\n| extend timestamp = TimeGenerated, HostCustomEntity = Computer, AccountCustomEntity = TargetAccount\n};\nGetAccountActions('{{Host_HostName}}', '{{Host_NTDomain}}', '{{Host_DnsDomain}}', '{{Host_AzureID}}', '{{Host_OMSAgentID}}')\n \n| where EventID == 4726 ")) + .withInputEntityType(EntityType.HOST) + .withRequiredInputFieldsSets(Arrays.asList(Arrays.asList("Host_HostName", "Host_NTDomain"), + Arrays.asList("Host_HostName", "Host_DnsDomain"), Arrays.asList("Host_AzureID"), + Arrays.asList("Host_OMSAgentID"))) + .withEntitiesFilter(mapOf("Host_OsFamily", Arrays.asList("Windows"))) + .withEnabled(true), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesDeleteSamples.java new file mode 100644 index 000000000000..3fe70dcdb82a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for EntityQueries Delete. + */ +public final class EntityQueriesDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/DeleteEntityQuery.json + */ + /** + * Sample code: Delete an entity query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAnEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .deleteWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesGetSamples.java new file mode 100644 index 000000000000..dd7eb5622e0e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesGetSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for EntityQueries Get. + */ +public final class EntityQueriesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/GetActivityEntityQueryById.json + */ + /** + * Sample code: Get an Activity entity query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnActivityEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .getWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/GetExpansionEntityQueryById.json + */ + /** + * Sample code: Get an Expansion entity query. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnExpansionEntityQuery(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .getWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesListSamples.java new file mode 100644 index 000000000000..874ba8c7e96e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueriesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + +/** + * Samples for EntityQueries List. + */ +public final class EntityQueriesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueries/GetEntityQueries.json + */ + /** + * Sample code: Get all entity queries. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllEntityQueries(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueries() + .list("myRg", "myWorkspace", EntityQueryTemplateKind.EXPANSION, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueryTemplatesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueryTemplatesGetSamples.java new file mode 100644 index 000000000000..e12165c4c6db --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueryTemplatesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for EntityQueryTemplates Get. + */ +public final class EntityQueryTemplatesGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueryTemplates/GetActivityEntityQueryTemplateById.json + */ + /** + * Sample code: Get an Activity entity query template. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAnActivityEntityQueryTemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueryTemplates() + .getWithResponse("myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueryTemplatesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueryTemplatesListSamples.java new file mode 100644 index 000000000000..df2e7ebb4862 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityQueryTemplatesListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EntityQueryTemplateKind; + +/** + * Samples for EntityQueryTemplates List. + */ +public final class EntityQueryTemplatesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entityQueryTemplates/GetEntityQueryTemplates.json + */ + /** + * Sample code: Get all entity query templates. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllEntityQueryTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityQueryTemplates() + .list("myRg", "myWorkspace", EntityQueryTemplateKind.ACTIVITY, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityRelationsGetRelationSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityRelationsGetRelationSamples.java new file mode 100644 index 000000000000..a3d29ed19500 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/EntityRelationsGetRelationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for EntityRelations GetRelation. + */ +public final class EntityRelationsGetRelationSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * entities/relations/GetEntityRelationByName.json + */ + /** + * Sample code: Get an entity relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnEntityRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.entityRelations() + .getRelationWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsCreateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsCreateSamples.java new file mode 100644 index 000000000000..6bdca3380d63 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsCreateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.FileFormat; +import com.azure.resourcemanager.securityinsights.models.FileImportContentType; +import com.azure.resourcemanager.securityinsights.models.FileMetadata; +import com.azure.resourcemanager.securityinsights.models.IngestionMode; + +/** + * Samples for FileImports Create. + */ +public final class FileImportsCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/CreateFileImport.json + */ + /** + * Sample code: Create a file import. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createAFileImport(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withExistingWorkspace("myRg", "myWorkspace") + .withIngestionMode(IngestionMode.INGEST_ANY_VALID_RECORDS) + .withContentType(FileImportContentType.STIX_INDICATOR) + .withImportFile( + new FileMetadata().withFileFormat(FileFormat.JSON).withFileName("myFile.json").withFileSize(4653)) + .withSource("mySource") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsDeleteSamples.java new file mode 100644 index 000000000000..42c01a75fcac --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for FileImports Delete. + */ +public final class FileImportsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/DeleteFileImport.json + */ + /** + * Sample code: Delete a file import. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAFileImport(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .delete("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsGetSamples.java new file mode 100644 index 000000000000..a0a0d1faa521 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for FileImports Get. + */ +public final class FileImportsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/GetFileImportById.json + */ + /** + * Sample code: Get a file import. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAFileImport(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsListSamples.java new file mode 100644 index 000000000000..699ef2c0ae34 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/FileImportsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for FileImports List. + */ +public final class FileImportsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * fileImports/GetFileImports.json + */ + /** + * Sample code: Get all file imports. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllFileImports(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.fileImports() + .list("myRg", "myWorkspace", null, "properties/createdTimeUtc desc", 1, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetRecommendationsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetRecommendationsListSamples.java new file mode 100644 index 000000000000..6208b38d5664 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetRecommendationsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for GetRecommendations List. + */ +public final class GetRecommendationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/GetRecommendations.json + */ + /** + * Sample code: Get Recommendations list. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getRecommendationsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.getRecommendations().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetSingleRecommendationSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetSingleRecommendationSamples.java new file mode 100644 index 000000000000..c2969a62649d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetSingleRecommendationSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import java.util.UUID; + +/** + * Samples for Get SingleRecommendation. + */ +public final class GetSingleRecommendationSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/GetRecommendation.json + */ + /** + * Sample code: Get a recommendation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getARecommendation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.gets() + .singleRecommendationWithResponse("myRg", "myWorkspace", + UUID.fromString("6d4b54eb-8684-4aa3-a156-3aa37b8014bc"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetTriggeredAnalyticsRuleRunsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetTriggeredAnalyticsRuleRunsListSamples.java new file mode 100644 index 000000000000..ee2ab426403a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/GetTriggeredAnalyticsRuleRunsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for GetTriggeredAnalyticsRuleRuns List. + */ +public final class GetTriggeredAnalyticsRuleRunsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * triggeredAnalyticsRuleRuns/triggeredAnalyticsRuleRuns_Get.json + */ + /** + * Sample code: triggeredAnalyticsRuleRuns_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + triggeredAnalyticsRuleRunsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.getTriggeredAnalyticsRuleRuns().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..876e652735e6 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for HuntComments CreateOrUpdate. + */ +public final class HuntCommentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/CreateHuntComment.json + */ + /** + * Sample code: Creates or updates a hunt comment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAHuntComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .define("2216d0e1-91e3-4902-89fd-d2df8c535096") + .withExistingHunt("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f") + .withMessage("This is a test comment.") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsDeleteSamples.java new file mode 100644 index 000000000000..abc00f40cbdf --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for HuntComments Delete. + */ +public final class HuntCommentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/DeleteHuntComment.json + */ + /** + * Sample code: Delete a hunt comment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAHuntComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .deleteWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c123456", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsGetSamples.java new file mode 100644 index 000000000000..9f2166d05293 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for HuntComments Get. + */ +public final class HuntCommentsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntCommentById.json + */ + /** + * Sample code: Get a hunt comment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAHuntComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .getWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c535096", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsListSamples.java new file mode 100644 index 000000000000..d7bbf509148c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntCommentsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for HuntComments List. + */ +public final class HuntCommentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntComments.json + */ + /** + * Sample code: Get all hunt comments. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllHuntComments(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntComments() + .list("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", null, null, null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..8e31d14f80f3 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import java.util.Arrays; + +/** + * Samples for HuntRelations CreateOrUpdate. + */ +public final class HuntRelationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/CreateHuntRelation.json + */ + /** + * Sample code: Creates or updates a hunt relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAHuntRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .define("2216d0e1-91e3-4902-89fd-d2df8c535096") + .withExistingHunt("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f") + .withRelatedResourceId( + "/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/mms-eus/providers/Microsoft.OperationalInsights/workspaces/avdvirint/providers/Microsoft.SecurityInsights/Bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096") + .withLabels(Arrays.asList("Test Label")) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsDeleteSamples.java new file mode 100644 index 000000000000..a96b228cde5a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for HuntRelations Delete. + */ +public final class HuntRelationsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/DeleteHuntRelation.json + */ + /** + * Sample code: Delete a hunt relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAHuntRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .deleteWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c535096", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsGetSamples.java new file mode 100644 index 000000000000..a4d84028c156 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for HuntRelations Get. + */ +public final class HuntRelationsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntRelationById.json + */ + /** + * Sample code: Get a hunt relation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAHuntRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .getWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + "2216d0e1-91e3-4902-89fd-d2df8c535096", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsListSamples.java new file mode 100644 index 000000000000..2717130a6b7b --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntRelationsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for HuntRelations List. + */ +public final class HuntRelationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntRelations.json + */ + /** + * Sample code: Get all hunt relations. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllHuntRelations(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.huntRelations() + .list("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", null, null, null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..786fdc5aac4a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.AttackTactic; +import com.azure.resourcemanager.securityinsights.models.HuntOwner; +import com.azure.resourcemanager.securityinsights.models.HypothesisStatus; +import com.azure.resourcemanager.securityinsights.models.Status; +import java.util.Arrays; +import java.util.UUID; + +/** + * Samples for Hunts CreateOrUpdate. + */ +public final class HuntsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/CreateHunt.json + */ + /** + * Sample code: Creates or updates a hunt. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesAHunt(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts() + .define("163e7b2a-a2ec-4041-aaba-d878a38f265f") + .withExistingWorkspace("myRg", "myWorkspace") + .withDisplayName("Log4J new hunt") + .withDescription("Log4J Hunt Description") + .withStatus(Status.NEW) + .withHypothesisStatus(HypothesisStatus.UNKNOWN) + .withAttackTactics(Arrays.asList(AttackTactic.RECONNAISSANCE)) + .withAttackTechniques(Arrays.asList("T1595")) + .withLabels(Arrays.asList("Label1", "Label2")) + .withOwner(new HuntOwner().withObjectId(UUID.fromString("873b5263-5d34-4149-b356-ad341b01e123"))) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsDeleteSamples.java new file mode 100644 index 000000000000..e27ff7d1793e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Hunts Delete. + */ +public final class HuntsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/DeleteHunt.json + */ + /** + * Sample code: Delete a hunt. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAHunt(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts() + .deleteWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsGetSamples.java new file mode 100644 index 000000000000..c28b3331e995 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Hunts Get. + */ +public final class HuntsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHuntById.json + */ + /** + * Sample code: Get a hunt. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAHunt(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts() + .getWithResponse("myRg", "myWorkspace", "163e7b2a-a2ec-4041-aaba-d878a38f265f", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsListSamples.java new file mode 100644 index 000000000000..7123ed10757d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/HuntsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Hunts List. + */ +public final class HuntsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * hunts/GetHunts.json + */ + /** + * Sample code: Get all hunts. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllHunts(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.hunts().list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsCreateOrUpdateSamples.java index 09b68bbc3a3c..509f3b0596ff 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsCreateOrUpdateSamples.java @@ -10,16 +10,16 @@ public final class IncidentCommentsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/CreateIncidentComment.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_CreateOrUpdate.json */ /** - * Sample code: Creates or updates an incident comment. + * Sample code: IncidentComments_CreateOrUpdate. * * @param manager Entry point to SecurityInsightsManager. */ public static void - createsOrUpdatesAnIncidentComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + incidentCommentsCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidentComments() .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") .withExistingIncident("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5") diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsDeleteSamples.java index c998cd9791a6..6e0ddbc91271 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsDeleteSamples.java @@ -10,16 +10,16 @@ public final class IncidentCommentsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/DeleteIncidentComment.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_Delete.json */ /** - * Sample code: Delete the incident comment. + * Sample code: IncidentComments_Delete. * * @param manager Entry point to SecurityInsightsManager. */ public static void - deleteTheIncidentComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + incidentCommentsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidentComments() .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsGetSamples.java index e41671b590db..def9d34383b9 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsGetSamples.java @@ -10,16 +10,15 @@ public final class IncidentCommentsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/GetIncidentCommentById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_Get.json */ /** - * Sample code: Get an incident comment. + * Sample code: IncidentComments_Get. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAnIncidentComment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void incidentCommentsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidentComments() .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsListSamples.java index d52d807a5dad..edea06819177 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsListSamples.java @@ -10,16 +10,16 @@ public final class IncidentCommentsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * comments/GetAllIncidentComments.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentComments/IncidentComments_List.json */ /** - * Sample code: Get all incident comments. + * Sample code: IncidentComments_List. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAllIncidentComments(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + incidentCommentsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidentComments() .list("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", null, null, null, null, com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsCreateOrUpdateSamples.java index ae3cb8dd999b..41a3159e8f9a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsCreateOrUpdateSamples.java @@ -4,14 +4,16 @@ package com.azure.resourcemanager.securityinsights.generated; +import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; + /** * Samples for IncidentRelations CreateOrUpdate. */ public final class IncidentRelationsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/CreateIncidentRelation.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/CreateIncidentRelation.json */ /** * Sample code: Creates or updates an incident relation. @@ -21,10 +23,10 @@ public final class IncidentRelationsCreateOrUpdateSamples { public static void createsOrUpdatesAnIncidentRelation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidentRelations() - .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") - .withExistingIncident("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812") - .withRelatedResourceId( - "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096") - .create(); + .createOrUpdateWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", + new RelationInner().withRelatedResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsDeleteSamples.java index 4d3ace1360e3..d2808a7f0536 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsDeleteSamples.java @@ -10,8 +10,8 @@ public final class IncidentRelationsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/DeleteIncidentRelation.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/DeleteIncidentRelation.json */ /** * Sample code: Delete the incident relation. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsGetSamples.java index 55e51741161d..d23dd1f5c165 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsGetSamples.java @@ -10,8 +10,8 @@ public final class IncidentRelationsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/GetIncidentRelationByName.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/GetIncidentRelationByName.json */ /** * Sample code: Get an incident relation. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsListSamples.java index 045926ddf191..d3ac7a462a59 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsListSamples.java @@ -10,8 +10,8 @@ public final class IncidentRelationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * relations/GetAllIncidentRelations.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/relations/GetAllIncidentRelations.json */ /** * Sample code: Get all incident relations. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a8a46f664d1a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.IncidentTaskStatus; + +/** + * Samples for IncidentTasks CreateOrUpdate. + */ +public final class IncidentTasksCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_CreateOrUpdate.json + */ + /** + * Sample code: IncidentTasks_CreateOrUpdate. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + incidentTasksCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .define("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014") + .withExistingIncident("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5") + .withTitle("Task title") + .withStatus(IncidentTaskStatus.NEW) + .withDescription("Task description") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksDeleteSamples.java new file mode 100644 index 000000000000..193ff1ff595e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for IncidentTasks Delete. + */ +public final class IncidentTasksDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_Delete.json + */ + /** + * Sample code: IncidentTasks_Delete. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void incidentTasksDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksGetSamples.java new file mode 100644 index 000000000000..deab5c3c24fc --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for IncidentTasks Get. + */ +public final class IncidentTasksGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_Get.json + */ + /** + * Sample code: IncidentTasks_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void incidentTasksGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", + "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksListSamples.java new file mode 100644 index 000000000000..9327b29ef4da --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentTasksListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for IncidentTasks List. + */ +public final class IncidentTasksListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentTasks/IncidentTasks_List.json + */ + /** + * Sample code: IncidentTasks_List. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void incidentTasksList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidentTasks() + .list("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsCreateOrUpdateSamples.java index cdba3042eaab..58ee9887c0b9 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsCreateOrUpdateSamples.java @@ -18,30 +18,30 @@ public final class IncidentsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * CreateIncident.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_CreateOrUpdate.json */ /** - * Sample code: Creates or updates an incident. + * Sample code: Incidents_CreateOrUpdate. * * @param manager Entry point to SecurityInsightsManager. */ public static void - createsOrUpdatesAnIncident(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + incidentsCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidents() .define("73e01a99-5cd7-4139-a149-9f2736ff2ab5") .withExistingWorkspace("myRg", "myWorkspace") .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withTitle("My incident") + .withDescription("This is a demo incident") + .withSeverity(IncidentSeverity.HIGH) + .withStatus(IncidentStatus.CLOSED) .withClassification(IncidentClassification.FALSE_POSITIVE) + .withClassificationReason(IncidentClassificationReason.INACCURATE_DATA) .withClassificationComment("Not a malicious activity") - .withClassificationReason(IncidentClassificationReason.INCORRECT_ALERT_LOGIC) - .withDescription("This is a demo incident") + .withOwner(new IncidentOwnerInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) .withFirstActivityTimeUtc(OffsetDateTime.parse("2019-01-01T13:00:30Z")) .withLastActivityTimeUtc(OffsetDateTime.parse("2019-01-01T13:05:30Z")) - .withOwner(new IncidentOwnerInfo().withObjectId(UUID.fromString("2046feea-040d-4a46-9e2b-91c2941bfa70"))) - .withSeverity(IncidentSeverity.HIGH) - .withStatus(IncidentStatus.CLOSED) - .withTitle("My incident") .create(); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsDeleteSamples.java index bc3b337a867c..0602394ba6c3 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsDeleteSamples.java @@ -10,15 +10,15 @@ public final class IncidentsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * DeleteIncident.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_Delete.json */ /** - * Sample code: Delete an incident. + * Sample code: Incidents_Delete. * * @param manager Entry point to SecurityInsightsManager. */ - public static void deleteAnIncident(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void incidentsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidents() .deleteWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsGetSamples.java index f272b107e3a6..486191b37107 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsGetSamples.java @@ -10,15 +10,15 @@ public final class IncidentsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetIncidentById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_Get.json */ /** - * Sample code: Get an incident. + * Sample code: Incidents_Get. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAnIncident(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void incidentsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidents() .getWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListAlertsSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListAlertsSamples.java index b2b197b380a1..88fa8240d5cb 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListAlertsSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListAlertsSamples.java @@ -10,18 +10,17 @@ public final class IncidentsListAlertsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetAllIncidentAlerts.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentAlerts/Incidents_ListAlerts.json */ /** - * Sample code: Get all incident alerts. + * Sample code: Incidents_ListAlerts. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - getAllIncidentAlerts(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void incidentsListAlerts(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidents() - .listAlertsWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + .listAlertsWithResponse("myRg", "myWorkspace", "69a30280-6a4c-4aa7-9af0-5d63f335d600", com.azure.core.util.Context.NONE); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListBookmarksSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListBookmarksSamples.java index 42621babe671..6fe30fcfec82 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListBookmarksSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListBookmarksSamples.java @@ -10,18 +10,18 @@ public final class IncidentsListBookmarksSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetAllIncidentBookmarks.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentBookmarks/Incidents_ListBookmarks.json */ /** - * Sample code: Get all incident bookmarks. + * Sample code: Incidents_ListBookmarks. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getAllIncidentBookmarks(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + incidentsListBookmarks(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidents() - .listBookmarksWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + .listBookmarksWithResponse("myRg", "myWorkspace", "69a30280-6a4c-4aa7-9af0-5d63f335d600", com.azure.core.util.Context.NONE); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListEntitiesSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListEntitiesSamples.java index 05b7d971d993..da00065ebd92 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListEntitiesSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListEntitiesSamples.java @@ -10,18 +10,18 @@ public final class IncidentsListEntitiesSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetAllIncidentEntities.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/IncidentEntities/Incidents_ListEntities.json */ /** - * Sample code: Gets all incident related entities. + * Sample code: Incidents_ListEntities. * * @param manager Entry point to SecurityInsightsManager. */ public static void - getsAllIncidentRelatedEntities(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + incidentsListEntities(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidents() - .listEntitiesWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + .listEntitiesWithResponse("myRg", "myWorkspace", "69a30280-6a4c-4aa7-9af0-5d63f335d600", com.azure.core.util.Context.NONE); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListSamples.java index ba70ea21292b..e1bbeb889ad7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListSamples.java @@ -10,15 +10,15 @@ public final class IncidentsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/incidents/ - * GetIncidents.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * incidents/Incidents_List.json */ /** - * Sample code: Get all incidents. + * Sample code: Incidents_List. * * @param manager Entry point to SecurityInsightsManager. */ - public static void getAllIncidents(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void incidentsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.incidents() .list("myRg", "myWorkspace", null, "properties/createdTimeUtc desc", 1, null, com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsRunPlaybookSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsRunPlaybookSamples.java new file mode 100644 index 000000000000..4f865d232d51 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/IncidentsRunPlaybookSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Incidents RunPlaybook. + */ +public final class IncidentsRunPlaybookSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * manualTrigger/Incidents_RunPlaybook.json + */ + /** + * Sample code: Incidents_RunPlaybook. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + incidentsRunPlaybook(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.incidents() + .runPlaybookWithResponse("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ar4", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataCreateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataCreateSamples.java new file mode 100644 index 000000000000..976e21a0368d --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataCreateSamples.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.Kind; +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataCategories; +import com.azure.resourcemanager.securityinsights.models.MetadataDependencies; +import com.azure.resourcemanager.securityinsights.models.MetadataSource; +import com.azure.resourcemanager.securityinsights.models.MetadataSupport; +import com.azure.resourcemanager.securityinsights.models.Operator; +import com.azure.resourcemanager.securityinsights.models.SourceKind; +import com.azure.resourcemanager.securityinsights.models.SupportTier; +import java.time.LocalDate; +import java.util.Arrays; + +/** + * Samples for Metadata Create. + */ +public final class MetadataCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/PutMetadata.json + */ + /** + * Sample code: Create/update full metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createUpdateFullMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas() + .define("metadataName") + .withExistingWorkspace("myRg", "myWorkspace") + .withContentId("c00ee137-7475-47c8-9cce-ec6f0f1bedd0") + .withParentId( + "/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName") + .withVersion("1.0.0.0") + .withKind("AnalyticsRule") + .withSource(new MetadataSource().withKind(SourceKind.SOLUTION) + .withName("Contoso Solution 1.0") + .withSourceId("b688a130-76f4-4a07-bf57-762222a3cadf")) + .withAuthor(new MetadataAuthor().withName("User Name").withEmail("email@microsoft.com")) + .withSupport(new MetadataSupport().withTier(SupportTier.PARTNER) + .withName("Microsoft") + .withEmail("support@microsoft.com") + .withLink("https://support.microsoft.com/")) + .withDependencies(new MetadataDependencies().withOperator(Operator.fromString("AND")) + .withCriteria(Arrays.asList( + new MetadataDependencies().withOperator(Operator.fromString("OR")) + .withCriteria(Arrays.asList( + new MetadataDependencies().withContentId("045d06d0-ee72-4794-aba4-cf5646e4c756") + .withKind(Kind.DATA_CONNECTOR) + .withName("Microsoft Defender for Endpoint"), + new MetadataDependencies().withContentId("dbfcb2cc-d782-40ef-8d94-fe7af58a6f2d") + .withKind(Kind.DATA_CONNECTOR), + new MetadataDependencies().withContentId("de4dca9b-eb37-47d6-a56f-b8b06b261593") + .withKind(Kind.DATA_CONNECTOR) + .withVersion("2.0"))), + new MetadataDependencies().withContentId("31ee11cc-9989-4de8-b176-5e0ef5c4dbab") + .withKind(Kind.PLAYBOOK) + .withVersion("1.0"), + new MetadataDependencies().withContentId("21ba424a-9438-4444-953a-7059539a7a1b") + .withKind(Kind.PARSER)))) + .withCategories( + new MetadataCategories().withDomains(Arrays.asList("Application", "Security – Insider Threat")) + .withVerticals(Arrays.asList("Healthcare"))) + .withProviders(Arrays.asList("Amazon", "Microsoft")) + .withFirstPublishDate(LocalDate.parse("2021-05-18")) + .withLastPublishDate(LocalDate.parse("2021-05-18")) + .withCustomVersion("1.0") + .withContentSchemaVersion("2.0") + .withThreatAnalysisTactics(Arrays.asList("reconnaissance", "commandandcontrol")) + .withThreatAnalysisTechniques(Arrays.asList("T1548", "T1548.001")) + .withPreviewImages(Arrays.asList("firstImage.png", "secondImage.jpeg")) + .withPreviewImagesDark(Arrays.asList("firstImageDark.png", "secondImageDark.jpeg")) + .create(); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/PutMetadataMinimal.json + */ + /** + * Sample code: Create/update minimal metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createUpdateMinimalMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas() + .define("metadataName") + .withExistingWorkspace("myRg", "myWorkspace") + .withContentId("c00ee137-7475-47c8-9cce-ec6f0f1bedd0") + .withParentId( + "/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName") + .withKind("AnalyticsRule") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataDeleteSamples.java new file mode 100644 index 000000000000..8b75c0fc3f30 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Metadata Delete. + */ +public final class MetadataDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/DeleteMetadata.json + */ + /** + * Sample code: Delete metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().deleteWithResponse("myRg", "myWorkspace", "metadataName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataGetSamples.java new file mode 100644 index 000000000000..72d3ca141e58 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Metadata Get. + */ +public final class MetadataGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/GetMetadata.json + */ + /** + * Sample code: Get single metadata by name. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getSingleMetadataByName(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().getWithResponse("myRg", "myWorkspace", "metadataName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataListSamples.java new file mode 100644 index 000000000000..79c47cb2e12e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataListSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Metadata List. + */ +public final class MetadataListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/GetAllMetadata.json + */ + /** + * Sample code: Get all metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/GetAllMetadataOData.json + */ + /** + * Sample code: Get all metadata with OData filter/orderby/skip/top. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllMetadataWithODataFilterOrderbySkipTop( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.metadatas().list("myRg", "myWorkspace", null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataUpdateSamples.java new file mode 100644 index 000000000000..89cf9e382f8c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/MetadataUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.MetadataAuthor; +import com.azure.resourcemanager.securityinsights.models.MetadataModel; + +/** + * Samples for Metadata Update. + */ +public final class MetadataUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * metadata/PatchMetadata.json + */ + /** + * Sample code: Update metadata. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void updateMetadata(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + MetadataModel resource = manager.metadatas() + .getWithResponse("myRg", "myWorkspace", "metadataName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withAuthor(new MetadataAuthor().withName("User Name").withEmail("email@microsoft.com")) + .apply(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsDeleteSamples.java new file mode 100644 index 000000000000..188b8fb3170f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for OfficeConsents Delete. + */ +public final class OfficeConsentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * officeConsents/DeleteOfficeConsents.json + */ + /** + * Sample code: Delete an office consent. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAnOfficeConsent(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.officeConsents() + .deleteWithResponse("myRg", "myWorkspace", "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsGetSamples.java new file mode 100644 index 000000000000..b86753f6f1be --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for OfficeConsents Get. + */ +public final class OfficeConsentsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * officeConsents/GetOfficeConsentsById.json + */ + /** + * Sample code: Get an office consent. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAnOfficeConsent(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.officeConsents() + .getWithResponse("myRg", "myWorkspace", "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsListSamples.java new file mode 100644 index 000000000000..33be2e03d37a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OfficeConsentsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for OfficeConsents List. + */ +public final class OfficeConsentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * officeConsents/GetOfficeConsents.json + */ + /** + * Sample code: Get all office consents. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllOfficeConsents(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.officeConsents().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OperationsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OperationsListSamples.java index 41a5512b658f..a6aed0b0fe25 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OperationsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/OperationsListSamples.java @@ -10,8 +10,8 @@ public final class OperationsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/operations/ - * ListOperations.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * operations/ListOperations.json */ /** * Sample code: Get all operations. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductPackageOperationGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductPackageOperationGetSamples.java new file mode 100644 index 000000000000..65521767b4dd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductPackageOperationGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ProductPackageOperation Get. + */ +public final class ProductPackageOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetProductPackageById.json + */ + /** + * Sample code: Get a package. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAPackage(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productPackageOperations() + .getWithResponse("myRg", "myWorkspace", "str.azure-sentinel-solution-str", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductPackagesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductPackagesListSamples.java new file mode 100644 index 000000000000..974b1d29e274 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductPackagesListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ProductPackages List. + */ +public final class ProductPackagesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentPackages/GetProductPackages.json + */ + /** + * Sample code: Get all available packages. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllAvailablePackages(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productPackages() + .list("myRg", "myWorkspace", null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsDeleteSamples.java new file mode 100644 index 000000000000..9558d671cdbe --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ProductSettings Delete. + */ +public final class ProductSettingsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/DeleteEyesOnSetting.json + */ + /** + * Sample code: Delete EyesOn settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteEyesOnSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings().deleteWithResponse("myRg", "myWorkspace", "EyesOn", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsGetSamples.java new file mode 100644 index 000000000000..111c7fbeafb0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ProductSettings Get. + */ +public final class ProductSettingsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/GetEyesOnSetting.json + */ + /** + * Sample code: Get EyesOn settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getEyesOnSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings().getWithResponse("myRg", "myWorkspace", "EyesOn", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsListSamples.java new file mode 100644 index 000000000000..fa5621b5ec66 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ProductSettings List. + */ +public final class ProductSettingsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/GetAllSettings.json + */ + /** + * Sample code: Get all settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsUpdateSamples.java new file mode 100644 index 000000000000..86363a51a9b0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductSettingsUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EyesOn; + +/** + * Samples for ProductSettings Update. + */ +public final class ProductSettingsUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * settings/UpdateEyesOnSetting.json + */ + /** + * Sample code: Update EyesOn settings. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + updateEyesOnSettings(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productSettings() + .updateWithResponse("myRg", "myWorkspace", "EyesOn", + new EyesOn().withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\""), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductTemplateOperationGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductTemplateOperationGetSamples.java new file mode 100644 index 000000000000..bcc24911d5bd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductTemplateOperationGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ProductTemplateOperation Get. + */ +public final class ProductTemplateOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetProductTemplateById.json + */ + /** + * Sample code: Get a template. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getATemplate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productTemplateOperations() + .getWithResponse("myRg", "myWorkspace", "8365ebfe-a381-45b7-ad08-7d818070e11f", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductTemplatesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductTemplatesListSamples.java new file mode 100644 index 000000000000..6691c88b844a --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ProductTemplatesListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for ProductTemplates List. + */ +public final class ProductTemplatesListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * contentTemplates/GetProductTemplates.json + */ + /** + * Sample code: Get all installed templates. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllInstalledTemplates(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.productTemplates() + .list("myRg", "myWorkspace", null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ReevaluateRecommendationSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ReevaluateRecommendationSamples.java new file mode 100644 index 000000000000..5389ff05da3e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ReevaluateRecommendationSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import java.util.UUID; + +/** + * Samples for Reevaluate Recommendation. + */ +public final class ReevaluateRecommendationSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/ReevaluateRecommendation.json + */ + /** + * Sample code: Reevaluate a recommendation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + reevaluateARecommendation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.reevaluates() + .recommendationWithResponse("myRg", "myWorkspace", UUID.fromString("6d4b54eb-8684-4aa3-a156-3aa37b8014bc"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ResourceProviderListGeodataByIpSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ResourceProviderListGeodataByIpSamples.java new file mode 100644 index 000000000000..a4b3e2dfa07f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ResourceProviderListGeodataByIpSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EnrichmentIpAddressBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentType; + +/** + * Samples for ResourceProvider ListGeodataByIp. + */ +public final class ResourceProviderListGeodataByIpSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * enrichment/GetGeodataWithWorkspaceByIp.json + */ + /** + * Sample code: Get geodata for a single IP address. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getGeodataForASingleIPAddress(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.resourceProviders() + .listGeodataByIpWithResponse("myRg", "myWorkspace", EnrichmentType.MAIN, + new EnrichmentIpAddressBody().withIpAddress("1.2.3.4"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ResourceProviderListWhoisByDomainSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ResourceProviderListWhoisByDomainSamples.java new file mode 100644 index 000000000000..ad0cd1758a38 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ResourceProviderListWhoisByDomainSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.EnrichmentDomainBody; +import com.azure.resourcemanager.securityinsights.models.EnrichmentType; + +/** + * Samples for ResourceProvider ListWhoisByDomain. + */ +public final class ResourceProviderListWhoisByDomainSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * enrichment/GetWhoisWithWorkspaceByDomainName.json + */ + /** + * Sample code: Get whois information for a single domain name. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getWhoisInformationForASingleDomainName( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.resourceProviders() + .listWhoisByDomainWithResponse("myRg", "myWorkspace", EnrichmentType.MAIN, + new EnrichmentDomainBody().withDomain("microsoft.com"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsCreateOrUpdateSamples.java index 3d203cba89ba..13c9c59dfc8b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsCreateOrUpdateSamples.java @@ -21,7 +21,7 @@ public final class SecurityMLAnalyticsSettingsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * securityMLAnalyticsSettings/CreateAnomalySecurityMLAnalyticsSetting.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDeleteSamples.java index 0be50f1be808..830c68f579e5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDeleteSamples.java @@ -10,7 +10,7 @@ public final class SecurityMLAnalyticsSettingsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsGetSamples.java index dc8c9f7e933e..0c93d80549c7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsGetSamples.java @@ -10,7 +10,7 @@ public final class SecurityMLAnalyticsSettingsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListSamples.java index e34c71af2b90..687fb4dbecfa 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListSamples.java @@ -10,7 +10,7 @@ public final class SecurityMLAnalyticsSettingsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesCreateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesCreateSamples.java index 925c3aac509f..be470335c2f5 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesCreateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesCreateSamples.java @@ -10,7 +10,7 @@ public final class SentinelOnboardingStatesCreateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * onboardingStates/CreateSentinelOnboardingState.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesDeleteSamples.java index 53af5b10c3ff..ed32ff15283d 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesDeleteSamples.java @@ -10,7 +10,7 @@ public final class SentinelOnboardingStatesDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * onboardingStates/DeleteSentinelOnboardingState.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesGetSamples.java index cff543c45898..0f60c8ee608f 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesGetSamples.java @@ -10,7 +10,7 @@ public final class SentinelOnboardingStatesGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * onboardingStates/GetSentinelOnboardingState.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesListSamples.java index c4ed7595c4a2..64a33b1f120e 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesListSamples.java @@ -10,7 +10,7 @@ public final class SentinelOnboardingStatesListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * onboardingStates/GetAllSentinelOnboardingStates.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlListRepositoriesSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlListRepositoriesSamples.java new file mode 100644 index 000000000000..da017dc25e24 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlListRepositoriesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; + +/** + * Samples for SourceControl ListRepositories. + */ +public final class SourceControlListRepositoriesSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * repositories/GetRepositories.json + */ + /** + * Sample code: Get repository list. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getRepositoryList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControls() + .listRepositories("myRg", "myWorkspace", + new RepositoryAccessProperties().withKind(RepositoryAccessKind.OAUTH) + .withCode("fakeTokenPlaceholder") + .withState("state") + .withClientId("54b3c2c0-1f48-4a1c-af9f-6399c3240b73"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationCreateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationCreateSamples.java new file mode 100644 index 000000000000..40fa14ec265e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationCreateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.fluent.models.RepositoryAccess; +import com.azure.resourcemanager.securityinsights.models.ContentType; +import com.azure.resourcemanager.securityinsights.models.RepoType; +import com.azure.resourcemanager.securityinsights.models.Repository; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import java.util.Arrays; + +/** + * Samples for SourceControlsOperation Create. + */ +public final class SourceControlsOperationCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/CreateSourceControl.json + */ + /** + * Sample code: Creates or updates a source control. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsOrUpdatesASourceControl(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations() + .define("789e0c1f-4a3d-43ad-809c-e713b677b04a") + .withExistingWorkspace("myRg", "myWorkspace") + .withDisplayName("My Source Control") + .withRepoType(RepoType.GITHUB) + .withContentTypes(Arrays.asList(ContentType.ANALYTICS_RULE, ContentType.WORKBOOK)) + .withRepository(new Repository().withUrl("https://github.com/user/repo") + .withBranch("master") + .withDisplayUrl("https://github.com/user/repo")) + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withDescription("This is a source control") + .withRepositoryAccess(new RepositoryAccess().withKind(RepositoryAccessKind.OAUTH) + .withCode("fakeTokenPlaceholder") + .withState("state") + .withClientId("54b3c2c0-1f48-4a1c-af9f-6399c3240b73")) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationDeleteSamples.java new file mode 100644 index 000000000000..f3f330c9a359 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationDeleteSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessKind; +import com.azure.resourcemanager.securityinsights.models.RepositoryAccessProperties; + +/** + * Samples for SourceControlsOperation Delete. + */ +public final class SourceControlsOperationDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/DeleteSourceControl.json + */ + /** + * Sample code: Delete a source control. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteASourceControl(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations() + .deleteWithResponse("myRg", "myWorkspace", "789e0c1f-4a3d-43ad-809c-e713b677b04a", + new RepositoryAccessProperties().withKind(RepositoryAccessKind.OAUTH) + .withCode("fakeTokenPlaceholder") + .withState("state") + .withClientId("54b3c2c0-1f48-4a1c-af9f-6399c3240b73"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationGetSamples.java new file mode 100644 index 000000000000..4639101412c0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for SourceControlsOperation Get. + */ +public final class SourceControlsOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/GetSourceControlById.json + */ + /** + * Sample code: Get a source control. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getASourceControl(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations() + .getWithResponse("myRg", "myWorkspace", "789e0c1f-4a3d-43ad-809c-e713b677b04a", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationListSamples.java new file mode 100644 index 000000000000..14c02632de86 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SourceControlsOperationListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for SourceControlsOperation List. + */ +public final class SourceControlsOperationListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * sourcecontrols/GetSourceControls.json + */ + /** + * Sample code: Get all source controls. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllSourceControls(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.sourceControlsOperations().list("myRg", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..5cb7af74e789 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsCreateOrUpdateSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.IngestionType; +import com.azure.resourcemanager.securityinsights.models.Log; +import com.azure.resourcemanager.securityinsights.models.LogStatusType; +import com.azure.resourcemanager.securityinsights.models.LogType; +import com.azure.resourcemanager.securityinsights.models.RfcConnector; +import com.azure.resourcemanager.securityinsights.models.SapAuthenticationType; +import com.azure.resourcemanager.securityinsights.models.SapSystemsConfiguration; +import com.azure.resourcemanager.securityinsights.models.SystemStatusType; +import java.util.Arrays; + +/** + * Samples for Systems CreateOrUpdate. + */ +public final class SystemsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_CreateOrUpdate.json + */ + /** + * Sample code: Systems_CreateOrUpdate. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + systemsCreateOrUpdate(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .define("3d69632b-0b60-4af3-8720-77f01a25d34a") + .withExistingBusinessApplicationAgent("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a") + .withConfiguration(new SapSystemsConfiguration().withAzureResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace") + .withConnector(new RfcConnector().withAbapServerHost("1.1.1.1") + .withSystemNumber("001") + .withSystemId("A4H") + .withClient("001") + .withAuthenticationType(SapAuthenticationType.USERNAME_PASSWORD)) + .withLogs(Arrays.asList( + new Log().withType(LogType.ABAP_AUDIT_LOG) + .withIngestionType(IngestionType.INCREMENTAL) + .withStatus(LogStatusType.ENABLED) + .withScheduleInterval(60) + .withBulkSize(100) + .withFilters(Arrays.asList("filter1", "filter2")), + new Log().withType(LogType.USR01) + .withIngestionType(IngestionType.INCREMENTAL) + .withStatus(LogStatusType.ENABLED) + .withScheduleInterval(60) + .withBulkSize(100) + .withFilters(Arrays.asList("filter1", "filter2"))))) + .withDisplayName("A4H_System") + .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") + .withStatus(SystemStatusType.RUNNING) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsDeleteSamples.java new file mode 100644 index 000000000000..d0c37739b3c7 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Systems Delete. + */ +public final class SystemsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_Delete.json + */ + /** + * Sample code: Systems_Delete. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void systemsDelete(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .deleteWithResponse("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a", + "3d69632b-0b60-4af3-8720-77f01a25d34a", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsGetSamples.java new file mode 100644 index 000000000000..c0cf1df4a950 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Systems Get. + */ +public final class SystemsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_Get.json + */ + /** + * Sample code: Systems_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void systemsGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .getWithResponse("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a", + "3d69632b-0b60-4af3-8720-77f01a25d34a", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsListActionsSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsListActionsSamples.java new file mode 100644 index 000000000000..47581d5fc4ae --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsListActionsSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Systems ListActions. + */ +public final class SystemsListActionsSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/actions/ListActions.json + */ + /** + * Sample code: ListActions. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void listActions(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .listActions("myRg", "myWorkspace", "247b377a-7137-4b3c-bf15-df1d3260ef1b", + "3d69632b-0b60-4af3-8720-77f01a25d34a", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsListSamples.java new file mode 100644 index 000000000000..942de370f274 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Systems List. + */ +public final class SystemsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/systems/Systems_List.json + */ + /** + * Sample code: Systems_List. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void systemsList(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .list("myRg", "myWorkspace", "3123432b-0b60-4af3-8720-77f01a25d34a", null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsReportActionStatusSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsReportActionStatusSamples.java new file mode 100644 index 000000000000..3ac5f2910c98 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsReportActionStatusSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Systems ReportActionStatus. + */ +public final class SystemsReportActionStatusSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/actions/ReportActionStatus.json + */ + /** + * Sample code: ReportActionStatus. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void reportActionStatus(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .reportActionStatusWithResponse("myRg", "myWorkspace", "247b377a-7137-4b3c-bf15-df1d3260ef1b", + "3d69632b-0b60-4af3-8720-77f01a25d34a", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsUndoActionSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsUndoActionSamples.java new file mode 100644 index 000000000000..c4886d714b38 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/SystemsUndoActionSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for Systems UndoAction. + */ +public final class SystemsUndoActionSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * businessApplicationAgents/actions/UndoAction.json + */ + /** + * Sample code: UndoAction. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void undoAction(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.systems() + .undoActionWithResponse("myRg", "myWorkspace", "247b377a-7137-4b3c-bf15-df1d3260ef1b", + "3d69632b-0b60-4af3-8720-77f01a25d34a", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceCountSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceCountSamples.java new file mode 100644 index 000000000000..96743a35da8f --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceCountSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.CountQuery; +import com.azure.resourcemanager.securityinsights.models.TiType; + +/** + * Samples for ThreatIntelligence Count. + */ +public final class ThreatIntelligenceCountSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/PostThreatIntelligenceCount.json + */ + /** + * Sample code: Get TI object count. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getTIObjectCount(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligences() + .countWithResponse("myRg", "myWorkspace", TiType.MAIN, new CountQuery(), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorAppendTagsSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorAppendTagsSamples.java index e7c205388253..a621d13f2b28 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorAppendTagsSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorAppendTagsSamples.java @@ -13,7 +13,7 @@ public final class ThreatIntelligenceIndicatorAppendTagsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/AppendTagsThreatIntelligence.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateIndicatorSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateIndicatorSamples.java index 611b5aafd759..7903d6873f0c 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateIndicatorSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateIndicatorSamples.java @@ -13,7 +13,7 @@ public final class ThreatIntelligenceIndicatorCreateIndicatorSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/CreateThreatIntelligence.json */ /** @@ -39,7 +39,7 @@ public final class ThreatIntelligenceIndicatorCreateIndicatorSamples { .withRevoked(false) .withConfidence(78) .withThreatTypes(Arrays.asList("compromised")) - .withValidFrom("2020-04-15T17:44:00.114052Z") + .withValidFrom("2021-09-15T17:44:00.114052Z") .withValidUntil("") .withModified(""), com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateSamples.java index cc323cb02f19..ee8e52f4a12a 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorCreateSamples.java @@ -13,7 +13,7 @@ public final class ThreatIntelligenceIndicatorCreateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/UpdateThreatIntelligence.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorDeleteSamples.java index 9f8789c93794..dfbbed5d73ef 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorDeleteSamples.java @@ -10,7 +10,7 @@ public final class ThreatIntelligenceIndicatorDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/DeleteThreatIntelligence.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorGetSamples.java index 1e1441f135ce..4a79f1b33756 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorGetSamples.java @@ -10,7 +10,7 @@ public final class ThreatIntelligenceIndicatorGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/GetThreatIntelligenceById.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorMetricsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorMetricsListSamples.java index 28de4c5ff975..942a1b066c21 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorMetricsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorMetricsListSamples.java @@ -10,7 +10,7 @@ public final class ThreatIntelligenceIndicatorMetricsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/CollectThreatIntelligenceMetrics.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorQueryIndicatorsSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorQueryIndicatorsSamples.java index 5e06fda5c85f..6234eaa6c4a9 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorQueryIndicatorsSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorQueryIndicatorsSamples.java @@ -15,7 +15,7 @@ public final class ThreatIntelligenceIndicatorQueryIndicatorsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/QueryThreatIntelligence.json */ /** @@ -29,8 +29,8 @@ public static void queryThreatIntelligenceIndicatorsAsPerFilteringCriteria( .queryIndicators("myRg", "myWorkspace", new ThreatIntelligenceFilteringCriteria().withPageSize(100) .withMinConfidence(25) .withMaxConfidence(80) - .withMinValidUntil("2020-04-05T17:44:00.114052Z") - .withMaxValidUntil("2020-04-25T17:44:00.114052Z") + .withMinValidUntil("2021-04-05T17:44:00.114052Z") + .withMaxValidUntil("2021-04-25T17:44:00.114052Z") .withSortBy(Arrays.asList(new ThreatIntelligenceSortingCriteria().withItemKey("fakeTokenPlaceholder") .withSortOrder(ThreatIntelligenceSortingOrder.DESCENDING))) .withSources(Arrays.asList("Azure Sentinel")), com.azure.core.util.Context.NONE); diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorReplaceTagsSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorReplaceTagsSamples.java index aa9fb4fd0be7..2f91248e4bd4 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorReplaceTagsSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorReplaceTagsSamples.java @@ -13,7 +13,7 @@ public final class ThreatIntelligenceIndicatorReplaceTagsSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/ReplaceTagsThreatIntelligence.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsOperationListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsOperationListSamples.java index ff6deb2c9f5b..84b9dcab3028 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsOperationListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsOperationListSamples.java @@ -10,7 +10,7 @@ public final class ThreatIntelligenceIndicatorsOperationListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/ + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ * threatintelligence/GetThreatIntelligence.json */ /** diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceQuerySamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceQuerySamples.java new file mode 100644 index 000000000000..e081e35ac745 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceQuerySamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.ConditionClause; +import com.azure.resourcemanager.securityinsights.models.Operator; +import com.azure.resourcemanager.securityinsights.models.Query; +import com.azure.resourcemanager.securityinsights.models.QueryCondition; +import com.azure.resourcemanager.securityinsights.models.QuerySortBy; +import com.azure.resourcemanager.securityinsights.models.SortingDirection; +import com.azure.resourcemanager.securityinsights.models.TiType; +import java.util.Arrays; + +/** + * Samples for ThreatIntelligence Query. + */ +public final class ThreatIntelligenceQuerySamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * threatintelligence/PostThreatIntelligenceQuery.json + */ + /** + * Sample code: Get TI objects. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getTIObjects(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.threatIntelligences() + .query("myRg", "myWorkspace", TiType.MAIN, + new Query() + .withCondition(new QueryCondition().withStixObjectType("attack-pattern") + .withClauses(Arrays.asList(new ConditionClause().withField("lastUpdatedTimeUtc") + .withOperator(Operator.ON_OR_BEFORE_ABSOLUTE) + .withValues(Arrays.asList("2024-02-09T23:59:59.999Z"))))) + .withSortBy(new QuerySortBy().withDirection(SortingDirection.DESC).withField("lastUpdatedTimeUtc")) + .withMaxPageSize(100) + .withMinPageSize(100), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/TriggeredAnalyticsRuleRunOperationGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/TriggeredAnalyticsRuleRunOperationGetSamples.java new file mode 100644 index 000000000000..c2066e32ab79 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/TriggeredAnalyticsRuleRunOperationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for TriggeredAnalyticsRuleRunOperation Get. + */ +public final class TriggeredAnalyticsRuleRunOperationGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * triggeredAnalyticsRuleRuns/triggeredAnalyticsRuleRun_Get.json + */ + /** + * Sample code: triggeredAnalyticsRuleRun_Get. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + triggeredAnalyticsRuleRunGet(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.triggeredAnalyticsRuleRunOperations() + .getWithResponse("myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/UpdateRecommendationSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/UpdateRecommendationSamples.java new file mode 100644 index 000000000000..ebbea1a1b7a5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/UpdateRecommendationSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.RecommendationPatch; +import com.azure.resourcemanager.securityinsights.models.RecommendationPatchProperties; +import com.azure.resourcemanager.securityinsights.models.State; +import java.util.UUID; + +/** + * Samples for Update Recommendation. + */ +public final class UpdateRecommendationSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * recommendations/PatchRecommendation.json + */ + /** + * Sample code: Creates a recommendation. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + createsARecommendation(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.updates() + .recommendationWithResponse("myRg", "myWorkspace", UUID.fromString("6d4b54eb-8684-4aa3-a156-3aa37b8014bc"), + new RecommendationPatch().withProperties(new RecommendationPatchProperties().withState(State.ACTIVE)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsCreateOrUpdateSamples.java index ccbe41ad0d15..d0252ce4f0e4 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsCreateOrUpdateSamples.java @@ -14,15 +14,15 @@ public final class WatchlistItemsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * CreateWatchlistItem.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/CreateWatchlistItem.json */ /** - * Sample code: Create or update a watchlist item. + * Sample code: Creates or updates a watchlist item. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createOrUpdateAWatchlistItem( + public static void createsOrUpdatesAWatchlistItem( com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) throws IOException { manager.watchlistItems() .define("82ba292c-dc97-4dfc-969d-d4dd9e666842") diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsDeleteSamples.java index 1f58832ee557..1d1abd7456a9 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsDeleteSamples.java @@ -10,11 +10,11 @@ public final class WatchlistItemsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * DeleteWatchlistItem.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/DeleteWatchlistItem.json */ /** - * Sample code: Delete a watchlist item. + * Sample code: Delete a watchlist Item. * * @param manager Entry point to SecurityInsightsManager. */ diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsGetSamples.java index 0272f5be3087..ee6bf81209a7 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsGetSamples.java @@ -10,8 +10,8 @@ public final class WatchlistItemsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlistItemById.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlistItemById.json */ /** * Sample code: Get a watchlist item. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsListSamples.java index 6ee3e2b0afb6..332abb4449b6 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsListSamples.java @@ -10,8 +10,8 @@ public final class WatchlistItemsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlistItems.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlistItems.json */ /** * Sample code: Get all watchlist Items. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsCreateOrUpdateSamples.java index 24e04549b8fa..4d237b00d3cd 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsCreateOrUpdateSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsCreateOrUpdateSamples.java @@ -4,7 +4,7 @@ package com.azure.resourcemanager.securityinsights.generated; -import com.azure.resourcemanager.securityinsights.models.Source; +import com.azure.resourcemanager.securityinsights.models.SourceType; /** * Samples for Watchlists CreateOrUpdate. @@ -12,52 +12,54 @@ public final class WatchlistsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * CreateWatchlist.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/CreateWatchlistAndWatchlistItems.json */ /** - * Sample code: Create or update a watchlist. + * Sample code: Creates or updates a watchlist and bulk creates watchlist items. * * @param manager Entry point to SecurityInsightsManager. */ - public static void - createOrUpdateAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void createsOrUpdatesAWatchlistAndBulkCreatesWatchlistItems( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.watchlists() .define("highValueAsset") .withExistingWorkspace("myRg", "myWorkspace") .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") .withDisplayName("High Value Assets Watchlist") .withProvider("Microsoft") - .withSource(Source.LOCAL_FILE) + .withSource("watchlist.csv") + .withSourceType(SourceType.LOCAL) .withDescription("Watchlist from CSV content") + .withNumberOfLinesToSkip(1) + .withRawContent("This line will be skipped\nheader1,header2\nvalue1,value2") .withItemsSearchKey("header1") + .withContentType("text/csv") .create(); } /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * CreateWatchlistAndWatchlistItems.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/CreateWatchlist.json */ /** - * Sample code: Create or update a watchlist and bulk creates watchlist items. + * Sample code: Creates or updates a watchlist. * * @param manager Entry point to SecurityInsightsManager. */ - public static void createOrUpdateAWatchlistAndBulkCreatesWatchlistItems( - com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + public static void + createsOrUpdatesAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { manager.watchlists() .define("highValueAsset") .withExistingWorkspace("myRg", "myWorkspace") .withEtag("\"0300bf09-0000-0000-0000-5c37296e0000\"") .withDisplayName("High Value Assets Watchlist") .withProvider("Microsoft") - .withSource(Source.LOCAL_FILE) + .withSource("watchlist.csv") + .withSourceType(SourceType.LOCAL) .withDescription("Watchlist from CSV content") - .withNumberOfLinesToSkip(1) - .withRawContent("This line will be skipped\nheader1,header2\nvalue1,value2") .withItemsSearchKey("header1") - .withContentType("text/csv") .create(); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsDeleteSamples.java index 2ea289724ea9..21cb4cd0634b 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsDeleteSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsDeleteSamples.java @@ -10,8 +10,8 @@ public final class WatchlistsDeleteSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * DeleteWatchlist.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/DeleteWatchlist.json */ /** * Sample code: Delete a watchlist. @@ -19,7 +19,6 @@ public final class WatchlistsDeleteSamples { * @param manager Entry point to SecurityInsightsManager. */ public static void deleteAWatchlist(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { - manager.watchlists() - .deleteWithResponse("myRg", "myWorkspace", "highValueAsset", com.azure.core.util.Context.NONE); + manager.watchlists().delete("myRg", "myWorkspace", "highValueAsset", com.azure.core.util.Context.NONE); } } diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsGetSamples.java index 3907f1f47d47..ff6bcedae986 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsGetSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsGetSamples.java @@ -10,8 +10,8 @@ public final class WatchlistsGetSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlistByAlias.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlistByAlias.json */ /** * Sample code: Get a watchlist. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsListSamples.java index 5b27d8ddc0a1..c73fec831af9 100644 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsListSamples.java +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsListSamples.java @@ -10,8 +10,8 @@ public final class WatchlistsListSamples { /* * x-ms-original-file: - * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2022-11-01/examples/watchlists/ - * GetWatchlists.json + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * watchlists/GetWatchlists.json */ /** * Sample code: Get all watchlists. diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsCreateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsCreateSamples.java new file mode 100644 index 000000000000..1681ed314aa0 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsCreateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerAssignmentJobs Create. + */ +public final class WorkspaceManagerAssignmentJobsCreateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/CreateJob.json + */ + /** + * Sample code: Creates a job for the specified workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsAJobForTheSpecifiedWorkspaceManagerAssignment( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignmentJobs() + .createWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsDeleteSamples.java new file mode 100644 index 000000000000..33fadc3d9088 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerAssignmentJobs Delete. + */ +public final class WorkspaceManagerAssignmentJobsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/DeleteJob.json + */ + /** + * Sample code: Delete a workspace manager job. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWorkspaceManagerJob(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignmentJobs() + .deleteWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + "cfbe1338-8276-4d5d-8b96-931117f9fa0e", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsGetSamples.java new file mode 100644 index 000000000000..0de237a01276 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerAssignmentJobs Get. + */ +public final class WorkspaceManagerAssignmentJobsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetJob.json + */ + /** + * Sample code: Get a workspace manager job. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerJob(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignmentJobs() + .getWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + "cfbe1338-8276-4d5d-8b96-931117f9fa0e", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsListSamples.java new file mode 100644 index 000000000000..00daf5eab196 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentJobsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerAssignmentJobs List. + */ +public final class WorkspaceManagerAssignmentJobsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetAllJobs.json + */ + /** + * Sample code: Get all jobs for the specified Sentinel workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllJobsForTheSpecifiedSentinelWorkspaceManagerAssignment( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignmentJobs() + .list("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", null, null, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..5068030d6d68 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsCreateOrUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.AssignmentItem; +import java.util.Arrays; + +/** + * Samples for WorkspaceManagerAssignments CreateOrUpdate. + */ +public final class WorkspaceManagerAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/CreateOrUpdateWorkspaceManagerAssignment.json + */ + /** + * Sample code: Creates or updates a workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAWorkspaceManagerAssignment( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .define("47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58") + .withExistingWorkspace("myRg", "myWorkspace") + .withTargetResourceName("37207a7a-3b8a-438f-a559-c7df400e1b96") + .withItems(Arrays.asList(new AssignmentItem().withResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspac-es/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExampleOne"), + new AssignmentItem().withResourceId( + "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspac-es/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExampleTwo"))) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsDeleteSamples.java new file mode 100644 index 000000000000..859597f9e8b8 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerAssignments Delete. + */ +public final class WorkspaceManagerAssignmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/DeleteWorkspaceManagerAssignment.json + */ + /** + * Sample code: Delete a workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWorkspaceManagerAssignment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .deleteWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsGetSamples.java new file mode 100644 index 000000000000..177e5c8f8087 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerAssignments Get. + */ +public final class WorkspaceManagerAssignmentsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetWorkspaceManagerAssignment.json + */ + /** + * Sample code: Get a workspace manager assignment. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerAssignment(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .getWithResponse("myRg", "myWorkspace", "47cdc5f5-37c4-47b5-bd5f-83c84b8bdd58", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsListSamples.java new file mode 100644 index 000000000000..7456c838503e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerAssignmentsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerAssignments List. + */ +public final class WorkspaceManagerAssignmentsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerAssignments/GetAllWorkspaceManagerAssignments.json + */ + /** + * Sample code: Get all workspace manager assignments for the Sentinel workspace manager. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllWorkspaceManagerAssignmentsForTheSentinelWorkspaceManager( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerAssignments() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..29f9177983ee --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import com.azure.resourcemanager.securityinsights.models.Mode; + +/** + * Samples for WorkspaceManagerConfigurations CreateOrUpdate. + */ +public final class WorkspaceManagerConfigurationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/CreateOrUpdateWorkspaceManagerConfiguration.json + */ + /** + * Sample code: Create or Update a workspace manager Configuration. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createOrUpdateAWorkspaceManagerConfiguration( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .define("default") + .withExistingWorkspace("myRg", "myWorkspace") + .withMode(Mode.ENABLED) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsDeleteSamples.java new file mode 100644 index 000000000000..c597a7ef7b37 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerConfigurations Delete. + */ +public final class WorkspaceManagerConfigurationsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/DeleteWorkspaceManagerConfiguration.json + */ + /** + * Sample code: Delete a workspace manager configuration. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void deleteAWorkspaceManagerConfiguration( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .deleteWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsGetSamples.java new file mode 100644 index 000000000000..c37a23532c68 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerConfigurations Get. + */ +public final class WorkspaceManagerConfigurationsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/GetWorkspaceManagerConfiguration.json + */ + /** + * Sample code: Get a workspace manager configuration. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerConfiguration(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .getWithResponse("myRg", "myWorkspace", "default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsListSamples.java new file mode 100644 index 000000000000..7f7bf0a8506c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerConfigurationsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerConfigurations List. + */ +public final class WorkspaceManagerConfigurationsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerConfigurations/GetAllWorkspaceManagerConfigurations.json + */ + /** + * Sample code: Get all workspace manager configurations for a Sentinel workspace. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllWorkspaceManagerConfigurationsForASentinelWorkspace( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerConfigurations() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..9d39a9bcadfe --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +import java.util.Arrays; + +/** + * Samples for WorkspaceManagerGroups CreateOrUpdate. + */ +public final class WorkspaceManagerGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/CreateOrUpdateWorkspaceManagerGroup.json + */ + /** + * Sample code: Creates or updates a workspace manager group. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createsOrUpdatesAWorkspaceManagerGroup( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .define("37207a7a-3b8a-438f-a559-c7df400e1b96") + .withExistingWorkspace("myRg", "myWorkspace") + .withDescription("Group of all financial and banking institutions") + .withDisplayName("Banks") + .withMemberResourceNames( + Arrays.asList("afbd324f-6c48-459c-8710-8d1e1cd03812", "f5fa104e-c0e3-4747-9182-d342dc048a9e")) + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsDeleteSamples.java new file mode 100644 index 000000000000..9c6e209e880e --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerGroups Delete. + */ +public final class WorkspaceManagerGroupsDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/DeleteWorkspaceManagerGroup.json + */ + /** + * Sample code: Delete a workspace manager group. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWorkspaceManagerGroup(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .deleteWithResponse("myRg", "myWorkspace", "37207a7a-3b8a-438f-a559-c7df400e1b96", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsGetSamples.java new file mode 100644 index 000000000000..7d37bcd32025 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerGroups Get. + */ +public final class WorkspaceManagerGroupsGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/GetWorkspaceManagerGroup.json + */ + /** + * Sample code: Get a workspace manager group. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerGroup(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .getWithResponse("myRg", "myWorkspace", "37207a7a-3b8a-438f-a559-c7df400e1b96", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsListSamples.java new file mode 100644 index 000000000000..d5d2a07ec5fd --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerGroupsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerGroups List. + */ +public final class WorkspaceManagerGroupsListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerGroups/GetAllWorkspaceManagerGroups.json + */ + /** + * Sample code: Get all workspace manager groups in the Sentinel workspace manager. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void getAllWorkspaceManagerGroupsInTheSentinelWorkspaceManager( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerGroups() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersCreateOrUpdateSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..1f9f71a51fa5 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerMembers CreateOrUpdate. + */ +public final class WorkspaceManagerMembersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/CreateOrUpdateWorkspaceManagerMember.json + */ + /** + * Sample code: Create or Update a workspace manager member. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void createOrUpdateAWorkspaceManagerMember( + com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .define("afbd324f-6c48-459c-8710-8d1e1cd03812") + .withExistingWorkspace("myRg", "myWorkspace") + .withTargetWorkspaceResourceId( + "/subscriptions/7aef9d48-814f-45ad-b644-b0343316e174/resourceGroups/otherRg/providers/Microsoft.OperationalInsights/workspaces/Example_Workspace") + .withTargetWorkspaceTenantId("f676d436-8d16-42db-81b7-ab578e110ccd") + .create(); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersDeleteSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersDeleteSamples.java new file mode 100644 index 000000000000..0d8e65498856 --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerMembers Delete. + */ +public final class WorkspaceManagerMembersDeleteSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/DeleteWorkspaceManagerMember.json + */ + /** + * Sample code: Delete a workspace manager member. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + deleteAWorkspaceManagerMember(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .deleteWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersGetSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersGetSamples.java new file mode 100644 index 000000000000..3a1b3427b06c --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerMembers Get. + */ +public final class WorkspaceManagerMembersGetSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/GetWorkspaceManagerMember.json + */ + /** + * Sample code: Get a workspace manager member. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAWorkspaceManagerMember(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .getWithResponse("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersListSamples.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersListSamples.java new file mode 100644 index 000000000000..e8e8b0160baa --- /dev/null +++ b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/samples/java/com/azure/resourcemanager/securityinsights/generated/WorkspaceManagerMembersListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.securityinsights.generated; + +/** + * Samples for WorkspaceManagerMembers List. + */ +public final class WorkspaceManagerMembersListSamples { + /* + * x-ms-original-file: + * specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2025-04-01-preview/examples/ + * workspaceManagerMembers/GetAllWorkspaceManagerMembers.json + */ + /** + * Sample code: Get all workspace manager members. + * + * @param manager Entry point to SecurityInsightsManager. + */ + public static void + getAllWorkspaceManagerMembers(com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager) { + manager.workspaceManagerMembers() + .list("myRg", "myWorkspace", null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AadDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AadDataConnectorPropertiesTests.java deleted file mode 100644 index 8fef1ce78e2d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AadDataConnectorPropertiesTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AadDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AadDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AadDataConnectorProperties model - = BinaryData.fromString("{\"tenantId\":\"wpgdak\",\"dataTypes\":{\"alerts\":{\"state\":\"Enabled\"}}}") - .toObject(AadDataConnectorProperties.class); - Assertions.assertEquals("wpgdak", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AadDataConnectorProperties model = new AadDataConnectorProperties().withTenantId("wpgdak") - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(AadDataConnectorProperties.class); - Assertions.assertEquals("wpgdak", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AadDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AadDataConnectorTests.java deleted file mode 100644 index 5f51bb0bb229..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AadDataConnectorTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AadDataConnector; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AadDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AadDataConnector model = BinaryData.fromString( - "{\"kind\":\"AzureActiveDirectory\",\"properties\":{\"tenantId\":\"rkywuhpsvfuu\",\"dataTypes\":{\"alerts\":{\"state\":\"Enabled\"}}},\"etag\":\"xxwla\",\"id\":\"iexzsrzpge\",\"name\":\"q\",\"type\":\"yb\"}") - .toObject(AadDataConnector.class); - Assertions.assertEquals("xxwla", model.etag()); - Assertions.assertEquals("rkywuhpsvfuu", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AadDataConnector model = new AadDataConnector().withEtag("xxwla") - .withTenantId("rkywuhpsvfuu") - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(AadDataConnector.class); - Assertions.assertEquals("xxwla", model.etag()); - Assertions.assertEquals("rkywuhpsvfuu", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AatpDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AatpDataConnectorPropertiesTests.java deleted file mode 100644 index 949cf241ab9e..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AatpDataConnectorPropertiesTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AatpDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AatpDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AatpDataConnectorProperties model = BinaryData - .fromString("{\"tenantId\":\"unqndyfpchrqb\",\"dataTypes\":{\"alerts\":{\"state\":\"Disabled\"}}}") - .toObject(AatpDataConnectorProperties.class); - Assertions.assertEquals("unqndyfpchrqb", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AatpDataConnectorProperties model = new AatpDataConnectorProperties().withTenantId("unqndyfpchrqb") - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(AatpDataConnectorProperties.class); - Assertions.assertEquals("unqndyfpchrqb", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AatpDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AatpDataConnectorTests.java deleted file mode 100644 index 6e2d6e277937..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AatpDataConnectorTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AatpDataConnector; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AatpDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AatpDataConnector model = BinaryData.fromString( - "{\"kind\":\"AzureAdvancedThreatProtection\",\"properties\":{\"tenantId\":\"cxkjibnxmysuxswq\",\"dataTypes\":{\"alerts\":{\"state\":\"Enabled\"}}},\"etag\":\"ijpstte\",\"id\":\"qqpwcyyuf\",\"name\":\"hruncuwmq\",\"type\":\"pkcdqzhlct\"}") - .toObject(AatpDataConnector.class); - Assertions.assertEquals("ijpstte", model.etag()); - Assertions.assertEquals("cxkjibnxmysuxswq", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AatpDataConnector model = new AatpDataConnector().withEtag("ijpstte") - .withTenantId("cxkjibnxmysuxswq") - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(AatpDataConnector.class); - Assertions.assertEquals("ijpstte", model.etag()); - Assertions.assertEquals("cxkjibnxmysuxswq", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AccountEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AccountEntityPropertiesTests.java deleted file mode 100644 index cccfa1039e88..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AccountEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AccountEntityProperties; - -public final class AccountEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AccountEntityProperties model = BinaryData.fromString( - "{\"aadTenantId\":\"akoi\",\"aadUserId\":\"nsmjbl\",\"accountName\":\"jhlnymzotqyryu\",\"displayName\":\"bmqqvxmvw\",\"hostEntityId\":\"tayx\",\"isDomainJoined\":false,\"ntDomain\":\"peujlzqn\",\"objectGuid\":\"e11db145-e5d8-4876-a6f6-cfb9fd0e7038\",\"puid\":\"sqltnzo\",\"sid\":\"gsxgnxfyqon\",\"upnSuffix\":\"qoxwd\",\"dnsDomain\":\"dbxiqx\",\"additionalData\":{\"htmwwinh\":\"dataqbi\"},\"friendlyName\":\"f\"}") - .toObject(AccountEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AccountEntityProperties model = new AccountEntityProperties(); - model = BinaryData.fromObject(model).toObject(AccountEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AccountEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AccountEntityTests.java deleted file mode 100644 index bcc9e23c0743..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AccountEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AccountEntity; - -public final class AccountEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AccountEntity model = BinaryData.fromString( - "{\"kind\":\"Account\",\"properties\":{\"aadTenantId\":\"pfhvfslk\",\"aadUserId\":\"tjlrigjksky\",\"accountName\":\"oov\",\"displayName\":\"dsxwaab\",\"hostEntityId\":\"ifrygzn\",\"isDomainJoined\":false,\"ntDomain\":\"ri\",\"objectGuid\":\"16435a79-b22c-4e8b-9883-fdab1dde04b7\",\"puid\":\"obgop\",\"sid\":\"hsln\",\"upnSuffix\":\"xieixynllxec\",\"dnsDomain\":\"rojphslhcawjutif\",\"additionalData\":{\"orq\":\"datamvi\",\"ujeickp\":\"databttzhraglkafhonq\",\"nwcl\":\"datavcpopmxe\",\"xm\":\"datayjede\"},\"friendlyName\":\"mkqscaz\"},\"id\":\"wxtzxpuamwab\",\"name\":\"xrvxcushsphai\",\"type\":\"mxyasflvgsgzw\"}") - .toObject(AccountEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AccountEntity model = new AccountEntity(); - model = BinaryData.fromObject(model).toObject(AccountEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionPropertiesBaseTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionPropertiesBaseTests.java deleted file mode 100644 index c4b2a7073561..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionPropertiesBaseTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ActionPropertiesBase; -import org.junit.jupiter.api.Assertions; - -public final class ActionPropertiesBaseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActionPropertiesBase model - = BinaryData.fromString("{\"logicAppResourceId\":\"atscmd\"}").toObject(ActionPropertiesBase.class); - Assertions.assertEquals("atscmd", model.logicAppResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActionPropertiesBase model = new ActionPropertiesBase().withLogicAppResourceId("atscmd"); - model = BinaryData.fromObject(model).toObject(ActionPropertiesBase.class); - Assertions.assertEquals("atscmd", model.logicAppResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionRequestPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionRequestPropertiesTests.java deleted file mode 100644 index f5f14d8de3b3..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionRequestPropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ActionRequestProperties; -import org.junit.jupiter.api.Assertions; - -public final class ActionRequestPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActionRequestProperties model - = BinaryData.fromString("{\"triggerUri\":\"psoacctazakljl\",\"logicAppResourceId\":\"hbcryffdfdosyge\"}") - .toObject(ActionRequestProperties.class); - Assertions.assertEquals("hbcryffdfdosyge", model.logicAppResourceId()); - Assertions.assertEquals("psoacctazakljl", model.triggerUri()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActionRequestProperties model - = new ActionRequestProperties().withLogicAppResourceId("hbcryffdfdosyge").withTriggerUri("psoacctazakljl"); - model = BinaryData.fromObject(model).toObject(ActionRequestProperties.class); - Assertions.assertEquals("hbcryffdfdosyge", model.logicAppResourceId()); - Assertions.assertEquals("psoacctazakljl", model.triggerUri()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionRequestTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionRequestTests.java deleted file mode 100644 index c07458c028fb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionRequestTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ActionRequest; -import org.junit.jupiter.api.Assertions; - -public final class ActionRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActionRequest model = BinaryData.fromString( - "{\"properties\":{\"triggerUri\":\"jhulsuuvmkjo\",\"logicAppResourceId\":\"k\"},\"etag\":\"f\",\"id\":\"iodjp\",\"name\":\"lwejdpv\",\"type\":\"ryo\"}") - .toObject(ActionRequest.class); - Assertions.assertEquals("f", model.etag()); - Assertions.assertEquals("jhulsuuvmkjo", model.triggerUri()); - Assertions.assertEquals("k", model.logicAppResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActionRequest model - = new ActionRequest().withEtag("f").withTriggerUri("jhulsuuvmkjo").withLogicAppResourceId("k"); - model = BinaryData.fromObject(model).toObject(ActionRequest.class); - Assertions.assertEquals("f", model.etag()); - Assertions.assertEquals("jhulsuuvmkjo", model.triggerUri()); - Assertions.assertEquals("k", model.logicAppResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionResponseInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionResponseInnerTests.java deleted file mode 100644 index d70ac69ea2dc..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionResponseInnerTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ActionResponseInner; -import org.junit.jupiter.api.Assertions; - -public final class ActionResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActionResponseInner model = BinaryData.fromString( - "{\"etag\":\"nhsjcnyej\",\"properties\":{\"workflowId\":\"yhtnapczwlokjye\",\"logicAppResourceId\":\"kkvnipjox\"},\"id\":\"nchgej\",\"name\":\"podmailzydehojwy\",\"type\":\"huxinpmqnj\"}") - .toObject(ActionResponseInner.class); - Assertions.assertEquals("nhsjcnyej", model.etag()); - Assertions.assertEquals("yhtnapczwlokjye", model.workflowId()); - Assertions.assertEquals("kkvnipjox", model.logicAppResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActionResponseInner model = new ActionResponseInner().withEtag("nhsjcnyej") - .withWorkflowId("yhtnapczwlokjye") - .withLogicAppResourceId("kkvnipjox"); - model = BinaryData.fromObject(model).toObject(ActionResponseInner.class); - Assertions.assertEquals("nhsjcnyej", model.etag()); - Assertions.assertEquals("yhtnapczwlokjye", model.workflowId()); - Assertions.assertEquals("kkvnipjox", model.logicAppResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionResponsePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionResponsePropertiesTests.java deleted file mode 100644 index f8be39da3cc4..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionResponsePropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ActionResponseProperties; -import org.junit.jupiter.api.Assertions; - -public final class ActionResponsePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActionResponseProperties model - = BinaryData.fromString("{\"workflowId\":\"wixjsprozvcp\",\"logicAppResourceId\":\"tegjvwmf\"}") - .toObject(ActionResponseProperties.class); - Assertions.assertEquals("tegjvwmf", model.logicAppResourceId()); - Assertions.assertEquals("wixjsprozvcp", model.workflowId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActionResponseProperties model - = new ActionResponseProperties().withLogicAppResourceId("tegjvwmf").withWorkflowId("wixjsprozvcp"); - model = BinaryData.fromObject(model).toObject(ActionResponseProperties.class); - Assertions.assertEquals("tegjvwmf", model.logicAppResourceId()); - Assertions.assertEquals("wixjsprozvcp", model.workflowId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index bc95b547fab7..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.ActionResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ActionsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"etag\":\"zgwldoychillcec\",\"properties\":{\"workflowId\":\"uwaoaguhicqlli\",\"logicAppResourceId\":\"stacsjvhrweftkwq\"},\"id\":\"pmvssehaep\",\"name\":\"a\",\"type\":\"cxtczhupeukn\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ActionResponse response = manager.actions() - .define("mghihp") - .withExistingAlertRule("aupia", "cxnafbwqrooh", "uovmaonurjt") - .withEtag("xigc") - .withTriggerUri("cmslclblyjxltbs") - .withLogicAppResourceId("uscv") - .create(); - - Assertions.assertEquals("zgwldoychillcec", response.etag()); - Assertions.assertEquals("uwaoaguhicqlli", response.workflowId()); - Assertions.assertEquals("stacsjvhrweftkwq", response.logicAppResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsDeleteWithResponseMockTests.java deleted file mode 100644 index 5984cae143f4..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ActionsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.actions().deleteWithResponse("jhqt", "b", "vnynkb", "etnjuhpsprkz", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsGetWithResponseMockTests.java deleted file mode 100644 index 3fc59ce02776..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsGetWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.ActionResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ActionsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"etag\":\"zyvneezaifghtmo\",\"properties\":{\"workflowId\":\"lffhz\",\"logicAppResourceId\":\"krkjjjavf\"},\"id\":\"vhnqo\",\"name\":\"wdogiyetesyp\",\"type\":\"idbz\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ActionResponse response = manager.actions() - .getWithResponse("k", "ctwwgzw", "jlmec", "og", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("zyvneezaifghtmo", response.etag()); - Assertions.assertEquals("lffhz", response.workflowId()); - Assertions.assertEquals("krkjjjavf", response.logicAppResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsListByAlertRuleMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsListByAlertRuleMockTests.java deleted file mode 100644 index 8e0c3e9779eb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsListByAlertRuleMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.ActionResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ActionsListByAlertRuleMockTests { - @Test - public void testListByAlertRule() throws Exception { - String responseStr - = "{\"value\":[{\"etag\":\"sksrfhfvolmknbn\",\"properties\":{\"workflowId\":\"dommpvfqawzfg\",\"logicAppResourceId\":\"rttuiaclkiexha\"},\"id\":\"fnth\",\"name\":\"qfyuttd\",\"type\":\"ygbpvnwswmt\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.actions() - .listByAlertRule("wvqsgny", "uuzivensrpmeyyvp", "patlbijp", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("sksrfhfvolmknbn", response.iterator().next().etag()); - Assertions.assertEquals("dommpvfqawzfg", response.iterator().next().workflowId()); - Assertions.assertEquals("rttuiaclkiexha", response.iterator().next().logicAppResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsListTests.java deleted file mode 100644 index efbf927cd63f..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ActionsListTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ActionResponseInner; -import com.azure.resourcemanager.securityinsights.models.ActionsList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ActionsListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActionsList model = BinaryData.fromString( - "{\"nextLink\":\"jpsq\",\"value\":[{\"etag\":\"poyfdkfogkn\",\"properties\":{\"workflowId\":\"ofjdde\",\"logicAppResourceId\":\"s\"},\"id\":\"eupewnwreitjz\",\"name\":\"flusarhmof\",\"type\":\"qhsmyurkdtml\"},{\"etag\":\"ekuksjtx\",\"properties\":{\"workflowId\":\"dmpa\",\"logicAppResourceId\":\"cryuan\"},\"id\":\"uxzdxtay\",\"name\":\"lhmwhfpmrqobm\",\"type\":\"u\"},{\"etag\":\"nryrtihf\",\"properties\":{\"workflowId\":\"jbpzvgnwzsymg\",\"logicAppResourceId\":\"zufcyzkohdbi\"},\"id\":\"nufhf\",\"name\":\"bj\",\"type\":\"s\"},{\"etag\":\"ithxqhabifpi\",\"properties\":{\"workflowId\":\"czbysc\",\"logicAppResourceId\":\"pqxu\"},\"id\":\"vyq\",\"name\":\"iwbybrkxvdumjg\",\"type\":\"tfwvukxgaudc\"}]}") - .toObject(ActionsList.class); - Assertions.assertEquals("poyfdkfogkn", model.value().get(0).etag()); - Assertions.assertEquals("ofjdde", model.value().get(0).workflowId()); - Assertions.assertEquals("s", model.value().get(0).logicAppResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActionsList model = new ActionsList().withValue(Arrays.asList( - new ActionResponseInner().withEtag("poyfdkfogkn").withWorkflowId("ofjdde").withLogicAppResourceId("s"), - new ActionResponseInner().withEtag("ekuksjtx").withWorkflowId("dmpa").withLogicAppResourceId("cryuan"), - new ActionResponseInner().withEtag("nryrtihf") - .withWorkflowId("jbpzvgnwzsymg") - .withLogicAppResourceId("zufcyzkohdbi"), - new ActionResponseInner().withEtag("ithxqhabifpi") - .withWorkflowId("czbysc") - .withLogicAppResourceId("pqxu"))); - model = BinaryData.fromObject(model).toObject(ActionsList.class); - Assertions.assertEquals("poyfdkfogkn", model.value().get(0).etag()); - Assertions.assertEquals("ofjdde", model.value().get(0).workflowId()); - Assertions.assertEquals("s", model.value().get(0).logicAppResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertDetailsOverrideTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertDetailsOverrideTests.java deleted file mode 100644 index 12e62f1a895c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertDetailsOverrideTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; -import org.junit.jupiter.api.Assertions; - -public final class AlertDetailsOverrideTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AlertDetailsOverride model = BinaryData.fromString( - "{\"alertDisplayNameFormat\":\"xwh\",\"alertDescriptionFormat\":\"nsymoyqhlwigd\",\"alertTacticsColumnName\":\"bkbxgomfa\",\"alertSeverityColumnName\":\"wasqvdaeyyg\"}") - .toObject(AlertDetailsOverride.class); - Assertions.assertEquals("xwh", model.alertDisplayNameFormat()); - Assertions.assertEquals("nsymoyqhlwigd", model.alertDescriptionFormat()); - Assertions.assertEquals("bkbxgomfa", model.alertTacticsColumnName()); - Assertions.assertEquals("wasqvdaeyyg", model.alertSeverityColumnName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AlertDetailsOverride model = new AlertDetailsOverride().withAlertDisplayNameFormat("xwh") - .withAlertDescriptionFormat("nsymoyqhlwigd") - .withAlertTacticsColumnName("bkbxgomfa") - .withAlertSeverityColumnName("wasqvdaeyyg"); - model = BinaryData.fromObject(model).toObject(AlertDetailsOverride.class); - Assertions.assertEquals("xwh", model.alertDisplayNameFormat()); - Assertions.assertEquals("nsymoyqhlwigd", model.alertDescriptionFormat()); - Assertions.assertEquals("bkbxgomfa", model.alertTacticsColumnName()); - Assertions.assertEquals("wasqvdaeyyg", model.alertSeverityColumnName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleInnerTests.java deleted file mode 100644 index 59a9153b1391..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleInnerTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleInner; -import org.junit.jupiter.api.Assertions; - -public final class AlertRuleInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AlertRuleInner model = BinaryData.fromString( - "{\"kind\":\"AlertRule\",\"etag\":\"fpownoizhwlr\",\"id\":\"bqsoqijg\",\"name\":\"dmbpazlobcufpdz\",\"type\":\"rbt\"}") - .toObject(AlertRuleInner.class); - Assertions.assertEquals("fpownoizhwlr", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AlertRuleInner model = new AlertRuleInner().withEtag("fpownoizhwlr"); - model = BinaryData.fromObject(model).toObject(AlertRuleInner.class); - Assertions.assertEquals("fpownoizhwlr", model.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplateDataSourceTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplateDataSourceTests.java deleted file mode 100644 index cfef0f48a77a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplateDataSourceTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AlertRuleTemplateDataSourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AlertRuleTemplateDataSource model = BinaryData - .fromString( - "{\"connectorId\":\"stgktst\",\"dataTypes\":[\"eclze\",\"qbcvhzlhplod\",\"kdl\",\"wqfbumlkxtrqjfsm\"]}") - .toObject(AlertRuleTemplateDataSource.class); - Assertions.assertEquals("stgktst", model.connectorId()); - Assertions.assertEquals("eclze", model.dataTypes().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AlertRuleTemplateDataSource model = new AlertRuleTemplateDataSource().withConnectorId("stgktst") - .withDataTypes(Arrays.asList("eclze", "qbcvhzlhplod", "kdl", "wqfbumlkxtrqjfsm")); - model = BinaryData.fromObject(model).toObject(AlertRuleTemplateDataSource.class); - Assertions.assertEquals("stgktst", model.connectorId()); - Assertions.assertEquals("eclze", model.dataTypes().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplateInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplateInnerTests.java deleted file mode 100644 index fa0aca315f8d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplateInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleTemplateInner; - -public final class AlertRuleTemplateInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AlertRuleTemplateInner model = BinaryData - .fromString( - "{\"kind\":\"AlertRuleTemplate\",\"id\":\"hungbwjzrnf\",\"name\":\"gxg\",\"type\":\"spemvtzfk\"}") - .toObject(AlertRuleTemplateInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AlertRuleTemplateInner model = new AlertRuleTemplateInner(); - model = BinaryData.fromObject(model).toObject(AlertRuleTemplateInner.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesGetWithResponseMockTests.java deleted file mode 100644 index acf17295dcc4..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesGetWithResponseMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplate; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AlertRuleTemplatesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"AlertRuleTemplate\",\"id\":\"ay\",\"name\":\"xbulpzealbmqkyo\",\"type\":\"wyvf\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AlertRuleTemplate response = manager.alertRuleTemplates() - .getWithResponse("nozoeoq", "vjhvefgwbm", "jchnta", com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListMockTests.java deleted file mode 100644 index 4e232f6cd02c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplate; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AlertRuleTemplatesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"kind\":\"AlertRuleTemplate\",\"id\":\"hhulrtywikdm\",\"name\":\"lakuflgbhgauacd\",\"type\":\"xmxufrsryjqgdk\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.alertRuleTemplates().list("jduyyespydjfb", "c", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListTests.java deleted file mode 100644 index 736cac767945..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRuleTemplatesListTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleTemplateInner; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplatesList; -import java.util.Arrays; - -public final class AlertRuleTemplatesListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AlertRuleTemplatesList model = BinaryData.fromString( - "{\"nextLink\":\"aojakhmsbzjhcrz\",\"value\":[{\"kind\":\"AlertRuleTemplate\",\"id\":\"phlxa\",\"name\":\"lthqtrgqjbp\",\"type\":\"zfsinzgvf\"},{\"kind\":\"AlertRuleTemplate\",\"id\":\"rwzoxxjtfelluwf\",\"name\":\"it\",\"type\":\"np\"},{\"kind\":\"AlertRuleTemplate\",\"id\":\"fpjkjlxofp\",\"name\":\"vhpfxxypininmay\",\"type\":\"uybbkpodep\"},{\"kind\":\"AlertRuleTemplate\",\"id\":\"ginuvamih\",\"name\":\"ognarxzxtheotus\",\"type\":\"vyevcciqi\"}]}") - .toObject(AlertRuleTemplatesList.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AlertRuleTemplatesList model - = new AlertRuleTemplatesList().withValue(Arrays.asList(new AlertRuleTemplateInner(), - new AlertRuleTemplateInner(), new AlertRuleTemplateInner(), new AlertRuleTemplateInner())); - model = BinaryData.fromObject(model).toObject(AlertRuleTemplatesList.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index d69dd2fc823d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleInner; -import com.azure.resourcemanager.securityinsights.models.AlertRule; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AlertRulesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"AlertRule\",\"etag\":\"rctat\",\"id\":\"intqpbrlcyr\",\"name\":\"uczkgofxyfsruc\",\"type\":\"crrpcjttbstvje\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AlertRule response = manager.alertRules() - .createOrUpdateWithResponse("xlghieegj", "gvvpasek", "gbuxantuygdh", new AlertRuleInner().withEtag("qipir"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("rctat", response.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesDeleteWithResponseMockTests.java deleted file mode 100644 index 23b9bd8a8df7..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AlertRulesDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.alertRules() - .deleteWithResponse("qnrmvvfko", "mlghktuidvrmazlp", "wwexymzvlazipbh", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesGetWithResponseMockTests.java deleted file mode 100644 index 922535df6c69..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesGetWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AlertRule; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AlertRulesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"AlertRule\",\"etag\":\"sm\",\"id\":\"dlfp\",\"name\":\"apucygvo\",\"type\":\"vyuns\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AlertRule response = manager.alertRules() - .getWithResponse("hmbpyryxamebly", "yvk", "kmrocxne", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("sm", response.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListMockTests.java deleted file mode 100644 index e63fff1e73ec..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AlertRule; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AlertRulesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"kind\":\"AlertRule\",\"etag\":\"jqfutlxj\",\"id\":\"zasunwqrjzfrgq\",\"name\":\"aohcmbuocn\",\"type\":\"r\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.alertRules().list("mizvgbgatzuuvbx", "grebwggahttzlsw", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("jqfutlxj", response.iterator().next().etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListTests.java deleted file mode 100644 index ec8bff7569a1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertRulesListTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleInner; -import com.azure.resourcemanager.securityinsights.models.AlertRulesList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AlertRulesListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AlertRulesList model = BinaryData.fromString( - "{\"nextLink\":\"mhquvgjxp\",\"value\":[{\"kind\":\"AlertRule\",\"etag\":\"zm\",\"id\":\"mtz\",\"name\":\"pbsphrupidgs\",\"type\":\"bb\"},{\"kind\":\"AlertRule\",\"etag\":\"hphoycm\",\"id\":\"ao\",\"name\":\"hdxbmtqio\",\"type\":\"jzehtb\"}]}") - .toObject(AlertRulesList.class); - Assertions.assertEquals("zm", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AlertRulesList model = new AlertRulesList() - .withValue(Arrays.asList(new AlertRuleInner().withEtag("zm"), new AlertRuleInner().withEtag("hphoycm"))); - model = BinaryData.fromObject(model).toObject(AlertRulesList.class); - Assertions.assertEquals("zm", model.value().get(0).etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertsDataTypeOfDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertsDataTypeOfDataConnectorTests.java deleted file mode 100644 index 8b4bac4e8a1e..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AlertsDataTypeOfDataConnectorTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AlertsDataTypeOfDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AlertsDataTypeOfDataConnector model = BinaryData.fromString("{\"alerts\":{\"state\":\"Enabled\"}}") - .toObject(AlertsDataTypeOfDataConnector.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AlertsDataTypeOfDataConnector model = new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED)); - model = BinaryData.fromObject(model).toObject(AlertsDataTypeOfDataConnector.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AnomalySecurityMLAnalyticsSettingsPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AnomalySecurityMLAnalyticsSettingsPropertiesTests.java deleted file mode 100644 index fd590320de39..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AnomalySecurityMLAnalyticsSettingsPropertiesTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AnomalySecurityMLAnalyticsSettingsProperties; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettingsDataSource; -import com.azure.resourcemanager.securityinsights.models.SettingsStatus; -import java.time.Duration; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class AnomalySecurityMLAnalyticsSettingsPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AnomalySecurityMLAnalyticsSettingsProperties model = BinaryData.fromString( - "{\"description\":\"vechndbnwiehole\",\"displayName\":\"jwiuubwefqsfapaq\",\"enabled\":false,\"lastModifiedUtc\":\"2021-10-04T15:26:40Z\",\"requiredDataConnectors\":[{\"connectorId\":\"ex\",\"dataTypes\":[\"fxapjwogqqnobpu\",\"cdabtqwpwya\",\"bzasqbucljgkyexa\",\"guyaip\"]}],\"tactics\":[\"CredentialAccess\",\"PrivilegeEscalation\",\"LateralMovement\"],\"techniques\":[\"xijj\"],\"anomalyVersion\":\"mfqwa\",\"customizableObservations\":\"datanqnm\",\"frequency\":\"PT225H52M14S\",\"settingsStatus\":\"Production\",\"isDefaultSettings\":true,\"anomalySettingsVersion\":878214115,\"settingsDefinitionId\":\"69819be3-f87c-494e-8407-4dae319becce\"}") - .toObject(AnomalySecurityMLAnalyticsSettingsProperties.class); - Assertions.assertEquals("vechndbnwiehole", model.description()); - Assertions.assertEquals("jwiuubwefqsfapaq", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - Assertions.assertEquals("ex", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("fxapjwogqqnobpu", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(AttackTactic.CREDENTIAL_ACCESS, model.tactics().get(0)); - Assertions.assertEquals("xijj", model.techniques().get(0)); - Assertions.assertEquals("mfqwa", model.anomalyVersion()); - Assertions.assertEquals(Duration.parse("PT225H52M14S"), model.frequency()); - Assertions.assertEquals(SettingsStatus.PRODUCTION, model.settingsStatus()); - Assertions.assertEquals(true, model.isDefaultSettings()); - Assertions.assertEquals(878214115, model.anomalySettingsVersion()); - Assertions.assertEquals(UUID.fromString("69819be3-f87c-494e-8407-4dae319becce"), model.settingsDefinitionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AnomalySecurityMLAnalyticsSettingsProperties model = new AnomalySecurityMLAnalyticsSettingsProperties() - .withDescription("vechndbnwiehole") - .withDisplayName("jwiuubwefqsfapaq") - .withEnabled(false) - .withRequiredDataConnectors(Arrays.asList(new SecurityMLAnalyticsSettingsDataSource().withConnectorId("ex") - .withDataTypes(Arrays.asList("fxapjwogqqnobpu", "cdabtqwpwya", "bzasqbucljgkyexa", "guyaip")))) - .withTactics(Arrays.asList(AttackTactic.CREDENTIAL_ACCESS, AttackTactic.PRIVILEGE_ESCALATION, - AttackTactic.LATERAL_MOVEMENT)) - .withTechniques(Arrays.asList("xijj")) - .withAnomalyVersion("mfqwa") - .withCustomizableObservations("datanqnm") - .withFrequency(Duration.parse("PT225H52M14S")) - .withSettingsStatus(SettingsStatus.PRODUCTION) - .withIsDefaultSettings(true) - .withAnomalySettingsVersion(878214115) - .withSettingsDefinitionId(UUID.fromString("69819be3-f87c-494e-8407-4dae319becce")); - model = BinaryData.fromObject(model).toObject(AnomalySecurityMLAnalyticsSettingsProperties.class); - Assertions.assertEquals("vechndbnwiehole", model.description()); - Assertions.assertEquals("jwiuubwefqsfapaq", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - Assertions.assertEquals("ex", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("fxapjwogqqnobpu", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(AttackTactic.CREDENTIAL_ACCESS, model.tactics().get(0)); - Assertions.assertEquals("xijj", model.techniques().get(0)); - Assertions.assertEquals("mfqwa", model.anomalyVersion()); - Assertions.assertEquals(Duration.parse("PT225H52M14S"), model.frequency()); - Assertions.assertEquals(SettingsStatus.PRODUCTION, model.settingsStatus()); - Assertions.assertEquals(true, model.isDefaultSettings()); - Assertions.assertEquals(878214115, model.anomalySettingsVersion()); - Assertions.assertEquals(UUID.fromString("69819be3-f87c-494e-8407-4dae319becce"), model.settingsDefinitionId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AnomalySecurityMLAnalyticsSettingsTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AnomalySecurityMLAnalyticsSettingsTests.java deleted file mode 100644 index b442c0aced3a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AnomalySecurityMLAnalyticsSettingsTests.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AnomalySecurityMLAnalyticsSettings; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettingsDataSource; -import com.azure.resourcemanager.securityinsights.models.SettingsStatus; -import java.time.Duration; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class AnomalySecurityMLAnalyticsSettingsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AnomalySecurityMLAnalyticsSettings model = BinaryData.fromString( - "{\"kind\":\"Anomaly\",\"properties\":{\"description\":\"nqzi\",\"displayName\":\"kfkbgbzbowxeqocl\",\"enabled\":true,\"lastModifiedUtc\":\"2021-01-04T04:03:18Z\",\"requiredDataConnectors\":[{\"connectorId\":\"qkjjeokbz\",\"dataTypes\":[\"zrxcczurt\",\"e\",\"pqxbkwvzgnzvdf\",\"zdix\"]}],\"tactics\":[\"InhibitResponseFunction\"],\"techniques\":[\"d\",\"wopqhewjptmcgs\",\"ostzelndlatu\",\"mzlbiojlvfhrb\"],\"anomalyVersion\":\"pn\",\"customizableObservations\":\"datavcwwyyurmochppr\",\"frequency\":\"PT151H32M19S\",\"settingsStatus\":\"Flighting\",\"isDefaultSettings\":true,\"anomalySettingsVersion\":1135076177,\"settingsDefinitionId\":\"8af64da2-e0a9-4296-9e40-0abb55fb4dc1\"},\"etag\":\"yzejnhlbk\",\"id\":\"z\",\"name\":\"cpilj\",\"type\":\"a\"}") - .toObject(AnomalySecurityMLAnalyticsSettings.class); - Assertions.assertEquals("yzejnhlbk", model.etag()); - Assertions.assertEquals("nqzi", model.description()); - Assertions.assertEquals("kfkbgbzbowxeqocl", model.displayName()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals("qkjjeokbz", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("zrxcczurt", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(AttackTactic.INHIBIT_RESPONSE_FUNCTION, model.tactics().get(0)); - Assertions.assertEquals("d", model.techniques().get(0)); - Assertions.assertEquals("pn", model.anomalyVersion()); - Assertions.assertEquals(Duration.parse("PT151H32M19S"), model.frequency()); - Assertions.assertEquals(SettingsStatus.FLIGHTING, model.settingsStatus()); - Assertions.assertEquals(true, model.isDefaultSettings()); - Assertions.assertEquals(1135076177, model.anomalySettingsVersion()); - Assertions.assertEquals(UUID.fromString("8af64da2-e0a9-4296-9e40-0abb55fb4dc1"), model.settingsDefinitionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AnomalySecurityMLAnalyticsSettings model = new AnomalySecurityMLAnalyticsSettings().withEtag("yzejnhlbk") - .withDescription("nqzi") - .withDisplayName("kfkbgbzbowxeqocl") - .withEnabled(true) - .withRequiredDataConnectors( - Arrays.asList(new SecurityMLAnalyticsSettingsDataSource().withConnectorId("qkjjeokbz") - .withDataTypes(Arrays.asList("zrxcczurt", "e", "pqxbkwvzgnzvdf", "zdix")))) - .withTactics(Arrays.asList(AttackTactic.INHIBIT_RESPONSE_FUNCTION)) - .withTechniques(Arrays.asList("d", "wopqhewjptmcgs", "ostzelndlatu", "mzlbiojlvfhrb")) - .withAnomalyVersion("pn") - .withCustomizableObservations("datavcwwyyurmochppr") - .withFrequency(Duration.parse("PT151H32M19S")) - .withSettingsStatus(SettingsStatus.FLIGHTING) - .withIsDefaultSettings(true) - .withAnomalySettingsVersion(1135076177) - .withSettingsDefinitionId(UUID.fromString("8af64da2-e0a9-4296-9e40-0abb55fb4dc1")); - model = BinaryData.fromObject(model).toObject(AnomalySecurityMLAnalyticsSettings.class); - Assertions.assertEquals("yzejnhlbk", model.etag()); - Assertions.assertEquals("nqzi", model.description()); - Assertions.assertEquals("kfkbgbzbowxeqocl", model.displayName()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals("qkjjeokbz", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("zrxcczurt", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(AttackTactic.INHIBIT_RESPONSE_FUNCTION, model.tactics().get(0)); - Assertions.assertEquals("d", model.techniques().get(0)); - Assertions.assertEquals("pn", model.anomalyVersion()); - Assertions.assertEquals(Duration.parse("PT151H32M19S"), model.frequency()); - Assertions.assertEquals(SettingsStatus.FLIGHTING, model.settingsStatus()); - Assertions.assertEquals(true, model.isDefaultSettings()); - Assertions.assertEquals(1135076177, model.anomalySettingsVersion()); - Assertions.assertEquals(UUID.fromString("8af64da2-e0a9-4296-9e40-0abb55fb4dc1"), model.settingsDefinitionId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AscDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AscDataConnectorPropertiesTests.java deleted file mode 100644 index 7dbc19c6c4f3..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AscDataConnectorPropertiesTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AscDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AscDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AscDataConnectorProperties model - = BinaryData.fromString("{\"subscriptionId\":\"z\",\"dataTypes\":{\"alerts\":{\"state\":\"Enabled\"}}}") - .toObject(AscDataConnectorProperties.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - Assertions.assertEquals("z", model.subscriptionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AscDataConnectorProperties model = new AscDataConnectorProperties() - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))) - .withSubscriptionId("z"); - model = BinaryData.fromObject(model).toObject(AscDataConnectorProperties.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - Assertions.assertEquals("z", model.subscriptionId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AscDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AscDataConnectorTests.java deleted file mode 100644 index 5059c39f922a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AscDataConnectorTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.AscDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AscDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AscDataConnector model = BinaryData.fromString( - "{\"kind\":\"AzureSecurityCenter\",\"properties\":{\"subscriptionId\":\"gydcw\",\"dataTypes\":{\"alerts\":{\"state\":\"Enabled\"}}},\"etag\":\"vqqolih\",\"id\":\"aiouaubrjt\",\"name\":\"oq\",\"type\":\"fuojrngif\"}") - .toObject(AscDataConnector.class); - Assertions.assertEquals("vqqolih", model.etag()); - Assertions.assertEquals("gydcw", model.subscriptionId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AscDataConnector model = new AscDataConnector().withEtag("vqqolih") - .withSubscriptionId("gydcw") - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(AscDataConnector.class); - Assertions.assertEquals("vqqolih", model.etag()); - Assertions.assertEquals("gydcw", model.subscriptionId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleActionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleActionTests.java deleted file mode 100644 index 61358f629285..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleActionTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRuleActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRuleAction model - = BinaryData.fromString("{\"actionType\":\"AutomationRuleAction\",\"order\":967174365}") - .toObject(AutomationRuleAction.class); - Assertions.assertEquals(967174365, model.order()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRuleAction model = new AutomationRuleAction().withOrder(967174365); - model = BinaryData.fromObject(model).toObject(AutomationRuleAction.class); - Assertions.assertEquals(967174365, model.order()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleConditionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleConditionTests.java deleted file mode 100644 index e67be0914405..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleConditionTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleCondition; - -public final class AutomationRuleConditionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRuleCondition model = BinaryData.fromString("{\"conditionType\":\"AutomationRuleCondition\"}") - .toObject(AutomationRuleCondition.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRuleCondition model = new AutomationRuleCondition(); - model = BinaryData.fromObject(model).toObject(AutomationRuleCondition.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleInnerTests.java deleted file mode 100644 index ae4173cba25c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleInnerTests.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AutomationRuleInner; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleCondition; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic; -import com.azure.resourcemanager.securityinsights.models.TriggersOn; -import com.azure.resourcemanager.securityinsights.models.TriggersWhen; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRuleInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRuleInner model = BinaryData.fromString( - "{\"properties\":{\"displayName\":\"fublj\",\"order\":1488023344,\"triggeringLogic\":{\"isEnabled\":true,\"expirationTimeUtc\":\"2021-09-01T11:04:48Z\",\"triggersOn\":\"Alerts\",\"triggersWhen\":\"Created\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"}]},\"actions\":[{\"actionType\":\"AutomationRuleAction\",\"order\":1887671612}],\"lastModifiedTimeUtc\":\"2021-01-23T13:20:17Z\",\"createdTimeUtc\":\"2021-11-28T09:58Z\",\"lastModifiedBy\":{\"email\":\"s\",\"name\":\"smjqulngsntnbyb\",\"objectId\":\"38e16d6d-321d-402d-9e1a-e8ca9de546c2\",\"userPrincipalName\":\"cwrwclxxwrljdous\"},\"createdBy\":{\"email\":\"vkocrcjdkwtn\",\"name\":\"bnjbiksqrglssain\",\"objectId\":\"4c8a18d6-c9d2-4ae9-b3e2-bc30b3b2ec9e\",\"userPrincipalName\":\"wnzlljfmppeeb\"}},\"etag\":\"gxsabkyq\",\"id\":\"ujitcjcz\",\"name\":\"zevndhkrwpdappds\",\"type\":\"dkvwrwjfe\"}") - .toObject(AutomationRuleInner.class); - Assertions.assertEquals("gxsabkyq", model.etag()); - Assertions.assertEquals("fublj", model.displayName()); - Assertions.assertEquals(1488023344, model.order()); - Assertions.assertEquals(true, model.triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-01T11:04:48Z"), - model.triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, model.triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.triggeringLogic().triggersWhen()); - Assertions.assertEquals(1887671612, model.actions().get(0).order()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRuleInner model = new AutomationRuleInner().withEtag("gxsabkyq") - .withDisplayName("fublj") - .withOrder(1488023344) - .withTriggeringLogic(new AutomationRuleTriggeringLogic().withIsEnabled(true) - .withExpirationTimeUtc(OffsetDateTime.parse("2021-09-01T11:04:48Z")) - .withTriggersOn(TriggersOn.ALERTS) - .withTriggersWhen(TriggersWhen.CREATED) - .withConditions(Arrays.asList(new AutomationRuleCondition(), new AutomationRuleCondition(), - new AutomationRuleCondition(), new AutomationRuleCondition()))) - .withActions(Arrays.asList(new AutomationRuleAction().withOrder(1887671612))); - model = BinaryData.fromObject(model).toObject(AutomationRuleInner.class); - Assertions.assertEquals("gxsabkyq", model.etag()); - Assertions.assertEquals("fublj", model.displayName()); - Assertions.assertEquals(1488023344, model.order()); - Assertions.assertEquals(true, model.triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-01T11:04:48Z"), - model.triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, model.triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.triggeringLogic().triggersWhen()); - Assertions.assertEquals(1887671612, model.actions().get(0).order()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleModifyPropertiesActionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleModifyPropertiesActionTests.java deleted file mode 100644 index a07709510c50..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleModifyPropertiesActionTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleModifyPropertiesAction; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentLabel; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentPropertiesAction; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRuleModifyPropertiesActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRuleModifyPropertiesAction model = BinaryData.fromString( - "{\"actionType\":\"ModifyProperties\",\"actionConfiguration\":{\"severity\":\"Informational\",\"status\":\"New\",\"classification\":\"TruePositive\",\"classificationReason\":\"SuspiciousActivity\",\"classificationComment\":\"mrsieekp\",\"owner\":{\"email\":\"aapm\",\"assignedTo\":\"qmeqwigpibudqwyx\",\"objectId\":\"c20b53ae-8fa6-4963-bb1b-69b6dad0a3c5\",\"userPrincipalName\":\"ybpmzznrtffyaq\",\"ownerType\":\"Unknown\"},\"labels\":[{\"labelName\":\"eioqaqhvse\",\"labelType\":\"User\"},{\"labelName\":\"qyrxp\",\"labelType\":\"User\"}]},\"order\":801625089}") - .toObject(AutomationRuleModifyPropertiesAction.class); - Assertions.assertEquals(801625089, model.order()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.actionConfiguration().severity()); - Assertions.assertEquals(IncidentStatus.NEW, model.actionConfiguration().status()); - Assertions.assertEquals(IncidentClassification.TRUE_POSITIVE, model.actionConfiguration().classification()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_ACTIVITY, - model.actionConfiguration().classificationReason()); - Assertions.assertEquals("mrsieekp", model.actionConfiguration().classificationComment()); - Assertions.assertEquals("aapm", model.actionConfiguration().owner().email()); - Assertions.assertEquals("qmeqwigpibudqwyx", model.actionConfiguration().owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("c20b53ae-8fa6-4963-bb1b-69b6dad0a3c5"), - model.actionConfiguration().owner().objectId()); - Assertions.assertEquals("ybpmzznrtffyaq", model.actionConfiguration().owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.UNKNOWN, model.actionConfiguration().owner().ownerType()); - Assertions.assertEquals("eioqaqhvse", model.actionConfiguration().labels().get(0).labelName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRuleModifyPropertiesAction model = new AutomationRuleModifyPropertiesAction().withOrder(801625089) - .withActionConfiguration(new IncidentPropertiesAction().withSeverity(IncidentSeverity.INFORMATIONAL) - .withStatus(IncidentStatus.NEW) - .withClassification(IncidentClassification.TRUE_POSITIVE) - .withClassificationReason(IncidentClassificationReason.SUSPICIOUS_ACTIVITY) - .withClassificationComment("mrsieekp") - .withOwner(new IncidentOwnerInfo().withEmail("aapm") - .withAssignedTo("qmeqwigpibudqwyx") - .withObjectId(UUID.fromString("c20b53ae-8fa6-4963-bb1b-69b6dad0a3c5")) - .withUserPrincipalName("ybpmzznrtffyaq") - .withOwnerType(OwnerType.UNKNOWN)) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("eioqaqhvse"), - new IncidentLabel().withLabelName("qyrxp")))); - model = BinaryData.fromObject(model).toObject(AutomationRuleModifyPropertiesAction.class); - Assertions.assertEquals(801625089, model.order()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.actionConfiguration().severity()); - Assertions.assertEquals(IncidentStatus.NEW, model.actionConfiguration().status()); - Assertions.assertEquals(IncidentClassification.TRUE_POSITIVE, model.actionConfiguration().classification()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_ACTIVITY, - model.actionConfiguration().classificationReason()); - Assertions.assertEquals("mrsieekp", model.actionConfiguration().classificationComment()); - Assertions.assertEquals("aapm", model.actionConfiguration().owner().email()); - Assertions.assertEquals("qmeqwigpibudqwyx", model.actionConfiguration().owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("c20b53ae-8fa6-4963-bb1b-69b6dad0a3c5"), - model.actionConfiguration().owner().objectId()); - Assertions.assertEquals("ybpmzznrtffyaq", model.actionConfiguration().owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.UNKNOWN, model.actionConfiguration().owner().ownerType()); - Assertions.assertEquals("eioqaqhvse", model.actionConfiguration().labels().get(0).labelName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertiesTests.java deleted file mode 100644 index b4e4331bfc54..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertiesTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AutomationRuleProperties; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleCondition; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic; -import com.azure.resourcemanager.securityinsights.models.TriggersOn; -import com.azure.resourcemanager.securityinsights.models.TriggersWhen; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRulePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRuleProperties model = BinaryData.fromString( - "{\"displayName\":\"snhu\",\"order\":470678351,\"triggeringLogic\":{\"isEnabled\":true,\"expirationTimeUtc\":\"2021-03-06T17:49:31Z\",\"triggersOn\":\"Incidents\",\"triggersWhen\":\"Created\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"}]},\"actions\":[{\"actionType\":\"AutomationRuleAction\",\"order\":2022069390},{\"actionType\":\"AutomationRuleAction\",\"order\":1504510608},{\"actionType\":\"AutomationRuleAction\",\"order\":885785432},{\"actionType\":\"AutomationRuleAction\",\"order\":768645194}],\"lastModifiedTimeUtc\":\"2021-10-02T10:39:21Z\",\"createdTimeUtc\":\"2021-10-25T23:35:46Z\",\"lastModifiedBy\":{\"email\":\"hocdgeab\",\"name\":\"phut\",\"objectId\":\"bd58f5da-c08f-41d7-8175-70310ef93f31\",\"userPrincipalName\":\"dvkaozw\"},\"createdBy\":{\"email\":\"tyhxhurokft\",\"name\":\"olniwpwcukjf\",\"objectId\":\"15c99d5c-c1ca-4697-9ad5-89f44fb15f34\",\"userPrincipalName\":\"awxklr\"}}") - .toObject(AutomationRuleProperties.class); - Assertions.assertEquals("snhu", model.displayName()); - Assertions.assertEquals(470678351, model.order()); - Assertions.assertEquals(true, model.triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T17:49:31Z"), - model.triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.INCIDENTS, model.triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.triggeringLogic().triggersWhen()); - Assertions.assertEquals(2022069390, model.actions().get(0).order()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRuleProperties model = new AutomationRuleProperties().withDisplayName("snhu") - .withOrder(470678351) - .withTriggeringLogic(new AutomationRuleTriggeringLogic().withIsEnabled(true) - .withExpirationTimeUtc(OffsetDateTime.parse("2021-03-06T17:49:31Z")) - .withTriggersOn(TriggersOn.INCIDENTS) - .withTriggersWhen(TriggersWhen.CREATED) - .withConditions(Arrays.asList(new AutomationRuleCondition(), new AutomationRuleCondition(), - new AutomationRuleCondition(), new AutomationRuleCondition()))) - .withActions(Arrays.asList(new AutomationRuleAction().withOrder(2022069390), - new AutomationRuleAction().withOrder(1504510608), new AutomationRuleAction().withOrder(885785432), - new AutomationRuleAction().withOrder(768645194))); - model = BinaryData.fromObject(model).toObject(AutomationRuleProperties.class); - Assertions.assertEquals("snhu", model.displayName()); - Assertions.assertEquals(470678351, model.order()); - Assertions.assertEquals(true, model.triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T17:49:31Z"), - model.triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.INCIDENTS, model.triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.triggeringLogic().triggersWhen()); - Assertions.assertEquals(2022069390, model.actions().get(0).order()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyArrayChangedValuesConditionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyArrayChangedValuesConditionTests.java deleted file mode 100644 index 394e63683beb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyArrayChangedValuesConditionTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyArrayChangedConditionSupportedArrayType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyArrayChangedConditionSupportedChangeType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyArrayChangedValuesCondition; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRulePropertyArrayChangedValuesConditionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRulePropertyArrayChangedValuesCondition model - = BinaryData.fromString("{\"arrayType\":\"Comments\",\"changeType\":\"Added\"}") - .toObject(AutomationRulePropertyArrayChangedValuesCondition.class); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedArrayType.COMMENTS, - model.arrayType()); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedChangeType.ADDED, - model.changeType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRulePropertyArrayChangedValuesCondition model - = new AutomationRulePropertyArrayChangedValuesCondition() - .withArrayType(AutomationRulePropertyArrayChangedConditionSupportedArrayType.COMMENTS) - .withChangeType(AutomationRulePropertyArrayChangedConditionSupportedChangeType.ADDED); - model = BinaryData.fromObject(model).toObject(AutomationRulePropertyArrayChangedValuesCondition.class); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedArrayType.COMMENTS, - model.arrayType()); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedChangeType.ADDED, - model.changeType()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyValuesChangedConditionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyValuesChangedConditionTests.java deleted file mode 100644 index ba2b8a8fba2c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyValuesChangedConditionTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyChangedConditionSupportedChangedType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyChangedConditionSupportedPropertyType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyConditionSupportedOperator; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyValuesChangedCondition; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRulePropertyValuesChangedConditionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRulePropertyValuesChangedCondition model = BinaryData.fromString( - "{\"propertyName\":\"IncidentOwner\",\"changeType\":\"ChangedTo\",\"operator\":\"EndsWith\",\"propertyValues\":[\"vjtszcofize\",\"tdhgbjkvrelj\",\"amurvzmlovuan\"]}") - .toObject(AutomationRulePropertyValuesChangedCondition.class); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedPropertyType.INCIDENT_OWNER, - model.propertyName()); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedChangedType.CHANGED_TO, - model.changeType()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.ENDS_WITH, model.operator()); - Assertions.assertEquals("vjtszcofize", model.propertyValues().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRulePropertyValuesChangedCondition model = new AutomationRulePropertyValuesChangedCondition() - .withPropertyName(AutomationRulePropertyChangedConditionSupportedPropertyType.INCIDENT_OWNER) - .withChangeType(AutomationRulePropertyChangedConditionSupportedChangedType.CHANGED_TO) - .withOperator(AutomationRulePropertyConditionSupportedOperator.ENDS_WITH) - .withPropertyValues(Arrays.asList("vjtszcofize", "tdhgbjkvrelj", "amurvzmlovuan")); - model = BinaryData.fromObject(model).toObject(AutomationRulePropertyValuesChangedCondition.class); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedPropertyType.INCIDENT_OWNER, - model.propertyName()); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedChangedType.CHANGED_TO, - model.changeType()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.ENDS_WITH, model.operator()); - Assertions.assertEquals("vjtszcofize", model.propertyValues().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyValuesConditionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyValuesConditionTests.java deleted file mode 100644 index d78f1133c1e6..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulePropertyValuesConditionTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyConditionSupportedOperator; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyConditionSupportedProperty; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyValuesCondition; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRulePropertyValuesConditionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRulePropertyValuesCondition model = BinaryData.fromString( - "{\"propertyName\":\"AccountSid\",\"operator\":\"NotEquals\",\"propertyValues\":[\"mjerbdk\",\"lvidizozs\",\"bccxjmonfdgn\",\"n\"]}") - .toObject(AutomationRulePropertyValuesCondition.class); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedProperty.ACCOUNT_SID, model.propertyName()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.NOT_EQUALS, model.operator()); - Assertions.assertEquals("mjerbdk", model.propertyValues().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRulePropertyValuesCondition model = new AutomationRulePropertyValuesCondition() - .withPropertyName(AutomationRulePropertyConditionSupportedProperty.ACCOUNT_SID) - .withOperator(AutomationRulePropertyConditionSupportedOperator.NOT_EQUALS) - .withPropertyValues(Arrays.asList("mjerbdk", "lvidizozs", "bccxjmonfdgn", "n")); - model = BinaryData.fromObject(model).toObject(AutomationRulePropertyValuesCondition.class); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedProperty.ACCOUNT_SID, model.propertyName()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.NOT_EQUALS, model.operator()); - Assertions.assertEquals("mjerbdk", model.propertyValues().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleRunPlaybookActionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleRunPlaybookActionTests.java deleted file mode 100644 index 9606f2ad3b8c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleRunPlaybookActionTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleRunPlaybookAction; -import com.azure.resourcemanager.securityinsights.models.PlaybookActionProperties; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRuleRunPlaybookActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRuleRunPlaybookAction model = BinaryData.fromString( - "{\"actionType\":\"RunPlaybook\",\"actionConfiguration\":{\"logicAppResourceId\":\"puuw\",\"tenantId\":\"341782c1-abbf-407a-a4de-285633e7341b\"},\"order\":1941131866}") - .toObject(AutomationRuleRunPlaybookAction.class); - Assertions.assertEquals(1941131866, model.order()); - Assertions.assertEquals("puuw", model.actionConfiguration().logicAppResourceId()); - Assertions.assertEquals(UUID.fromString("341782c1-abbf-407a-a4de-285633e7341b"), - model.actionConfiguration().tenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRuleRunPlaybookAction model = new AutomationRuleRunPlaybookAction().withOrder(1941131866) - .withActionConfiguration(new PlaybookActionProperties().withLogicAppResourceId("puuw") - .withTenantId(UUID.fromString("341782c1-abbf-407a-a4de-285633e7341b"))); - model = BinaryData.fromObject(model).toObject(AutomationRuleRunPlaybookAction.class); - Assertions.assertEquals(1941131866, model.order()); - Assertions.assertEquals("puuw", model.actionConfiguration().logicAppResourceId()); - Assertions.assertEquals(UUID.fromString("341782c1-abbf-407a-a4de-285633e7341b"), - model.actionConfiguration().tenantId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleTriggeringLogicTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleTriggeringLogicTests.java deleted file mode 100644 index cf9a430a9de9..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRuleTriggeringLogicTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleCondition; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic; -import com.azure.resourcemanager.securityinsights.models.TriggersOn; -import com.azure.resourcemanager.securityinsights.models.TriggersWhen; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRuleTriggeringLogicTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRuleTriggeringLogic model = BinaryData.fromString( - "{\"isEnabled\":false,\"expirationTimeUtc\":\"2021-07-12T14:06:09Z\",\"triggersOn\":\"Alerts\",\"triggersWhen\":\"Created\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"}]}") - .toObject(AutomationRuleTriggeringLogic.class); - Assertions.assertEquals(false, model.isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-12T14:06:09Z"), model.expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, model.triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.triggersWhen()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRuleTriggeringLogic model = new AutomationRuleTriggeringLogic().withIsEnabled(false) - .withExpirationTimeUtc(OffsetDateTime.parse("2021-07-12T14:06:09Z")) - .withTriggersOn(TriggersOn.ALERTS) - .withTriggersWhen(TriggersWhen.CREATED) - .withConditions(Arrays.asList(new AutomationRuleCondition())); - model = BinaryData.fromObject(model).toObject(AutomationRuleTriggeringLogic.class); - Assertions.assertEquals(false, model.isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-12T14:06:09Z"), model.expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, model.triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.triggersWhen()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index a6a434cf15cf..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AutomationRule; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleCondition; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic; -import com.azure.resourcemanager.securityinsights.models.TriggersOn; -import com.azure.resourcemanager.securityinsights.models.TriggersWhen; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AutomationRulesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"displayName\":\"v\",\"order\":1938856045,\"triggeringLogic\":{\"isEnabled\":true,\"expirationTimeUtc\":\"2021-11-25T05:19:39Z\",\"triggersOn\":\"Incidents\",\"triggersWhen\":\"Updated\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"}]},\"actions\":[{\"actionType\":\"AutomationRuleAction\",\"order\":1192045217}],\"lastModifiedTimeUtc\":\"2021-05-27T17:09:08Z\",\"createdTimeUtc\":\"2021-03-12T14:36:14Z\",\"lastModifiedBy\":{\"email\":\"zutgqztwhghmupg\",\"name\":\"jtcdxabbujftaben\",\"objectId\":\"42efc29e-75ce-45b7-b0d9-52c8c0b6a44c\",\"userPrincipalName\":\"lqpx\"},\"createdBy\":{\"email\":\"afeddwwnlza\",\"name\":\"xud\",\"objectId\":\"75f3e2c4-d29d-41ef-aeb2-f5ffaece5807\",\"userPrincipalName\":\"gookrtalvnb\"}},\"etag\":\"pbeme\",\"id\":\"clvdjjukyrdnqod\",\"name\":\"ahhxhqfaqnvzoqg\",\"type\":\"ipemchgavscz\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AutomationRule response = manager.automationRules() - .define("pt") - .withExistingWorkspace("abzoghktdpyczhco", "ocnhzqrottjzcfyj") - .withDisplayName("rl") - .withOrder(132522705) - .withTriggeringLogic(new AutomationRuleTriggeringLogic().withIsEnabled(false) - .withExpirationTimeUtc(OffsetDateTime.parse("2021-03-15T17:03:59Z")) - .withTriggersOn(TriggersOn.INCIDENTS) - .withTriggersWhen(TriggersWhen.UPDATED) - .withConditions(Arrays.asList(new AutomationRuleCondition(), new AutomationRuleCondition(), - new AutomationRuleCondition()))) - .withActions(Arrays.asList(new AutomationRuleAction().withOrder(1373677319), - new AutomationRuleAction().withOrder(1335089450), new AutomationRuleAction().withOrder(1375742572))) - .withEtag("vcacoyv") - .create(); - - Assertions.assertEquals("pbeme", response.etag()); - Assertions.assertEquals("v", response.displayName()); - Assertions.assertEquals(1938856045, response.order()); - Assertions.assertEquals(true, response.triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-25T05:19:39Z"), - response.triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.INCIDENTS, response.triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.UPDATED, response.triggeringLogic().triggersWhen()); - Assertions.assertEquals(1192045217, response.actions().get(0).order()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesDeleteWithResponseMockTests.java deleted file mode 100644 index 47a7cd3b033b..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesDeleteWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AutomationRulesDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "\"datajpnnbmjksibjgsj\""; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Object response = manager.automationRules() - .deleteWithResponse("t", "ormkfqlwxldyk", "lsygaol", com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesGetWithResponseMockTests.java deleted file mode 100644 index df9b593ea400..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesGetWithResponseMockTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AutomationRule; -import com.azure.resourcemanager.securityinsights.models.TriggersOn; -import com.azure.resourcemanager.securityinsights.models.TriggersWhen; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AutomationRulesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"displayName\":\"jxcjrmmuabwib\",\"order\":1982955250,\"triggeringLogic\":{\"isEnabled\":false,\"expirationTimeUtc\":\"2021-03-07T23:51:24Z\",\"triggersOn\":\"Alerts\",\"triggersWhen\":\"Created\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"}]},\"actions\":[{\"actionType\":\"AutomationRuleAction\",\"order\":164118392},{\"actionType\":\"AutomationRuleAction\",\"order\":1088019488},{\"actionType\":\"AutomationRuleAction\",\"order\":1568139443},{\"actionType\":\"AutomationRuleAction\",\"order\":45684576}],\"lastModifiedTimeUtc\":\"2021-02-25T08:15:11Z\",\"createdTimeUtc\":\"2021-05-22T21:47:24Z\",\"lastModifiedBy\":{\"email\":\"neo\",\"name\":\"fkak\",\"objectId\":\"8774f628-4738-484b-88a7-fc5f3f291ba1\",\"userPrincipalName\":\"dt\"},\"createdBy\":{\"email\":\"boclzhzjknyuxgv\",\"name\":\"xpn\",\"objectId\":\"3e3e771d-9638-4784-813a-c986e2b726c0\",\"userPrincipalName\":\"zaamrdixtrekid\"}},\"etag\":\"yskbruff\",\"id\":\"lukkutvlxhrpqhvm\",\"name\":\"lcouqehbhbcdszir\",\"type\":\"randoypmb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AutomationRule response = manager.automationRules() - .getWithResponse("mbtsuahxsg", "jcmmzrrscub", "wsdrnpxqwodif", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("yskbruff", response.etag()); - Assertions.assertEquals("jxcjrmmuabwib", response.displayName()); - Assertions.assertEquals(1982955250, response.order()); - Assertions.assertEquals(false, response.triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-07T23:51:24Z"), - response.triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, response.triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, response.triggeringLogic().triggersWhen()); - Assertions.assertEquals(164118392, response.actions().get(0).order()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListMockTests.java deleted file mode 100644 index c17876d1a639..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListMockTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AutomationRule; -import com.azure.resourcemanager.securityinsights.models.TriggersOn; -import com.azure.resourcemanager.securityinsights.models.TriggersWhen; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AutomationRulesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"displayName\":\"jkgqxnhmbkez\",\"order\":1006468867,\"triggeringLogic\":{\"isEnabled\":false,\"expirationTimeUtc\":\"2021-09-27T18:55:36Z\",\"triggersOn\":\"Alerts\",\"triggersWhen\":\"Created\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"}]},\"actions\":[{\"actionType\":\"AutomationRuleAction\",\"order\":1703232234},{\"actionType\":\"AutomationRuleAction\",\"order\":2077139001},{\"actionType\":\"AutomationRuleAction\",\"order\":1985576592}],\"lastModifiedTimeUtc\":\"2021-06-09T08:46Z\",\"createdTimeUtc\":\"2021-10-28T20:38:38Z\",\"lastModifiedBy\":{\"email\":\"aawxwfeka\",\"name\":\"rrqmbzmqk\",\"objectId\":\"fbaef790-263f-44ce-ad78-26456bc6dacc\",\"userPrincipalName\":\"bnxwbjsidbirkf\"},\"createdBy\":{\"email\":\"okdgoge\",\"name\":\"jymrhbg\",\"objectId\":\"2c270371-966a-4d29-a522-f6250fd085c2\",\"userPrincipalName\":\"zkye\"}},\"etag\":\"f\",\"id\":\"hhhqosm\",\"name\":\"fjkutycyarnroo\",\"type\":\"g\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.automationRules().list("xxahmrnadzyqegxy", "vpinbmhwbj", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("f", response.iterator().next().etag()); - Assertions.assertEquals("jkgqxnhmbkez", response.iterator().next().displayName()); - Assertions.assertEquals(1006468867, response.iterator().next().order()); - Assertions.assertEquals(false, response.iterator().next().triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-27T18:55:36Z"), - response.iterator().next().triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, response.iterator().next().triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, response.iterator().next().triggeringLogic().triggersWhen()); - Assertions.assertEquals(1703232234, response.iterator().next().actions().get(0).order()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListTests.java deleted file mode 100644 index 2243582b3df1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AutomationRulesListTests.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AutomationRuleInner; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleAction; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleCondition; -import com.azure.resourcemanager.securityinsights.models.AutomationRuleTriggeringLogic; -import com.azure.resourcemanager.securityinsights.models.AutomationRulesList; -import com.azure.resourcemanager.securityinsights.models.TriggersOn; -import com.azure.resourcemanager.securityinsights.models.TriggersWhen; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AutomationRulesListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AutomationRulesList model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"displayName\":\"qkgfgibma\",\"order\":1793250583,\"triggeringLogic\":{\"isEnabled\":false,\"expirationTimeUtc\":\"2021-10-30T15:28:22Z\",\"triggersOn\":\"Alerts\",\"triggersWhen\":\"Created\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"}]},\"actions\":[{\"actionType\":\"AutomationRuleAction\",\"order\":1109303076}],\"lastModifiedTimeUtc\":\"2021-07-21T07:36:15Z\",\"createdTimeUtc\":\"2021-07-27T23:28:20Z\",\"lastModifiedBy\":{\"email\":\"ytb\",\"name\":\"qfou\",\"objectId\":\"d0287df1-f755-4ddd-89a2-445dd4afc6bd\",\"userPrincipalName\":\"mnkzsmod\"},\"createdBy\":{\"email\":\"ougpbkwt\",\"name\":\"tduqktapspwgcuer\",\"objectId\":\"8ae8b4bb-a8b9-40e8-964c-15568742b6ca\",\"userPrincipalName\":\"kdosvqw\"}},\"etag\":\"mdgbbjfdd\",\"id\":\"bmbexppbhtqqro\",\"name\":\"fpfpsalgbquxigj\",\"type\":\"jgzjaoyfhrtx\"},{\"properties\":{\"displayName\":\"lnerkujysvleju\",\"order\":140485038,\"triggeringLogic\":{\"isEnabled\":true,\"expirationTimeUtc\":\"2021-11-11T16:20:30Z\",\"triggersOn\":\"Alerts\",\"triggersWhen\":\"Updated\",\"conditions\":[{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"},{\"conditionType\":\"AutomationRuleCondition\"}]},\"actions\":[{\"actionType\":\"AutomationRuleAction\",\"order\":1106115756},{\"actionType\":\"AutomationRuleAction\",\"order\":1769432566}],\"lastModifiedTimeUtc\":\"2021-05-18T18:45:02Z\",\"createdTimeUtc\":\"2021-08-01T09:30:41Z\",\"lastModifiedBy\":{\"email\":\"xgjvtbv\",\"name\":\"sszdnru\",\"objectId\":\"5b0bfc4f-dd45-4b62-a007-8bd0a965e9a3\",\"userPrincipalName\":\"uhmuouqfprwzwbn\"},\"createdBy\":{\"email\":\"tnwu\",\"name\":\"gazxuf\",\"objectId\":\"bf38305f-e118-4128-8534-7536e0a5076b\",\"userPrincipalName\":\"ckyfih\"}},\"etag\":\"idf\",\"id\":\"wdzuhtymwisd\",\"name\":\"fthwxmnteiwa\",\"type\":\"pvkmijcmmxdcuf\"}],\"nextLink\":\"srp\"}") - .toObject(AutomationRulesList.class); - Assertions.assertEquals("mdgbbjfdd", model.value().get(0).etag()); - Assertions.assertEquals("qkgfgibma", model.value().get(0).displayName()); - Assertions.assertEquals(1793250583, model.value().get(0).order()); - Assertions.assertEquals(false, model.value().get(0).triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-30T15:28:22Z"), - model.value().get(0).triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, model.value().get(0).triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.value().get(0).triggeringLogic().triggersWhen()); - Assertions.assertEquals(1109303076, model.value().get(0).actions().get(0).order()); - Assertions.assertEquals("srp", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AutomationRulesList model = new AutomationRulesList().withValue(Arrays.asList( - new AutomationRuleInner().withEtag("mdgbbjfdd") - .withDisplayName("qkgfgibma") - .withOrder(1793250583) - .withTriggeringLogic(new AutomationRuleTriggeringLogic().withIsEnabled(false) - .withExpirationTimeUtc(OffsetDateTime.parse("2021-10-30T15:28:22Z")) - .withTriggersOn(TriggersOn.ALERTS) - .withTriggersWhen(TriggersWhen.CREATED) - .withConditions(Arrays.asList(new AutomationRuleCondition()))) - .withActions(Arrays.asList(new AutomationRuleAction().withOrder(1109303076))), - new AutomationRuleInner().withEtag("idf") - .withDisplayName("lnerkujysvleju") - .withOrder(140485038) - .withTriggeringLogic(new AutomationRuleTriggeringLogic().withIsEnabled(true) - .withExpirationTimeUtc(OffsetDateTime.parse("2021-11-11T16:20:30Z")) - .withTriggersOn(TriggersOn.ALERTS) - .withTriggersWhen(TriggersWhen.UPDATED) - .withConditions(Arrays.asList(new AutomationRuleCondition(), new AutomationRuleCondition(), - new AutomationRuleCondition(), new AutomationRuleCondition()))) - .withActions(Arrays.asList(new AutomationRuleAction().withOrder(1106115756), - new AutomationRuleAction().withOrder(1769432566))))) - .withNextLink("srp"); - model = BinaryData.fromObject(model).toObject(AutomationRulesList.class); - Assertions.assertEquals("mdgbbjfdd", model.value().get(0).etag()); - Assertions.assertEquals("qkgfgibma", model.value().get(0).displayName()); - Assertions.assertEquals(1793250583, model.value().get(0).order()); - Assertions.assertEquals(false, model.value().get(0).triggeringLogic().isEnabled()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-30T15:28:22Z"), - model.value().get(0).triggeringLogic().expirationTimeUtc()); - Assertions.assertEquals(TriggersOn.ALERTS, model.value().get(0).triggeringLogic().triggersOn()); - Assertions.assertEquals(TriggersWhen.CREATED, model.value().get(0).triggeringLogic().triggersWhen()); - Assertions.assertEquals(1109303076, model.value().get(0).actions().get(0).order()); - Assertions.assertEquals("srp", model.nextLink()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorDataTypesLogsTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorDataTypesLogsTests.java deleted file mode 100644 index bdf0806ae077..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorDataTypesLogsTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnectorDataTypesLogs; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AwsCloudTrailDataConnectorDataTypesLogsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AwsCloudTrailDataConnectorDataTypesLogs model - = BinaryData.fromString("{\"state\":\"Enabled\"}").toObject(AwsCloudTrailDataConnectorDataTypesLogs.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AwsCloudTrailDataConnectorDataTypesLogs model - = new AwsCloudTrailDataConnectorDataTypesLogs().withState(DataTypeState.ENABLED); - model = BinaryData.fromObject(model).toObject(AwsCloudTrailDataConnectorDataTypesLogs.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorDataTypesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorDataTypesTests.java deleted file mode 100644 index 687819625967..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorDataTypesTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnectorDataTypesLogs; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AwsCloudTrailDataConnectorDataTypesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AwsCloudTrailDataConnectorDataTypes model = BinaryData.fromString("{\"logs\":{\"state\":\"Enabled\"}}") - .toObject(AwsCloudTrailDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.logs().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AwsCloudTrailDataConnectorDataTypes model = new AwsCloudTrailDataConnectorDataTypes() - .withLogs(new AwsCloudTrailDataConnectorDataTypesLogs().withState(DataTypeState.ENABLED)); - model = BinaryData.fromObject(model).toObject(AwsCloudTrailDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.logs().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorPropertiesTests.java deleted file mode 100644 index fdc61f797a9c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorPropertiesTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AwsCloudTrailDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnectorDataTypesLogs; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AwsCloudTrailDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AwsCloudTrailDataConnectorProperties model - = BinaryData.fromString("{\"awsRoleArn\":\"bsnmfpph\",\"dataTypes\":{\"logs\":{\"state\":\"Disabled\"}}}") - .toObject(AwsCloudTrailDataConnectorProperties.class); - Assertions.assertEquals("bsnmfpph", model.awsRoleArn()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().logs().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AwsCloudTrailDataConnectorProperties model - = new AwsCloudTrailDataConnectorProperties().withAwsRoleArn("bsnmfpph") - .withDataTypes(new AwsCloudTrailDataConnectorDataTypes() - .withLogs(new AwsCloudTrailDataConnectorDataTypesLogs().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(AwsCloudTrailDataConnectorProperties.class); - Assertions.assertEquals("bsnmfpph", model.awsRoleArn()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().logs().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorTests.java deleted file mode 100644 index 641aba731d93..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AwsCloudTrailDataConnectorTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnector; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.AwsCloudTrailDataConnectorDataTypesLogs; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class AwsCloudTrailDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AwsCloudTrailDataConnector model = BinaryData.fromString( - "{\"kind\":\"AmazonWebServicesCloudTrail\",\"properties\":{\"awsRoleArn\":\"dlyjdf\",\"dataTypes\":{\"logs\":{\"state\":\"Disabled\"}}},\"etag\":\"qufdvruzslzojh\",\"id\":\"tfnmdx\",\"name\":\"tngfdgugeyzihgr\",\"type\":\"yui\"}") - .toObject(AwsCloudTrailDataConnector.class); - Assertions.assertEquals("qufdvruzslzojh", model.etag()); - Assertions.assertEquals("dlyjdf", model.awsRoleArn()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().logs().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AwsCloudTrailDataConnector model = new AwsCloudTrailDataConnector().withEtag("qufdvruzslzojh") - .withAwsRoleArn("dlyjdf") - .withDataTypes(new AwsCloudTrailDataConnectorDataTypes() - .withLogs(new AwsCloudTrailDataConnectorDataTypesLogs().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(AwsCloudTrailDataConnector.class); - Assertions.assertEquals("qufdvruzslzojh", model.etag()); - Assertions.assertEquals("dlyjdf", model.awsRoleArn()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().logs().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AzureResourceEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AzureResourceEntityPropertiesTests.java deleted file mode 100644 index 89ba9adbbfa2..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AzureResourceEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.AzureResourceEntityProperties; - -public final class AzureResourceEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureResourceEntityProperties model = BinaryData.fromString( - "{\"resourceId\":\"ofrzgb\",\"subscriptionId\":\"edm\",\"additionalData\":{\"nsnvpd\":\"datavnlvxbcuiiznktwf\",\"z\":\"databmikost\",\"fy\":\"datakiwbuqnyoph\",\"elfwy\":\"datasgcrpfbcunezzce\"},\"friendlyName\":\"lwxjwetn\"}") - .toObject(AzureResourceEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureResourceEntityProperties model = new AzureResourceEntityProperties(); - model = BinaryData.fromObject(model).toObject(AzureResourceEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AzureResourceEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AzureResourceEntityTests.java deleted file mode 100644 index ea9559a44856..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/AzureResourceEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AzureResourceEntity; - -public final class AzureResourceEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzureResourceEntity model = BinaryData.fromString( - "{\"kind\":\"AzureResource\",\"properties\":{\"resourceId\":\"fvwbcb\",\"subscriptionId\":\"mbnkb\",\"additionalData\":{\"uwfmduragegizvc\":\"datavxkdivqihebwtswb\",\"gbqi\":\"datafelisdjub\"},\"friendlyName\":\"xkbsazgakgac\"},\"id\":\"cmjdmspof\",\"name\":\"pv\",\"type\":\"hryl\"}") - .toObject(AzureResourceEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzureResourceEntity model = new AzureResourceEntity(); - model = BinaryData.fromObject(model).toObject(AzureResourceEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkInnerTests.java deleted file mode 100644 index 9fa0a3a58dc5..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkInnerTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkInner; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class BookmarkInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BookmarkInner model = BinaryData.fromString( - "{\"properties\":{\"created\":\"2021-07-20T05:11Z\",\"createdBy\":{\"email\":\"jtjaodxobnbdxkq\",\"name\":\"okaj\",\"objectId\":\"c1a4425e-086a-4b66-9aee-d404f04561ab\"},\"displayName\":\"npime\",\"labels\":[\"txgcpodgmaajr\",\"vdjwzrlovm\"],\"notes\":\"whijcoejctbza\",\"query\":\"s\",\"queryResult\":\"y\",\"updated\":\"2021-02-18T20:34:43Z\",\"updatedBy\":{\"email\":\"k\",\"name\":\"kdkexxp\",\"objectId\":\"33887cc7-0b9c-4218-a246-cecf4ea52dd4\"},\"eventTime\":\"2021-08-26T06:38:07Z\",\"queryStartTime\":\"2021-05-26T04:34:13Z\",\"queryEndTime\":\"2021-11-01T06:54:57Z\",\"incidentInfo\":{\"incidentId\":\"pg\",\"severity\":\"High\",\"title\":\"c\",\"relationName\":\"xhvpmoue\"}},\"etag\":\"dzxibqeojnxqbzvd\",\"id\":\"t\",\"name\":\"ndei\",\"type\":\"btwnpzaoqvuhrhcf\"}") - .toObject(BookmarkInner.class); - Assertions.assertEquals("dzxibqeojnxqbzvd", model.etag()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-20T05:11Z"), model.created()); - Assertions.assertEquals(UUID.fromString("c1a4425e-086a-4b66-9aee-d404f04561ab"), model.createdBy().objectId()); - Assertions.assertEquals("npime", model.displayName()); - Assertions.assertEquals("txgcpodgmaajr", model.labels().get(0)); - Assertions.assertEquals("whijcoejctbza", model.notes()); - Assertions.assertEquals("s", model.query()); - Assertions.assertEquals("y", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-18T20:34:43Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("33887cc7-0b9c-4218-a246-cecf4ea52dd4"), model.updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-26T06:38:07Z"), model.eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-26T04:34:13Z"), model.queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-01T06:54:57Z"), model.queryEndTime()); - Assertions.assertEquals("pg", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.HIGH, model.incidentInfo().severity()); - Assertions.assertEquals("c", model.incidentInfo().title()); - Assertions.assertEquals("xhvpmoue", model.incidentInfo().relationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BookmarkInner model = new BookmarkInner().withEtag("dzxibqeojnxqbzvd") - .withCreated(OffsetDateTime.parse("2021-07-20T05:11Z")) - .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("c1a4425e-086a-4b66-9aee-d404f04561ab"))) - .withDisplayName("npime") - .withLabels(Arrays.asList("txgcpodgmaajr", "vdjwzrlovm")) - .withNotes("whijcoejctbza") - .withQuery("s") - .withQueryResult("y") - .withUpdated(OffsetDateTime.parse("2021-02-18T20:34:43Z")) - .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("33887cc7-0b9c-4218-a246-cecf4ea52dd4"))) - .withEventTime(OffsetDateTime.parse("2021-08-26T06:38:07Z")) - .withQueryStartTime(OffsetDateTime.parse("2021-05-26T04:34:13Z")) - .withQueryEndTime(OffsetDateTime.parse("2021-11-01T06:54:57Z")) - .withIncidentInfo(new IncidentInfo().withIncidentId("pg") - .withSeverity(IncidentSeverity.HIGH) - .withTitle("c") - .withRelationName("xhvpmoue")); - model = BinaryData.fromObject(model).toObject(BookmarkInner.class); - Assertions.assertEquals("dzxibqeojnxqbzvd", model.etag()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-20T05:11Z"), model.created()); - Assertions.assertEquals(UUID.fromString("c1a4425e-086a-4b66-9aee-d404f04561ab"), model.createdBy().objectId()); - Assertions.assertEquals("npime", model.displayName()); - Assertions.assertEquals("txgcpodgmaajr", model.labels().get(0)); - Assertions.assertEquals("whijcoejctbza", model.notes()); - Assertions.assertEquals("s", model.query()); - Assertions.assertEquals("y", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-18T20:34:43Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("33887cc7-0b9c-4218-a246-cecf4ea52dd4"), model.updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-26T06:38:07Z"), model.eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-26T04:34:13Z"), model.queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-01T06:54:57Z"), model.queryEndTime()); - Assertions.assertEquals("pg", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.HIGH, model.incidentInfo().severity()); - Assertions.assertEquals("c", model.incidentInfo().title()); - Assertions.assertEquals("xhvpmoue", model.incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkListTests.java deleted file mode 100644 index 3caba526dc5d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkListTests.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkInner; -import com.azure.resourcemanager.securityinsights.models.BookmarkList; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class BookmarkListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BookmarkList model = BinaryData.fromString( - "{\"nextLink\":\"zidnsezcxtbzsgfy\",\"value\":[{\"properties\":{\"created\":\"2021-04-28T14:26:37Z\",\"createdBy\":{\"email\":\"dwzjeiach\",\"name\":\"osfln\",\"objectId\":\"0296629a-3485-4e09-9e99-92d0788328ba\"},\"displayName\":\"sfqpteehz\",\"labels\":[\"pyqr\",\"mzinpvswjdk\",\"rsoodqxhcrmnoh\"],\"notes\":\"ckwhds\",\"query\":\"ifiyipjxsqwpgrj\",\"queryResult\":\"norcjxvsnbyxqab\",\"updated\":\"2021-01-31T04:10:32Z\",\"updatedBy\":{\"email\":\"cyshurzafbljjgp\",\"name\":\"oq\",\"objectId\":\"40d76acc-6403-4303-9e1c-377f943dd4e0\"},\"eventTime\":\"2021-08-23T17:30:32Z\",\"queryStartTime\":\"2021-06-12T13:13:31Z\",\"queryEndTime\":\"2021-09-28T22:54:32Z\",\"incidentInfo\":{\"incidentId\":\"idtqajzyu\",\"severity\":\"Low\",\"title\":\"dj\",\"relationName\":\"lkhbz\"}},\"etag\":\"epgzgqexz\",\"id\":\"c\",\"name\":\"scpai\",\"type\":\"rhhbcs\"}]}") - .toObject(BookmarkList.class); - Assertions.assertEquals("epgzgqexz", model.value().get(0).etag()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-28T14:26:37Z"), model.value().get(0).created()); - Assertions.assertEquals(UUID.fromString("0296629a-3485-4e09-9e99-92d0788328ba"), - model.value().get(0).createdBy().objectId()); - Assertions.assertEquals("sfqpteehz", model.value().get(0).displayName()); - Assertions.assertEquals("pyqr", model.value().get(0).labels().get(0)); - Assertions.assertEquals("ckwhds", model.value().get(0).notes()); - Assertions.assertEquals("ifiyipjxsqwpgrj", model.value().get(0).query()); - Assertions.assertEquals("norcjxvsnbyxqab", model.value().get(0).queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T04:10:32Z"), model.value().get(0).updated()); - Assertions.assertEquals(UUID.fromString("40d76acc-6403-4303-9e1c-377f943dd4e0"), - model.value().get(0).updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-23T17:30:32Z"), model.value().get(0).eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-12T13:13:31Z"), model.value().get(0).queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-28T22:54:32Z"), model.value().get(0).queryEndTime()); - Assertions.assertEquals("idtqajzyu", model.value().get(0).incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.LOW, model.value().get(0).incidentInfo().severity()); - Assertions.assertEquals("dj", model.value().get(0).incidentInfo().title()); - Assertions.assertEquals("lkhbz", model.value().get(0).incidentInfo().relationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BookmarkList model = new BookmarkList().withValue(Arrays.asList(new BookmarkInner().withEtag("epgzgqexz") - .withCreated(OffsetDateTime.parse("2021-04-28T14:26:37Z")) - .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("0296629a-3485-4e09-9e99-92d0788328ba"))) - .withDisplayName("sfqpteehz") - .withLabels(Arrays.asList("pyqr", "mzinpvswjdk", "rsoodqxhcrmnoh")) - .withNotes("ckwhds") - .withQuery("ifiyipjxsqwpgrj") - .withQueryResult("norcjxvsnbyxqab") - .withUpdated(OffsetDateTime.parse("2021-01-31T04:10:32Z")) - .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("40d76acc-6403-4303-9e1c-377f943dd4e0"))) - .withEventTime(OffsetDateTime.parse("2021-08-23T17:30:32Z")) - .withQueryStartTime(OffsetDateTime.parse("2021-06-12T13:13:31Z")) - .withQueryEndTime(OffsetDateTime.parse("2021-09-28T22:54:32Z")) - .withIncidentInfo(new IncidentInfo().withIncidentId("idtqajzyu") - .withSeverity(IncidentSeverity.LOW) - .withTitle("dj") - .withRelationName("lkhbz")))); - model = BinaryData.fromObject(model).toObject(BookmarkList.class); - Assertions.assertEquals("epgzgqexz", model.value().get(0).etag()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-28T14:26:37Z"), model.value().get(0).created()); - Assertions.assertEquals(UUID.fromString("0296629a-3485-4e09-9e99-92d0788328ba"), - model.value().get(0).createdBy().objectId()); - Assertions.assertEquals("sfqpteehz", model.value().get(0).displayName()); - Assertions.assertEquals("pyqr", model.value().get(0).labels().get(0)); - Assertions.assertEquals("ckwhds", model.value().get(0).notes()); - Assertions.assertEquals("ifiyipjxsqwpgrj", model.value().get(0).query()); - Assertions.assertEquals("norcjxvsnbyxqab", model.value().get(0).queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-31T04:10:32Z"), model.value().get(0).updated()); - Assertions.assertEquals(UUID.fromString("40d76acc-6403-4303-9e1c-377f943dd4e0"), - model.value().get(0).updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-23T17:30:32Z"), model.value().get(0).eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-12T13:13:31Z"), model.value().get(0).queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-28T22:54:32Z"), model.value().get(0).queryEndTime()); - Assertions.assertEquals("idtqajzyu", model.value().get(0).incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.LOW, model.value().get(0).incidentInfo().severity()); - Assertions.assertEquals("dj", model.value().get(0).incidentInfo().title()); - Assertions.assertEquals("lkhbz", model.value().get(0).incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkPropertiesTests.java deleted file mode 100644 index ed28d9d892f1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarkPropertiesTests.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.BookmarkProperties; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class BookmarkPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BookmarkProperties model = BinaryData.fromString( - "{\"created\":\"2021-05-08T13:34:52Z\",\"createdBy\":{\"email\":\"glmjth\",\"name\":\"kw\",\"objectId\":\"2465c5c0-6f86-4f84-ba3f-59023614fb30\"},\"displayName\":\"eicxmqciwqvhkhi\",\"labels\":[\"gdtopbobjogh\",\"e\",\"u\"],\"notes\":\"a\",\"query\":\"hrzayvvtpgvdf\",\"queryResult\":\"otkftutqxlngx\",\"updated\":\"2021-12-03T02:20:16Z\",\"updatedBy\":{\"email\":\"gnxkrxdqmidtth\",\"name\":\"vqdra\",\"objectId\":\"edee10b2-5f55-4ab1-994a-208bf16c1919\"},\"eventTime\":\"2021-09-24T23:35:33Z\",\"queryStartTime\":\"2021-09-14T02:51:19Z\",\"queryEndTime\":\"2021-06-25T18:07:24Z\",\"incidentInfo\":{\"incidentId\":\"qfbow\",\"severity\":\"Informational\",\"title\":\"yktz\",\"relationName\":\"u\"}}") - .toObject(BookmarkProperties.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-08T13:34:52Z"), model.created()); - Assertions.assertEquals(UUID.fromString("2465c5c0-6f86-4f84-ba3f-59023614fb30"), model.createdBy().objectId()); - Assertions.assertEquals("eicxmqciwqvhkhi", model.displayName()); - Assertions.assertEquals("gdtopbobjogh", model.labels().get(0)); - Assertions.assertEquals("a", model.notes()); - Assertions.assertEquals("hrzayvvtpgvdf", model.query()); - Assertions.assertEquals("otkftutqxlngx", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T02:20:16Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("edee10b2-5f55-4ab1-994a-208bf16c1919"), model.updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-24T23:35:33Z"), model.eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-14T02:51:19Z"), model.queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-25T18:07:24Z"), model.queryEndTime()); - Assertions.assertEquals("qfbow", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.incidentInfo().severity()); - Assertions.assertEquals("yktz", model.incidentInfo().title()); - Assertions.assertEquals("u", model.incidentInfo().relationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BookmarkProperties model = new BookmarkProperties().withCreated(OffsetDateTime.parse("2021-05-08T13:34:52Z")) - .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("2465c5c0-6f86-4f84-ba3f-59023614fb30"))) - .withDisplayName("eicxmqciwqvhkhi") - .withLabels(Arrays.asList("gdtopbobjogh", "e", "u")) - .withNotes("a") - .withQuery("hrzayvvtpgvdf") - .withQueryResult("otkftutqxlngx") - .withUpdated(OffsetDateTime.parse("2021-12-03T02:20:16Z")) - .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("edee10b2-5f55-4ab1-994a-208bf16c1919"))) - .withEventTime(OffsetDateTime.parse("2021-09-24T23:35:33Z")) - .withQueryStartTime(OffsetDateTime.parse("2021-09-14T02:51:19Z")) - .withQueryEndTime(OffsetDateTime.parse("2021-06-25T18:07:24Z")) - .withIncidentInfo(new IncidentInfo().withIncidentId("qfbow") - .withSeverity(IncidentSeverity.INFORMATIONAL) - .withTitle("yktz") - .withRelationName("u")); - model = BinaryData.fromObject(model).toObject(BookmarkProperties.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-08T13:34:52Z"), model.created()); - Assertions.assertEquals(UUID.fromString("2465c5c0-6f86-4f84-ba3f-59023614fb30"), model.createdBy().objectId()); - Assertions.assertEquals("eicxmqciwqvhkhi", model.displayName()); - Assertions.assertEquals("gdtopbobjogh", model.labels().get(0)); - Assertions.assertEquals("a", model.notes()); - Assertions.assertEquals("hrzayvvtpgvdf", model.query()); - Assertions.assertEquals("otkftutqxlngx", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T02:20:16Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("edee10b2-5f55-4ab1-994a-208bf16c1919"), model.updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-24T23:35:33Z"), model.eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-14T02:51:19Z"), model.queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-25T18:07:24Z"), model.queryEndTime()); - Assertions.assertEquals("qfbow", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.incidentInfo().severity()); - Assertions.assertEquals("yktz", model.incidentInfo().title()); - Assertions.assertEquals("u", model.incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index c49772bfaa9c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Bookmark; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BookmarksCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"created\":\"2021-06-02T10:49:39Z\",\"createdBy\":{\"email\":\"jj\",\"name\":\"ybwfdbkjb\",\"objectId\":\"7c87954f-318a-4af8-a0a9-ee6bfdd4d195\"},\"displayName\":\"ensvkzykjtj\",\"labels\":[\"xfwush\",\"dpkupnqrmgjf\",\"pkuwxeoioj\"],\"notes\":\"zfav\",\"query\":\"jzwfb\",\"queryResult\":\"aykmmf\",\"updated\":\"2021-10-29T00:02:40Z\",\"updatedBy\":{\"email\":\"xrzxmdewsrsxkrp\",\"name\":\"jazejwwviyoyp\",\"objectId\":\"aa116b26-98f9-41fc-8b37-b5ba791f653a\"},\"eventTime\":\"2021-03-21T06:31:37Z\",\"queryStartTime\":\"2021-02-25T20:04:53Z\",\"queryEndTime\":\"2021-09-20T22:56:33Z\",\"incidentInfo\":{\"incidentId\":\"sqwjhqkbiwetpozy\",\"severity\":\"Informational\",\"title\":\"qyhgf\",\"relationName\":\"tzlexbs\"}},\"etag\":\"e\",\"id\":\"no\",\"name\":\"pziuwfbzkkdtnh\",\"type\":\"sycljsel\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Bookmark response = manager.bookmarks() - .define("a") - .withExistingWorkspace("qyv", "eh") - .withEtag("eslk") - .withCreated(OffsetDateTime.parse("2021-11-16T18:17:43Z")) - .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("622c50a3-4b55-4566-a757-18bded4e2909"))) - .withDisplayName("imipskdyzatvfuz") - .withLabels(Arrays.asList("tjvv", "uxwigsyeipqdsm", "tgrqgdgkkile", "lkcsmknhwtbbae")) - .withNotes("rvvmqfloygb") - .withQuery("gwumgxdgdhpa") - .withQueryResult("dexjddvjs") - .withUpdated(OffsetDateTime.parse("2021-10-15T10:21:04Z")) - .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("2c0be9fc-ea00-4fe5-9b7f-028f20d18d5c"))) - .withEventTime(OffsetDateTime.parse("2021-10-07T17:44:14Z")) - .withQueryStartTime(OffsetDateTime.parse("2021-05-27T02:17:12Z")) - .withQueryEndTime(OffsetDateTime.parse("2021-06-27T11:48:43Z")) - .withIncidentInfo(new IncidentInfo().withIncidentId("hv") - .withSeverity(IncidentSeverity.INFORMATIONAL) - .withTitle("ek") - .withRelationName("eksnbksdqhjvyk")) - .create(); - - Assertions.assertEquals("e", response.etag()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-02T10:49:39Z"), response.created()); - Assertions.assertEquals(UUID.fromString("7c87954f-318a-4af8-a0a9-ee6bfdd4d195"), - response.createdBy().objectId()); - Assertions.assertEquals("ensvkzykjtj", response.displayName()); - Assertions.assertEquals("xfwush", response.labels().get(0)); - Assertions.assertEquals("zfav", response.notes()); - Assertions.assertEquals("jzwfb", response.query()); - Assertions.assertEquals("aykmmf", response.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T00:02:40Z"), response.updated()); - Assertions.assertEquals(UUID.fromString("aa116b26-98f9-41fc-8b37-b5ba791f653a"), - response.updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-21T06:31:37Z"), response.eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-25T20:04:53Z"), response.queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-20T22:56:33Z"), response.queryEndTime()); - Assertions.assertEquals("sqwjhqkbiwetpozy", response.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, response.incidentInfo().severity()); - Assertions.assertEquals("qyhgf", response.incidentInfo().title()); - Assertions.assertEquals("tzlexbs", response.incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksDeleteWithResponseMockTests.java deleted file mode 100644 index be5cca42452d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksDeleteWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BookmarksDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.bookmarks().deleteWithResponse("smzhhkuuipldqqct", "kva", "blhtjq", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksGetWithResponseMockTests.java deleted file mode 100644 index a964c41b21a2..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksGetWithResponseMockTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Bookmark; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BookmarksGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"created\":\"2021-03-25T08:01:58Z\",\"createdBy\":{\"email\":\"xkdtxfkndlqvtwkn\",\"name\":\"mmbugtywatmqaq\",\"objectId\":\"d60ac3c4-a9b4-4c1e-9e2c-4e140d6e95fb\"},\"displayName\":\"eatgroeshoy\",\"labels\":[\"byfqxkfaoy\",\"ehqpuvjmvqmt\"],\"notes\":\"ckygroejnndljdju\",\"query\":\"kb\",\"queryResult\":\"eqy\",\"updated\":\"2021-11-21T07:30:22Z\",\"updatedBy\":{\"email\":\"sfaq\",\"name\":\"pl\",\"objectId\":\"3007627c-3a7e-491b-acc7-c6cc1366c31d\"},\"eventTime\":\"2021-11-04T02:30:34Z\",\"queryStartTime\":\"2020-12-21T02:35:09Z\",\"queryEndTime\":\"2021-09-25T21:50:21Z\",\"incidentInfo\":{\"incidentId\":\"bxgkqusy\",\"severity\":\"Low\",\"title\":\"dacarvvlfnty\",\"relationName\":\"poi\"}},\"etag\":\"naz\",\"id\":\"ohzrsqalsx\",\"name\":\"dnwqapfg\",\"type\":\"dpcve\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Bookmark response = manager.bookmarks() - .getWithResponse("hvyeldotj", "dkwisw", "kukjtasb", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("naz", response.etag()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-25T08:01:58Z"), response.created()); - Assertions.assertEquals(UUID.fromString("d60ac3c4-a9b4-4c1e-9e2c-4e140d6e95fb"), - response.createdBy().objectId()); - Assertions.assertEquals("eatgroeshoy", response.displayName()); - Assertions.assertEquals("byfqxkfaoy", response.labels().get(0)); - Assertions.assertEquals("ckygroejnndljdju", response.notes()); - Assertions.assertEquals("kb", response.query()); - Assertions.assertEquals("eqy", response.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-21T07:30:22Z"), response.updated()); - Assertions.assertEquals(UUID.fromString("3007627c-3a7e-491b-acc7-c6cc1366c31d"), - response.updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T02:30:34Z"), response.eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-21T02:35:09Z"), response.queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-25T21:50:21Z"), response.queryEndTime()); - Assertions.assertEquals("bxgkqusy", response.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.LOW, response.incidentInfo().severity()); - Assertions.assertEquals("dacarvvlfnty", response.incidentInfo().title()); - Assertions.assertEquals("poi", response.incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksListMockTests.java deleted file mode 100644 index 665a8c0e13ae..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/BookmarksListMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Bookmark; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BookmarksListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"created\":\"2021-11-16T18:34:33Z\",\"createdBy\":{\"email\":\"wjjstliuhqa\",\"name\":\"oaiancznvodrrs\",\"objectId\":\"dc6948c0-897f-4ea2-b171-d197ed89bc8b\"},\"displayName\":\"lxydkxrxv\",\"labels\":[\"iwkgfbqljnq\",\"hychocokuleh\",\"rqlrqffawe\"],\"notes\":\"rkphyjdxr\",\"query\":\"vjuqdbrxmrgchb\",\"queryResult\":\"xk\",\"updated\":\"2021-01-07T08:52:04Z\",\"updatedBy\":{\"email\":\"kbajbu\",\"name\":\"gd\",\"objectId\":\"e0d696a9-4ac3-4e52-a75f-0a4c35f7e486\"},\"eventTime\":\"2021-07-19T21:01:06Z\",\"queryStartTime\":\"2021-03-11T15:48:32Z\",\"queryEndTime\":\"2021-08-21T01:03:20Z\",\"incidentInfo\":{\"incidentId\":\"vpmclujyxkyxlz\",\"severity\":\"High\",\"title\":\"kzzltafhbzf\",\"relationName\":\"vwmbjlzqsczpg\"}},\"etag\":\"wnapfdq\",\"id\":\"wf\",\"name\":\"ptnuwjtkschgc\",\"type\":\"qyhleseyq\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.bookmarks().list("ejdtxptl", "h", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("wnapfdq", response.iterator().next().etag()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-16T18:34:33Z"), response.iterator().next().created()); - Assertions.assertEquals(UUID.fromString("dc6948c0-897f-4ea2-b171-d197ed89bc8b"), - response.iterator().next().createdBy().objectId()); - Assertions.assertEquals("lxydkxrxv", response.iterator().next().displayName()); - Assertions.assertEquals("iwkgfbqljnq", response.iterator().next().labels().get(0)); - Assertions.assertEquals("rkphyjdxr", response.iterator().next().notes()); - Assertions.assertEquals("vjuqdbrxmrgchb", response.iterator().next().query()); - Assertions.assertEquals("xk", response.iterator().next().queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-07T08:52:04Z"), response.iterator().next().updated()); - Assertions.assertEquals(UUID.fromString("e0d696a9-4ac3-4e52-a75f-0a4c35f7e486"), - response.iterator().next().updatedBy().objectId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-19T21:01:06Z"), response.iterator().next().eventTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-11T15:48:32Z"), - response.iterator().next().queryStartTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-21T01:03:20Z"), - response.iterator().next().queryEndTime()); - Assertions.assertEquals("vpmclujyxkyxlz", response.iterator().next().incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.HIGH, response.iterator().next().incidentInfo().severity()); - Assertions.assertEquals("kzzltafhbzf", response.iterator().next().incidentInfo().title()); - Assertions.assertEquals("vwmbjlzqsczpg", response.iterator().next().incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ClientInfoTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ClientInfoTests.java deleted file mode 100644 index be6d3ec4a3fa..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ClientInfoTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ClientInfo; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class ClientInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClientInfo model = BinaryData.fromString( - "{\"email\":\"ypnddhsgcb\",\"name\":\"phejkotynqgoulz\",\"objectId\":\"e8d52ac3-8832-42e0-9085-4ca135c7369f\",\"userPrincipalName\":\"i\"}") - .toObject(ClientInfo.class); - Assertions.assertEquals("ypnddhsgcb", model.email()); - Assertions.assertEquals("phejkotynqgoulz", model.name()); - Assertions.assertEquals(UUID.fromString("e8d52ac3-8832-42e0-9085-4ca135c7369f"), model.objectId()); - Assertions.assertEquals("i", model.userPrincipalName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClientInfo model = new ClientInfo().withEmail("ypnddhsgcb") - .withName("phejkotynqgoulz") - .withObjectId(UUID.fromString("e8d52ac3-8832-42e0-9085-4ca135c7369f")) - .withUserPrincipalName("i"); - model = BinaryData.fromObject(model).toObject(ClientInfo.class); - Assertions.assertEquals("ypnddhsgcb", model.email()); - Assertions.assertEquals("phejkotynqgoulz", model.name()); - Assertions.assertEquals(UUID.fromString("e8d52ac3-8832-42e0-9085-4ca135c7369f"), model.objectId()); - Assertions.assertEquals("i", model.userPrincipalName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/CloudApplicationEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/CloudApplicationEntityPropertiesTests.java deleted file mode 100644 index 535beccf7a23..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/CloudApplicationEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.CloudApplicationEntityProperties; - -public final class CloudApplicationEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CloudApplicationEntityProperties model = BinaryData.fromString( - "{\"appId\":1918015991,\"appName\":\"hkfkimrtixokf\",\"instanceName\":\"yinljqe\",\"additionalData\":{\"monstshiyxgve\":\"datahi\",\"wcobie\":\"datafclduccbirdsv\",\"gshejjtbxqmulux\":\"datastmninwjizcilng\"},\"friendlyName\":\"qzvnersbycucr\"}") - .toObject(CloudApplicationEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CloudApplicationEntityProperties model = new CloudApplicationEntityProperties(); - model = BinaryData.fromObject(model).toObject(CloudApplicationEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/CloudApplicationEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/CloudApplicationEntityTests.java deleted file mode 100644 index 7eefb192a045..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/CloudApplicationEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.CloudApplicationEntity; - -public final class CloudApplicationEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CloudApplicationEntity model = BinaryData.fromString( - "{\"kind\":\"CloudApplication\",\"properties\":{\"appId\":1420965357,\"appName\":\"lafzvaylptr\",\"instanceName\":\"qwztcmwqkc\",\"additionalData\":{\"xfdeqvhpsyl\":\"datawaxfewzjkj\",\"bffmbmxz\":\"dataksh\",\"jx\":\"datargywwp\"},\"friendlyName\":\"ptfujgicgaaoept\"},\"id\":\"qutdewemxs\",\"name\":\"vru\",\"type\":\"nz\"}") - .toObject(CloudApplicationEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CloudApplicationEntity model = new CloudApplicationEntity(); - model = BinaryData.fromObject(model).toObject(CloudApplicationEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDataTypeCommonTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDataTypeCommonTests.java deleted file mode 100644 index 0c5ff0f456d6..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorDataTypeCommonTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class DataConnectorDataTypeCommonTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DataConnectorDataTypeCommon model - = BinaryData.fromString("{\"state\":\"Enabled\"}").toObject(DataConnectorDataTypeCommon.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DataConnectorDataTypeCommon model = new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED); - model = BinaryData.fromObject(model).toObject(DataConnectorDataTypeCommon.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorInnerTests.java deleted file mode 100644 index 579b5ac92354..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorInnerTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; -import org.junit.jupiter.api.Assertions; - -public final class DataConnectorInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DataConnectorInner model = BinaryData.fromString( - "{\"kind\":\"DataConnector\",\"etag\":\"masxazjpqyegu\",\"id\":\"hb\",\"name\":\"xhejjzzvdud\",\"type\":\"wdslfhotwmcy\"}") - .toObject(DataConnectorInner.class); - Assertions.assertEquals("masxazjpqyegu", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DataConnectorInner model = new DataConnectorInner().withEtag("masxazjpqyegu"); - model = BinaryData.fromObject(model).toObject(DataConnectorInner.class); - Assertions.assertEquals("masxazjpqyegu", model.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorListTests.java deleted file mode 100644 index fbe497efe9c0..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorListTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; -import com.azure.resourcemanager.securityinsights.models.DataConnectorList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DataConnectorListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DataConnectorList model = BinaryData.fromString( - "{\"nextLink\":\"xlzevgbmqjqabcy\",\"value\":[{\"kind\":\"DataConnector\",\"etag\":\"vkwlzuvccfwnf\",\"id\":\"acfi\",\"name\":\"nlebxetqgtzxd\",\"type\":\"nqbqqwxr\"},{\"kind\":\"DataConnector\",\"etag\":\"eallnwsubisnj\",\"id\":\"pmng\",\"name\":\"zscxaqwo\",\"type\":\"chcbonqvpkvlrxnj\"},{\"kind\":\"DataConnector\",\"etag\":\"seiphe\",\"id\":\"lokeyy\",\"name\":\"enjbdlwtgrhp\",\"type\":\"jp\"}]}") - .toObject(DataConnectorList.class); - Assertions.assertEquals("vkwlzuvccfwnf", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DataConnectorList model - = new DataConnectorList().withValue(Arrays.asList(new DataConnectorInner().withEtag("vkwlzuvccfwnf"), - new DataConnectorInner().withEtag("eallnwsubisnj"), new DataConnectorInner().withEtag("seiphe"))); - model = BinaryData.fromObject(model).toObject(DataConnectorList.class); - Assertions.assertEquals("vkwlzuvccfwnf", model.value().get(0).etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorWithAlertsPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorWithAlertsPropertiesTests.java deleted file mode 100644 index fd4dfa4c66c9..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorWithAlertsPropertiesTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataConnectorWithAlertsProperties; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class DataConnectorWithAlertsPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DataConnectorWithAlertsProperties model - = BinaryData.fromString("{\"dataTypes\":{\"alerts\":{\"state\":\"Enabled\"}}}") - .toObject(DataConnectorWithAlertsProperties.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DataConnectorWithAlertsProperties model - = new DataConnectorWithAlertsProperties().withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(DataConnectorWithAlertsProperties.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 5ab11b4b5a40..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner; -import com.azure.resourcemanager.securityinsights.models.DataConnector; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DataConnectorsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"DataConnector\",\"etag\":\"kemyil\",\"id\":\"dxjascowvfdj\",\"name\":\"pdxphlkksnmgzvyf\",\"type\":\"jd\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DataConnector response = manager.dataConnectors() - .createOrUpdateWithResponse("akizvoaikna", "lnuwiguy", "lykwphvxz", - new DataConnectorInner().withEtag("xhmpejtlkex"), com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("kemyil", response.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDeleteWithResponseMockTests.java deleted file mode 100644 index 9a211a7fa67f..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DataConnectorsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.dataConnectors() - .deleteWithResponse("zuqnwsithuqo", "yahluqwqulsutr", "bhxykfhyqezvqqug", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsGetWithResponseMockTests.java deleted file mode 100644 index 79412e510d69..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsGetWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.DataConnector; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DataConnectorsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"DataConnector\",\"etag\":\"vitvqkjyaz\",\"id\":\"mtggmu\",\"name\":\"dchozfnkfexl\",\"type\":\"xn\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DataConnector response = manager.dataConnectors() - .getWithResponse("dbmairrhvhfnr", "cwnpqigtuujwouhd", "wsigrbjbxsj", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("vitvqkjyaz", response.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsListMockTests.java deleted file mode 100644 index 888ca83eb5c1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DataConnectorsListMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.DataConnector; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DataConnectorsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"kind\":\"DataConnector\",\"etag\":\"vxrh\",\"id\":\"d\",\"name\":\"wrso\",\"type\":\"pl\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.dataConnectors().list("kpbafvafhl", "ylcc", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("vxrh", response.iterator().next().etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DnsEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DnsEntityPropertiesTests.java deleted file mode 100644 index df4d0ccaf097..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DnsEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.DnsEntityProperties; - -public final class DnsEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DnsEntityProperties model = BinaryData.fromString( - "{\"dnsServerIpEntityId\":\"jcxcjxgrytfmpcyc\",\"domainName\":\"rmcaykgg\",\"hostIpAddressEntityId\":\"xu\",\"ipAddressEntityIds\":[\"ksxwpnd\",\"cpfnznthjtwkja\",\"srxuzvoam\"],\"additionalData\":{\"os\":\"dataq\",\"ltlaprltzkatbhj\":\"datagbzahgxqdlyr\",\"gunbtgfebwlnbm\":\"dataznnbsoqeqalarvl\"},\"friendlyName\":\"reeudzqavb\"}") - .toObject(DnsEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DnsEntityProperties model = new DnsEntityProperties(); - model = BinaryData.fromObject(model).toObject(DnsEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DnsEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DnsEntityTests.java deleted file mode 100644 index a59f5e31e132..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/DnsEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DnsEntity; - -public final class DnsEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DnsEntity model = BinaryData.fromString( - "{\"kind\":\"DnsResolution\",\"properties\":{\"dnsServerIpEntityId\":\"mikzeb\",\"domainName\":\"bsmswziqgf\",\"hostIpAddressEntityId\":\"okzrus\",\"ipAddressEntityIds\":[\"hczznvf\",\"ycjsx\",\"wwixzvumw\"],\"additionalData\":{\"djh\":\"datahndvnoamldsehao\",\"pelnjetag\":\"dataflzokxco\",\"npbs\":\"datatsxoatftgz\"},\"friendlyName\":\"e\"},\"id\":\"occsr\",\"name\":\"ozihmipgawt\",\"type\":\"xp\"}") - .toObject(DnsEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DnsEntity model = new DnsEntity(); - model = BinaryData.fromObject(model).toObject(DnsEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityCommonPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityCommonPropertiesTests.java deleted file mode 100644 index cb5087123e13..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityCommonPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.EntityCommonProperties; - -public final class EntityCommonPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EntityCommonProperties model - = BinaryData.fromString("{\"additionalData\":{\"ac\":\"dataygpfqb\"},\"friendlyName\":\"pzfqrhhuaoppp\"}") - .toObject(EntityCommonProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EntityCommonProperties model = new EntityCommonProperties(); - model = BinaryData.fromObject(model).toObject(EntityCommonProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityMappingTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityMappingTests.java deleted file mode 100644 index 3bea88c7d839..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityMappingTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.EntityMapping; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class EntityMappingTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EntityMapping model = BinaryData.fromString( - "{\"entityType\":\"AzureResource\",\"fieldMappings\":[{\"identifier\":\"vmm\",\"columnName\":\"pqfrtqlkz\"}]}") - .toObject(EntityMapping.class); - Assertions.assertEquals(EntityMappingType.AZURE_RESOURCE, model.entityType()); - Assertions.assertEquals("vmm", model.fieldMappings().get(0).identifier()); - Assertions.assertEquals("pqfrtqlkz", model.fieldMappings().get(0).columnName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EntityMapping model = new EntityMapping().withEntityType(EntityMappingType.AZURE_RESOURCE) - .withFieldMappings(Arrays.asList(new FieldMapping().withIdentifier("vmm").withColumnName("pqfrtqlkz"))); - model = BinaryData.fromObject(model).toObject(EntityMapping.class); - Assertions.assertEquals(EntityMappingType.AZURE_RESOURCE, model.entityType()); - Assertions.assertEquals("vmm", model.fieldMappings().get(0).identifier()); - Assertions.assertEquals("pqfrtqlkz", model.fieldMappings().get(0).columnName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityTests.java deleted file mode 100644 index 7239b099fd7a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.Entity; - -public final class EntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Entity model = BinaryData - .fromString("{\"kind\":\"Entity\",\"id\":\"eqx\",\"name\":\"lzdahzxctobgbkdm\",\"type\":\"izpost\"}") - .toObject(Entity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Entity model = new Entity(); - model = BinaryData.fromObject(model).toObject(Entity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EventGroupingSettingsTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EventGroupingSettingsTests.java deleted file mode 100644 index 7c33747a8e54..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/EventGroupingSettingsTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; -import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; -import org.junit.jupiter.api.Assertions; - -public final class EventGroupingSettingsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EventGroupingSettings model - = BinaryData.fromString("{\"aggregationKind\":\"SingleAlert\"}").toObject(EventGroupingSettings.class); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, model.aggregationKind()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EventGroupingSettings model - = new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.SINGLE_ALERT); - model = BinaryData.fromObject(model).toObject(EventGroupingSettings.class); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, model.aggregationKind()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FieldMappingTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FieldMappingTests.java deleted file mode 100644 index 57c75fb49fe3..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FieldMappingTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import org.junit.jupiter.api.Assertions; - -public final class FieldMappingTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FieldMapping model = BinaryData.fromString("{\"identifier\":\"gnitgvkxlzyq\",\"columnName\":\"fegcea\"}") - .toObject(FieldMapping.class); - Assertions.assertEquals("gnitgvkxlzyq", model.identifier()); - Assertions.assertEquals("fegcea", model.columnName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FieldMapping model = new FieldMapping().withIdentifier("gnitgvkxlzyq").withColumnName("fegcea"); - model = BinaryData.fromObject(model).toObject(FieldMapping.class); - Assertions.assertEquals("gnitgvkxlzyq", model.identifier()); - Assertions.assertEquals("fegcea", model.columnName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileEntityPropertiesTests.java deleted file mode 100644 index 2d185bff6a29..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.FileEntityProperties; - -public final class FileEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FileEntityProperties model = BinaryData.fromString( - "{\"directory\":\"fl\",\"fileHashEntityIds\":[\"pizruwnpqxpxiw\",\"cng\"],\"fileName\":\"aas\",\"hostEntityId\":\"xtmkzjvkviir\",\"additionalData\":{\"ra\":\"datagrwsdp\",\"ctctbrxkjz\":\"datazvzbglbyv\",\"bkgozxwopdbydpi\":\"datargxffmshkw\",\"nugj\":\"dataqaclnapxbiy\"},\"friendlyName\":\"fsmfcttuxuuyi\"}") - .toObject(FileEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FileEntityProperties model = new FileEntityProperties(); - model = BinaryData.fromObject(model).toObject(FileEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileEntityTests.java deleted file mode 100644 index cb653344df22..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.FileEntity; - -public final class FileEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FileEntity model = BinaryData.fromString( - "{\"kind\":\"File\",\"properties\":{\"directory\":\"mjxlyyzglgouw\",\"fileHashEntityIds\":[\"jjyuojqtobax\",\"j\"],\"fileName\":\"tu\",\"hostEntityId\":\"bfjkw\",\"additionalData\":{\"njqhdenxa\":\"datankqbhsyrq\"},\"friendlyName\":\"kpak\"},\"id\":\"ifmjnn\",\"name\":\"wtqabpxuckp\",\"type\":\"gqoweyirdhlisn\"}") - .toObject(FileEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FileEntity model = new FileEntity(); - model = BinaryData.fromObject(model).toObject(FileEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileHashEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileHashEntityPropertiesTests.java deleted file mode 100644 index 4d0a6e821493..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileHashEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.FileHashEntityProperties; - -public final class FileHashEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FileHashEntityProperties model = BinaryData.fromString( - "{\"algorithm\":\"SHA1\",\"hashValue\":\"spshckfkyjp\",\"additionalData\":{\"yogtieyujtvczkcn\":\"databpssdfp\",\"unjdx\":\"dataxrx\",\"ivbgkcv\":\"dataglnkvxlxpagl\"},\"friendlyName\":\"pzvuqdflvo\"}") - .toObject(FileHashEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FileHashEntityProperties model = new FileHashEntityProperties(); - model = BinaryData.fromObject(model).toObject(FileHashEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileHashEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileHashEntityTests.java deleted file mode 100644 index a770310685e8..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FileHashEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.FileHashEntity; - -public final class FileHashEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FileHashEntity model = BinaryData.fromString( - "{\"kind\":\"FileHash\",\"properties\":{\"algorithm\":\"SHA256AC\",\"hashValue\":\"iquvrehm\",\"additionalData\":{\"ytqj\":\"datahvsujztc\",\"auunfprnjletlx\":\"dataw\",\"ddoui\":\"datamr\"},\"friendlyName\":\"mowaziynknlqwzdv\"},\"id\":\"w\",\"name\":\"xqszdtmaajquh\",\"type\":\"xylrjvmtygjbmz\"}") - .toObject(FileHashEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FileHashEntity model = new FileHashEntity(); - model = BinaryData.fromObject(model).toObject(FileHashEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRulePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRulePropertiesTests.java deleted file mode 100644 index 69d1642b07d7..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRulePropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.FusionAlertRuleProperties; -import org.junit.jupiter.api.Assertions; - -public final class FusionAlertRulePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FusionAlertRuleProperties model = BinaryData.fromString( - "{\"alertRuleTemplateName\":\"f\",\"description\":\"mrqemvvhmx\",\"displayName\":\"rjfut\",\"enabled\":true,\"lastModifiedUtc\":\"2021-07-27T22:13:32Z\",\"severity\":\"Informational\",\"tactics\":[\"Persistence\",\"Impact\",\"ResourceDevelopment\"],\"techniques\":[\"nmwcpmgu\",\"adraufactkahzo\"]}") - .toObject(FusionAlertRuleProperties.class); - Assertions.assertEquals("f", model.alertRuleTemplateName()); - Assertions.assertEquals(true, model.enabled()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FusionAlertRuleProperties model - = new FusionAlertRuleProperties().withAlertRuleTemplateName("f").withEnabled(true); - model = BinaryData.fromObject(model).toObject(FusionAlertRuleProperties.class); - Assertions.assertEquals("f", model.alertRuleTemplateName()); - Assertions.assertEquals(true, model.enabled()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTemplatePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTemplatePropertiesTests.java deleted file mode 100644 index d0ef7ad830b0..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTemplatePropertiesTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.FusionAlertRuleTemplateProperties; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.TemplateStatus; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class FusionAlertRuleTemplatePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FusionAlertRuleTemplateProperties model = BinaryData.fromString( - "{\"alertRulesCreatedByTemplateCount\":1160749519,\"createdDateUTC\":\"2021-08-23T04:49:10Z\",\"lastUpdatedDateUTC\":\"2021-11-08T12:58:30Z\",\"description\":\"onmacjekniz\",\"displayName\":\"qvci\",\"requiredDataConnectors\":[{\"connectorId\":\"fgmblrrilbywdxsm\",\"dataTypes\":[\"wrwfscjfnyns\",\"qujizdvo\"]}],\"status\":\"Installed\",\"severity\":\"Informational\",\"tactics\":[\"CommandAndControl\"],\"techniques\":[\"lgy\",\"vutpthjoxo\",\"smsks\"]}") - .toObject(FusionAlertRuleTemplateProperties.class); - Assertions.assertEquals(1160749519, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("onmacjekniz", model.description()); - Assertions.assertEquals("qvci", model.displayName()); - Assertions.assertEquals("fgmblrrilbywdxsm", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("wrwfscjfnyns", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.INSTALLED, model.status()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severity()); - Assertions.assertEquals(AttackTactic.COMMAND_AND_CONTROL, model.tactics().get(0)); - Assertions.assertEquals("lgy", model.techniques().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FusionAlertRuleTemplateProperties model - = new FusionAlertRuleTemplateProperties().withAlertRulesCreatedByTemplateCount(1160749519) - .withDescription("onmacjekniz") - .withDisplayName("qvci") - .withRequiredDataConnectors( - Arrays.asList(new AlertRuleTemplateDataSource().withConnectorId("fgmblrrilbywdxsm") - .withDataTypes(Arrays.asList("wrwfscjfnyns", "qujizdvo")))) - .withStatus(TemplateStatus.INSTALLED) - .withSeverity(AlertSeverity.INFORMATIONAL) - .withTactics(Arrays.asList(AttackTactic.COMMAND_AND_CONTROL)) - .withTechniques(Arrays.asList("lgy", "vutpthjoxo", "smsks")); - model = BinaryData.fromObject(model).toObject(FusionAlertRuleTemplateProperties.class); - Assertions.assertEquals(1160749519, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("onmacjekniz", model.description()); - Assertions.assertEquals("qvci", model.displayName()); - Assertions.assertEquals("fgmblrrilbywdxsm", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("wrwfscjfnyns", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.INSTALLED, model.status()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severity()); - Assertions.assertEquals(AttackTactic.COMMAND_AND_CONTROL, model.tactics().get(0)); - Assertions.assertEquals("lgy", model.techniques().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTemplateTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTemplateTests.java deleted file mode 100644 index 47e14a6b2e58..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTemplateTests.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.FusionAlertRuleTemplate; -import com.azure.resourcemanager.securityinsights.models.TemplateStatus; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class FusionAlertRuleTemplateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FusionAlertRuleTemplate model = BinaryData.fromString( - "{\"kind\":\"Fusion\",\"properties\":{\"alertRulesCreatedByTemplateCount\":73539511,\"createdDateUTC\":\"2021-02-15T15:09:11Z\",\"lastUpdatedDateUTC\":\"2021-07-09T07:02:02Z\",\"description\":\"pshneekulfgslq\",\"displayName\":\"kwdlenrdsutujba\",\"requiredDataConnectors\":[{\"connectorId\":\"o\",\"dataTypes\":[\"nyfln\",\"rwm\",\"uvwpklvxwmyg\",\"xpgpq\"]},{\"connectorId\":\"isze\",\"dataTypes\":[\"bjcrxgibbdaxco\"]},{\"connectorId\":\"ozauorsukokwb\",\"dataTypes\":[\"hlvnuuepzlr\"]},{\"connectorId\":\"wzsoldweyuqdunv\",\"dataTypes\":[\"rwrbi\",\"rk\",\"alywjhhgdn\"]}],\"status\":\"NotAvailable\",\"severity\":\"Low\",\"tactics\":[\"PreAttack\",\"PreAttack\",\"Exfiltration\"],\"techniques\":[\"xggdufi\"]},\"id\":\"dieuzaofj\",\"name\":\"hvcyyysfg\",\"type\":\"otcubi\"}") - .toObject(FusionAlertRuleTemplate.class); - Assertions.assertEquals(73539511, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("pshneekulfgslq", model.description()); - Assertions.assertEquals("kwdlenrdsutujba", model.displayName()); - Assertions.assertEquals("o", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("nyfln", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.NOT_AVAILABLE, model.status()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(AttackTactic.PRE_ATTACK, model.tactics().get(0)); - Assertions.assertEquals("xggdufi", model.techniques().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FusionAlertRuleTemplate model = new FusionAlertRuleTemplate().withAlertRulesCreatedByTemplateCount(73539511) - .withDescription("pshneekulfgslq") - .withDisplayName("kwdlenrdsutujba") - .withRequiredDataConnectors(Arrays.asList( - new AlertRuleTemplateDataSource().withConnectorId("o") - .withDataTypes(Arrays.asList("nyfln", "rwm", "uvwpklvxwmyg", "xpgpq")), - new AlertRuleTemplateDataSource().withConnectorId("isze") - .withDataTypes(Arrays.asList("bjcrxgibbdaxco")), - new AlertRuleTemplateDataSource().withConnectorId("ozauorsukokwb") - .withDataTypes(Arrays.asList("hlvnuuepzlr")), - new AlertRuleTemplateDataSource().withConnectorId("wzsoldweyuqdunv") - .withDataTypes(Arrays.asList("rwrbi", "rk", "alywjhhgdn")))) - .withStatus(TemplateStatus.NOT_AVAILABLE) - .withSeverity(AlertSeverity.LOW) - .withTactics(Arrays.asList(AttackTactic.PRE_ATTACK, AttackTactic.PRE_ATTACK, AttackTactic.EXFILTRATION)) - .withTechniques(Arrays.asList("xggdufi")); - model = BinaryData.fromObject(model).toObject(FusionAlertRuleTemplate.class); - Assertions.assertEquals(73539511, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("pshneekulfgslq", model.description()); - Assertions.assertEquals("kwdlenrdsutujba", model.displayName()); - Assertions.assertEquals("o", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("nyfln", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.NOT_AVAILABLE, model.status()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(AttackTactic.PRE_ATTACK, model.tactics().get(0)); - Assertions.assertEquals("xggdufi", model.techniques().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTests.java deleted file mode 100644 index 40e43a427efb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/FusionAlertRuleTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.FusionAlertRule; -import org.junit.jupiter.api.Assertions; - -public final class FusionAlertRuleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FusionAlertRule model = BinaryData.fromString( - "{\"kind\":\"Fusion\",\"properties\":{\"alertRuleTemplateName\":\"btx\",\"description\":\"gfwsrtaw\",\"displayName\":\"ezbrhubskh\",\"enabled\":false,\"lastModifiedUtc\":\"2021-09-21T02:12:50Z\",\"severity\":\"High\",\"tactics\":[\"CredentialAccess\",\"Exfiltration\",\"CredentialAccess\"],\"techniques\":[\"bvleorfmluiqtqzf\"]},\"etag\":\"yvnqqybaryeuay\",\"id\":\"qabqgzslesjcb\",\"name\":\"ernntiewdjcvbquw\",\"type\":\"behwagohb\"}") - .toObject(FusionAlertRule.class); - Assertions.assertEquals("yvnqqybaryeuay", model.etag()); - Assertions.assertEquals("btx", model.alertRuleTemplateName()); - Assertions.assertEquals(false, model.enabled()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FusionAlertRule model - = new FusionAlertRule().withEtag("yvnqqybaryeuay").withAlertRuleTemplateName("btx").withEnabled(false); - model = BinaryData.fromObject(model).toObject(FusionAlertRule.class); - Assertions.assertEquals("yvnqqybaryeuay", model.etag()); - Assertions.assertEquals("btx", model.alertRuleTemplateName()); - Assertions.assertEquals(false, model.enabled()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/GroupingConfigurationTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/GroupingConfigurationTests.java deleted file mode 100644 index 2f0651343ef9..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/GroupingConfigurationTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertDetail; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.GroupingConfiguration; -import com.azure.resourcemanager.securityinsights.models.MatchingMethod; -import java.time.Duration; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class GroupingConfigurationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GroupingConfiguration model = BinaryData.fromString( - "{\"enabled\":true,\"reopenClosedIncident\":false,\"lookbackDuration\":\"PT10H40M44S\",\"matchingMethod\":\"AllEntities\",\"groupByEntities\":[\"MailCluster\",\"CloudApplication\"],\"groupByAlertDetails\":[\"Severity\"],\"groupByCustomDetails\":[\"f\"]}") - .toObject(GroupingConfiguration.class); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(false, model.reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT10H40M44S"), model.lookbackDuration()); - Assertions.assertEquals(MatchingMethod.ALL_ENTITIES, model.matchingMethod()); - Assertions.assertEquals(EntityMappingType.MAIL_CLUSTER, model.groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.SEVERITY, model.groupByAlertDetails().get(0)); - Assertions.assertEquals("f", model.groupByCustomDetails().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GroupingConfiguration model = new GroupingConfiguration().withEnabled(true) - .withReopenClosedIncident(false) - .withLookbackDuration(Duration.parse("PT10H40M44S")) - .withMatchingMethod(MatchingMethod.ALL_ENTITIES) - .withGroupByEntities(Arrays.asList(EntityMappingType.MAIL_CLUSTER, EntityMappingType.CLOUD_APPLICATION)) - .withGroupByAlertDetails(Arrays.asList(AlertDetail.SEVERITY)) - .withGroupByCustomDetails(Arrays.asList("f")); - model = BinaryData.fromObject(model).toObject(GroupingConfiguration.class); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(false, model.reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT10H40M44S"), model.lookbackDuration()); - Assertions.assertEquals(MatchingMethod.ALL_ENTITIES, model.matchingMethod()); - Assertions.assertEquals(EntityMappingType.MAIL_CLUSTER, model.groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.SEVERITY, model.groupByAlertDetails().get(0)); - Assertions.assertEquals("f", model.groupByCustomDetails().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HostEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HostEntityPropertiesTests.java deleted file mode 100644 index 036363dcb872..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HostEntityPropertiesTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.HostEntityProperties; -import com.azure.resourcemanager.securityinsights.models.OSFamily; -import org.junit.jupiter.api.Assertions; - -public final class HostEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - HostEntityProperties model = BinaryData.fromString( - "{\"azureID\":\"cugswvxwlmzqw\",\"dnsDomain\":\"tx\",\"hostName\":\"mxmcuqudtcvclxy\",\"isDomainJoined\":true,\"netBiosName\":\"vgfab\",\"ntDomain\":\"yjibuzphdugne\",\"omsAgentID\":\"n\",\"osFamily\":\"Unknown\",\"osVersion\":\"gjiuqhibto\",\"additionalData\":{\"edmurrxxge\":\"dataqw\",\"qylkmqpzoyhlf\":\"datapkt\"},\"friendlyName\":\"gwgcl\"}") - .toObject(HostEntityProperties.class); - Assertions.assertEquals(OSFamily.UNKNOWN, model.osFamily()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - HostEntityProperties model = new HostEntityProperties().withOsFamily(OSFamily.UNKNOWN); - model = BinaryData.fromObject(model).toObject(HostEntityProperties.class); - Assertions.assertEquals(OSFamily.UNKNOWN, model.osFamily()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HostEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HostEntityTests.java deleted file mode 100644 index 1ad82de931f9..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HostEntityTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.HostEntity; -import com.azure.resourcemanager.securityinsights.models.OSFamily; -import org.junit.jupiter.api.Assertions; - -public final class HostEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - HostEntity model = BinaryData.fromString( - "{\"kind\":\"Host\",\"properties\":{\"azureID\":\"dibgqjxgpnrhgov\",\"dnsDomain\":\"pikqmh\",\"hostName\":\"owjrmzvuporqz\",\"isDomainJoined\":false,\"netBiosName\":\"dzvkfvxcnqmxq\",\"ntDomain\":\"wokmvkhlggd\",\"omsAgentID\":\"em\",\"osFamily\":\"IOS\",\"osVersion\":\"sz\",\"additionalData\":{\"ljfp\":\"datawtglxx\",\"pqcbfrmbodthsq\":\"datapicrmnzhrgmqgjsx\",\"fr\":\"datagvriibakclac\",\"vsg\":\"dataxousxauzl\"},\"friendlyName\":\"ohqfzizv\"},\"id\":\"mmkjsvthnwpztek\",\"name\":\"vmribiat\",\"type\":\"gplucfotangcfhny\"}") - .toObject(HostEntity.class); - Assertions.assertEquals(OSFamily.IOS, model.osFamily()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - HostEntity model = new HostEntity().withOsFamily(OSFamily.IOS); - model = BinaryData.fromObject(model).toObject(HostEntity.class); - Assertions.assertEquals(OSFamily.IOS, model.osFamily()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HuntingBookmarkPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HuntingBookmarkPropertiesTests.java deleted file mode 100644 index 46643f03b04e..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HuntingBookmarkPropertiesTests.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.HuntingBookmarkProperties; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class HuntingBookmarkPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - HuntingBookmarkProperties model = BinaryData.fromString( - "{\"created\":\"2021-10-11T10:17:46Z\",\"createdBy\":{\"email\":\"tmnubexkpzksmon\",\"name\":\"mquxvypo\",\"objectId\":\"1a029c8d-3c73-415f-8868-734c270a6aaa\"},\"displayName\":\"kopkwhojvpajqgx\",\"eventTime\":\"2021-10-03T18:31:48Z\",\"labels\":[\"mbqfqvmk\",\"xozap\",\"helxprglya\"],\"notes\":\"dckcbc\",\"query\":\"ejrjxgciqibrho\",\"queryResult\":\"sdqrhzoymibmrq\",\"updated\":\"2021-07-29T17:32:56Z\",\"updatedBy\":{\"email\":\"wfluszdt\",\"name\":\"rkwofyyvoqa\",\"objectId\":\"895bc831-d67c-4667-917f-93047e66a631\"},\"incidentInfo\":{\"incidentId\":\"xpbtgiwbwo\",\"severity\":\"Medium\",\"title\":\"shrtdtkcnqxwb\",\"relationName\":\"kulpiujwaasi\"},\"additionalData\":{\"erpqlpqwcciuqg\":\"dataiobyu\"},\"friendlyName\":\"butauvfb\"}") - .toObject(HuntingBookmarkProperties.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-11T10:17:46Z"), model.created()); - Assertions.assertEquals(UUID.fromString("1a029c8d-3c73-415f-8868-734c270a6aaa"), model.createdBy().objectId()); - Assertions.assertEquals("kopkwhojvpajqgx", model.displayName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-03T18:31:48Z"), model.eventTime()); - Assertions.assertEquals("mbqfqvmk", model.labels().get(0)); - Assertions.assertEquals("dckcbc", model.notes()); - Assertions.assertEquals("ejrjxgciqibrho", model.query()); - Assertions.assertEquals("sdqrhzoymibmrq", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-29T17:32:56Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("895bc831-d67c-4667-917f-93047e66a631"), model.updatedBy().objectId()); - Assertions.assertEquals("xpbtgiwbwo", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, model.incidentInfo().severity()); - Assertions.assertEquals("shrtdtkcnqxwb", model.incidentInfo().title()); - Assertions.assertEquals("kulpiujwaasi", model.incidentInfo().relationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - HuntingBookmarkProperties model - = new HuntingBookmarkProperties().withCreated(OffsetDateTime.parse("2021-10-11T10:17:46Z")) - .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("1a029c8d-3c73-415f-8868-734c270a6aaa"))) - .withDisplayName("kopkwhojvpajqgx") - .withEventTime(OffsetDateTime.parse("2021-10-03T18:31:48Z")) - .withLabels(Arrays.asList("mbqfqvmk", "xozap", "helxprglya")) - .withNotes("dckcbc") - .withQuery("ejrjxgciqibrho") - .withQueryResult("sdqrhzoymibmrq") - .withUpdated(OffsetDateTime.parse("2021-07-29T17:32:56Z")) - .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("895bc831-d67c-4667-917f-93047e66a631"))) - .withIncidentInfo(new IncidentInfo().withIncidentId("xpbtgiwbwo") - .withSeverity(IncidentSeverity.MEDIUM) - .withTitle("shrtdtkcnqxwb") - .withRelationName("kulpiujwaasi")); - model = BinaryData.fromObject(model).toObject(HuntingBookmarkProperties.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-11T10:17:46Z"), model.created()); - Assertions.assertEquals(UUID.fromString("1a029c8d-3c73-415f-8868-734c270a6aaa"), model.createdBy().objectId()); - Assertions.assertEquals("kopkwhojvpajqgx", model.displayName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-03T18:31:48Z"), model.eventTime()); - Assertions.assertEquals("mbqfqvmk", model.labels().get(0)); - Assertions.assertEquals("dckcbc", model.notes()); - Assertions.assertEquals("ejrjxgciqibrho", model.query()); - Assertions.assertEquals("sdqrhzoymibmrq", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-29T17:32:56Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("895bc831-d67c-4667-917f-93047e66a631"), model.updatedBy().objectId()); - Assertions.assertEquals("xpbtgiwbwo", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, model.incidentInfo().severity()); - Assertions.assertEquals("shrtdtkcnqxwb", model.incidentInfo().title()); - Assertions.assertEquals("kulpiujwaasi", model.incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HuntingBookmarkTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HuntingBookmarkTests.java deleted file mode 100644 index 8f324af18802..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/HuntingBookmarkTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.HuntingBookmark; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class HuntingBookmarkTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - HuntingBookmark model = BinaryData.fromString( - "{\"kind\":\"Bookmark\",\"properties\":{\"created\":\"2021-07-24T11:16:02Z\",\"createdBy\":{\"email\":\"bttdumorppxe\",\"name\":\"nzbtbhj\",\"objectId\":\"4bf124bc-99cc-4faa-85c8-ac8955183b5b\"},\"displayName\":\"lkfg\",\"eventTime\":\"2021-10-17T15:49:25Z\",\"labels\":[\"uel\"],\"notes\":\"hsd\",\"query\":\"htozfikdow\",\"queryResult\":\"uuvxz\",\"updated\":\"2021-05-22T14:25:48Z\",\"updatedBy\":{\"email\":\"thhqzonosggbh\",\"name\":\"hfwdsjnkaljutiis\",\"objectId\":\"c71c5eae-5991-47f9-b132-4c85e149f460\"},\"incidentInfo\":{\"incidentId\":\"fgdkzzew\",\"severity\":\"Medium\",\"title\":\"qcrailvpnppfufl\",\"relationName\":\"dmhdlxyjr\"},\"additionalData\":{\"bcvkcvqvpkeq\":\"datagafcnihgwqapnedg\",\"obzdopcjwvnhdl\":\"datacvdrhvoodsot\",\"mutwuoe\":\"datawmgxcxrsl\",\"yqsluic\":\"datarpkhjwn\"},\"friendlyName\":\"ggkzzlvmbmpa\"},\"id\":\"odfvuefywsbp\",\"name\":\"vmwy\",\"type\":\"rfouyftaakcpw\"}") - .toObject(HuntingBookmark.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-24T11:16:02Z"), model.created()); - Assertions.assertEquals(UUID.fromString("4bf124bc-99cc-4faa-85c8-ac8955183b5b"), model.createdBy().objectId()); - Assertions.assertEquals("lkfg", model.displayName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T15:49:25Z"), model.eventTime()); - Assertions.assertEquals("uel", model.labels().get(0)); - Assertions.assertEquals("hsd", model.notes()); - Assertions.assertEquals("htozfikdow", model.query()); - Assertions.assertEquals("uuvxz", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-22T14:25:48Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("c71c5eae-5991-47f9-b132-4c85e149f460"), model.updatedBy().objectId()); - Assertions.assertEquals("fgdkzzew", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, model.incidentInfo().severity()); - Assertions.assertEquals("qcrailvpnppfufl", model.incidentInfo().title()); - Assertions.assertEquals("dmhdlxyjr", model.incidentInfo().relationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - HuntingBookmark model = new HuntingBookmark().withCreated(OffsetDateTime.parse("2021-07-24T11:16:02Z")) - .withCreatedBy(new UserInfo().withObjectId(UUID.fromString("4bf124bc-99cc-4faa-85c8-ac8955183b5b"))) - .withDisplayName("lkfg") - .withEventTime(OffsetDateTime.parse("2021-10-17T15:49:25Z")) - .withLabels(Arrays.asList("uel")) - .withNotes("hsd") - .withQuery("htozfikdow") - .withQueryResult("uuvxz") - .withUpdated(OffsetDateTime.parse("2021-05-22T14:25:48Z")) - .withUpdatedBy(new UserInfo().withObjectId(UUID.fromString("c71c5eae-5991-47f9-b132-4c85e149f460"))) - .withIncidentInfo(new IncidentInfo().withIncidentId("fgdkzzew") - .withSeverity(IncidentSeverity.MEDIUM) - .withTitle("qcrailvpnppfufl") - .withRelationName("dmhdlxyjr")); - model = BinaryData.fromObject(model).toObject(HuntingBookmark.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-24T11:16:02Z"), model.created()); - Assertions.assertEquals(UUID.fromString("4bf124bc-99cc-4faa-85c8-ac8955183b5b"), model.createdBy().objectId()); - Assertions.assertEquals("lkfg", model.displayName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T15:49:25Z"), model.eventTime()); - Assertions.assertEquals("uel", model.labels().get(0)); - Assertions.assertEquals("hsd", model.notes()); - Assertions.assertEquals("htozfikdow", model.query()); - Assertions.assertEquals("uuvxz", model.queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-22T14:25:48Z"), model.updated()); - Assertions.assertEquals(UUID.fromString("c71c5eae-5991-47f9-b132-4c85e149f460"), model.updatedBy().objectId()); - Assertions.assertEquals("fgdkzzew", model.incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, model.incidentInfo().severity()); - Assertions.assertEquals("qcrailvpnppfufl", model.incidentInfo().title()); - Assertions.assertEquals("dmhdlxyjr", model.incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentAdditionalDataTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentAdditionalDataTests.java deleted file mode 100644 index 98dc5f41208e..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentAdditionalDataTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.IncidentAdditionalData; - -public final class IncidentAdditionalDataTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentAdditionalData model = BinaryData.fromString( - "{\"alertsCount\":2118768153,\"bookmarksCount\":2142840160,\"commentsCount\":1096564755,\"alertProductNames\":[\"thsu\",\"ocmnyyazttbtwwrq\"],\"tactics\":[\"InhibitResponseFunction\",\"Impact\",\"LateralMovement\",\"PreAttack\"]}") - .toObject(IncidentAdditionalData.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentAdditionalData model = new IncidentAdditionalData(); - model = BinaryData.fromObject(model).toObject(IncidentAdditionalData.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentAlertListInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentAlertListInnerTests.java deleted file mode 100644 index 84c0736a4f91..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentAlertListInnerTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentAlertListInner; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.SecurityAlert; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class IncidentAlertListInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentAlertListInner model = BinaryData.fromString( - "{\"value\":[{\"kind\":\"SecurityAlert\",\"properties\":{\"alertDisplayName\":\"xytxhpzxbz\",\"alertType\":\"zabglcuhxwt\",\"compromisedEntity\":\"yqiklbbovplwzb\",\"confidenceLevel\":\"Unknown\",\"confidenceReasons\":[{\"reason\":\"uosvmkfssxqukk\",\"reasonType\":\"l\"}],\"confidenceScore\":81.71717361278654,\"confidenceScoreStatus\":\"Final\",\"description\":\"jzkdeslpvlopwi\",\"endTimeUtc\":\"2021-09-12T13:52:28Z\",\"intent\":\"Impact\",\"providerAlertId\":\"kdwzbaiuebbaumny\",\"processingEndTime\":\"2021-02-11T09:41:28Z\",\"productComponentName\":\"deoj\",\"productName\":\"bckhsmtxpsi\",\"productVersion\":\"tfhvpesapskrdqmh\",\"remediationSteps\":[\"htldwk\",\"zxuutkncwscwsvl\",\"otogtwrupqs\"],\"severity\":\"High\",\"startTimeUtc\":\"2021-05-08T10:21:40Z\",\"status\":\"InProgress\",\"systemAlertId\":\"vce\",\"tactics\":[\"Collection\"],\"timeGenerated\":\"2021-05-12T18:53:43Z\",\"vendorName\":\"notyfjfcnjbkcn\",\"alertLink\":\"hbttkphyw\",\"resourceIdentifiers\":[\"datajtoqne\",\"datamclfplphoxuscr\",\"dataabgy\",\"datapsbjta\"],\"additionalData\":{\"fjz\":\"datagxywpmue\",\"dsuyonobgla\":\"datafqkquj\",\"tcc\":\"datacq\"},\"friendlyName\":\"yudxytlmoy\"},\"id\":\"vwfudwpzntxhd\",\"name\":\"hl\",\"type\":\"qj\"}]}") - .toObject(IncidentAlertListInner.class); - Assertions.assertEquals(AlertSeverity.HIGH, model.value().get(0).severity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentAlertListInner model = new IncidentAlertListInner() - .withValue(Arrays.asList(new SecurityAlert().withSeverity(AlertSeverity.HIGH))); - model = BinaryData.fromObject(model).toObject(IncidentAlertListInner.class); - Assertions.assertEquals(AlertSeverity.HIGH, model.value().get(0).severity()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentBookmarkListInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentBookmarkListInnerTests.java deleted file mode 100644 index cdc5e8ccbc8c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentBookmarkListInnerTests.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentBookmarkListInner; -import com.azure.resourcemanager.securityinsights.models.HuntingBookmark; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class IncidentBookmarkListInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentBookmarkListInner model = BinaryData.fromString( - "{\"value\":[{\"kind\":\"Bookmark\",\"properties\":{\"created\":\"2021-03-12T03:59:06Z\",\"createdBy\":{\"email\":\"nrmfqjhhk\",\"name\":\"pvjymjhxxjyng\",\"objectId\":\"26664c69-561c-4b8e-a986-de91e1c01c3a\"},\"displayName\":\"ivkrtsw\",\"eventTime\":\"2021-05-30T10:12:47Z\",\"labels\":[\"szjfauvjfdxxivet\",\"t\",\"qaqtdoqmcbxvwvxy\",\"lqbhsf\"],\"notes\":\"blytk\",\"query\":\"lmpewwwfbkr\",\"queryResult\":\"nsvs\",\"updated\":\"2021-08-09T19:40:16Z\",\"updatedBy\":{\"email\":\"xc\",\"name\":\"bfovasrruvwbhsq\",\"objectId\":\"0ace2d25-4fd3-4679-a42d-1c2692bef03a\"},\"incidentInfo\":{\"incidentId\":\"cgjbirxbp\",\"severity\":\"Low\",\"title\":\"fbjfdtwssotftpvj\",\"relationName\":\"exilzznfqqnvwpmq\"},\"additionalData\":{\"jrybnwjewgdrjer\":\"datauoujmkcjhwqy\",\"gmifthnzd\":\"datanaenqpehindo\"},\"friendlyName\":\"sl\"},\"id\":\"ayqigynduhav\",\"name\":\"qlkth\",\"type\":\"maqolbgycduie\"},{\"kind\":\"Bookmark\",\"properties\":{\"created\":\"2021-07-05T23:49:12Z\",\"createdBy\":{\"email\":\"mvaolps\",\"name\":\"qlfmmdnbb\",\"objectId\":\"657cef19-7d3e-48be-a899-30180ad5dbbd\"},\"displayName\":\"zpswiydmc\",\"eventTime\":\"2021-03-06T05:36:52Z\",\"labels\":[\"xssadbzmnvdf\",\"n\",\"daodvxzbncblyl\"],\"notes\":\"tdbhhxsrzdzu\",\"query\":\"erscdntne\",\"queryResult\":\"iwjmygtdssls\",\"updated\":\"2021-06-02T21:20:03Z\",\"updatedBy\":{\"email\":\"riofzpyqse\",\"name\":\"abnetshh\",\"objectId\":\"ea075571-b064-48d2-89d6-dae2f96eb97a\"},\"incidentInfo\":{\"incidentId\":\"d\",\"severity\":\"Informational\",\"title\":\"iwubmwmbesldnk\",\"relationName\":\"tppjflcx\"},\"additionalData\":{\"qqkdltfzxmhhvhgu\":\"dataokonzmnsikvmkqz\",\"xtibqdxbxwakbog\":\"dataeodkwobda\",\"iplbpodxunkbebxm\":\"dataxndlkzgxhu\"},\"friendlyName\":\"yyntwl\"},\"id\":\"qtkoievs\",\"name\":\"otgqrlltmu\",\"type\":\"lauwzizxbmpgcjef\"}]}") - .toObject(IncidentBookmarkListInner.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T03:59:06Z"), model.value().get(0).created()); - Assertions.assertEquals(UUID.fromString("26664c69-561c-4b8e-a986-de91e1c01c3a"), - model.value().get(0).createdBy().objectId()); - Assertions.assertEquals("ivkrtsw", model.value().get(0).displayName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-30T10:12:47Z"), model.value().get(0).eventTime()); - Assertions.assertEquals("szjfauvjfdxxivet", model.value().get(0).labels().get(0)); - Assertions.assertEquals("blytk", model.value().get(0).notes()); - Assertions.assertEquals("lmpewwwfbkr", model.value().get(0).query()); - Assertions.assertEquals("nsvs", model.value().get(0).queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-09T19:40:16Z"), model.value().get(0).updated()); - Assertions.assertEquals(UUID.fromString("0ace2d25-4fd3-4679-a42d-1c2692bef03a"), - model.value().get(0).updatedBy().objectId()); - Assertions.assertEquals("cgjbirxbp", model.value().get(0).incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.LOW, model.value().get(0).incidentInfo().severity()); - Assertions.assertEquals("fbjfdtwssotftpvj", model.value().get(0).incidentInfo().title()); - Assertions.assertEquals("exilzznfqqnvwpmq", model.value().get(0).incidentInfo().relationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentBookmarkListInner model - = new IncidentBookmarkListInner() - .withValue( - Arrays - .asList( - new HuntingBookmark().withCreated(OffsetDateTime.parse("2021-03-12T03:59:06Z")) - .withCreatedBy(new UserInfo() - .withObjectId(UUID.fromString("26664c69-561c-4b8e-a986-de91e1c01c3a"))) - .withDisplayName("ivkrtsw") - .withEventTime(OffsetDateTime.parse("2021-05-30T10:12:47Z")) - .withLabels(Arrays.asList("szjfauvjfdxxivet", "t", "qaqtdoqmcbxvwvxy", "lqbhsf")) - .withNotes("blytk") - .withQuery("lmpewwwfbkr") - .withQueryResult("nsvs") - .withUpdated(OffsetDateTime.parse("2021-08-09T19:40:16Z")) - .withUpdatedBy(new UserInfo() - .withObjectId(UUID.fromString("0ace2d25-4fd3-4679-a42d-1c2692bef03a"))) - .withIncidentInfo(new IncidentInfo() - .withIncidentId("cgjbirxbp") - .withSeverity(IncidentSeverity.LOW) - .withTitle("fbjfdtwssotftpvj") - .withRelationName("exilzznfqqnvwpmq")), - new HuntingBookmark().withCreated(OffsetDateTime.parse("2021-07-05T23:49:12Z")) - .withCreatedBy(new UserInfo() - .withObjectId(UUID.fromString("657cef19-7d3e-48be-a899-30180ad5dbbd"))) - .withDisplayName("zpswiydmc") - .withEventTime(OffsetDateTime.parse("2021-03-06T05:36:52Z")) - .withLabels(Arrays.asList("xssadbzmnvdf", "n", "daodvxzbncblyl")) - .withNotes("tdbhhxsrzdzu") - .withQuery("erscdntne") - .withQueryResult("iwjmygtdssls") - .withUpdated(OffsetDateTime.parse("2021-06-02T21:20:03Z")) - .withUpdatedBy(new UserInfo() - .withObjectId(UUID.fromString("ea075571-b064-48d2-89d6-dae2f96eb97a"))) - .withIncidentInfo(new IncidentInfo().withIncidentId("d") - .withSeverity(IncidentSeverity.INFORMATIONAL) - .withTitle("iwubmwmbesldnk") - .withRelationName("tppjflcx")))); - model = BinaryData.fromObject(model).toObject(IncidentBookmarkListInner.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T03:59:06Z"), model.value().get(0).created()); - Assertions.assertEquals(UUID.fromString("26664c69-561c-4b8e-a986-de91e1c01c3a"), - model.value().get(0).createdBy().objectId()); - Assertions.assertEquals("ivkrtsw", model.value().get(0).displayName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-30T10:12:47Z"), model.value().get(0).eventTime()); - Assertions.assertEquals("szjfauvjfdxxivet", model.value().get(0).labels().get(0)); - Assertions.assertEquals("blytk", model.value().get(0).notes()); - Assertions.assertEquals("lmpewwwfbkr", model.value().get(0).query()); - Assertions.assertEquals("nsvs", model.value().get(0).queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-09T19:40:16Z"), model.value().get(0).updated()); - Assertions.assertEquals(UUID.fromString("0ace2d25-4fd3-4679-a42d-1c2692bef03a"), - model.value().get(0).updatedBy().objectId()); - Assertions.assertEquals("cgjbirxbp", model.value().get(0).incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.LOW, model.value().get(0).incidentInfo().severity()); - Assertions.assertEquals("fbjfdtwssotftpvj", model.value().get(0).incidentInfo().title()); - Assertions.assertEquals("exilzznfqqnvwpmq", model.value().get(0).incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentInnerTests.java deleted file mode 100644 index 6011d4e8e0b9..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentInnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentCommentInner; -import org.junit.jupiter.api.Assertions; - -public final class IncidentCommentInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentCommentInner model = BinaryData.fromString( - "{\"properties\":{\"createdTimeUtc\":\"2021-09-15T00:41:47Z\",\"lastModifiedTimeUtc\":\"2021-02-25T17:15:42Z\",\"message\":\"kwqqtchealmf\",\"author\":{\"email\":\"aayg\",\"name\":\"wvgpiohg\",\"objectId\":\"536577d5-ac9a-4bef-9da3-73c391d07dd5\",\"userPrincipalName\":\"tfudxepx\"}},\"etag\":\"qagvrvm\",\"id\":\"k\",\"name\":\"kghimdblxgwimfnj\",\"type\":\"fjxwmsz\"}") - .toObject(IncidentCommentInner.class); - Assertions.assertEquals("qagvrvm", model.etag()); - Assertions.assertEquals("kwqqtchealmf", model.message()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentCommentInner model = new IncidentCommentInner().withEtag("qagvrvm").withMessage("kwqqtchealmf"); - model = BinaryData.fromObject(model).toObject(IncidentCommentInner.class); - Assertions.assertEquals("qagvrvm", model.etag()); - Assertions.assertEquals("kwqqtchealmf", model.message()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentListTests.java deleted file mode 100644 index 6281e4c854dd..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentListTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentCommentInner; -import com.azure.resourcemanager.securityinsights.models.IncidentCommentList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class IncidentCommentListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentCommentList model = BinaryData.fromString( - "{\"nextLink\":\"uwhhmhykojoxafn\",\"value\":[{\"properties\":{\"createdTimeUtc\":\"2021-05-25T15:58:59Z\",\"lastModifiedTimeUtc\":\"2021-08-06T21:47:38Z\",\"message\":\"koymkcd\",\"author\":{\"email\":\"pkkpw\",\"name\":\"eqnovvqfovl\",\"objectId\":\"7db8bd37-c439-4a18-bced-10302abe1c35\",\"userPrincipalName\":\"wsuwsyr\"}},\"etag\":\"dsytgadgvr\",\"id\":\"aeneqnzarrwl\",\"name\":\"uu\",\"type\":\"jfqka\"},{\"properties\":{\"createdTimeUtc\":\"2021-05-07T16:01:38Z\",\"lastModifiedTimeUtc\":\"2021-07-18T18:26:22Z\",\"message\":\"fpubjibwwi\",\"author\":{\"email\":\"hqkvpuvksgplsak\",\"name\":\"n\",\"objectId\":\"a31a605e-c79b-4da1-b622-ce27a6acdd74\",\"userPrincipalName\":\"n\"}},\"etag\":\"ph\",\"id\":\"pxodlqiyntorzih\",\"name\":\"eosjswsr\",\"type\":\"slyzrpzbchckqq\"},{\"properties\":{\"createdTimeUtc\":\"2021-07-29T22:35:12Z\",\"lastModifiedTimeUtc\":\"2021-05-24T05:08:39Z\",\"message\":\"ysuiizynkedya\",\"author\":{\"email\":\"yhqmibzyhwi\",\"name\":\"mypyynpcdpu\",\"objectId\":\"2c168ef5-4595-41a6-8103-489a2cd8c1fd\",\"userPrincipalName\":\"g\"}},\"etag\":\"z\",\"id\":\"abikns\",\"name\":\"rgjhxb\",\"type\":\"dtlwwrlkd\"},{\"properties\":{\"createdTimeUtc\":\"2021-10-25T17:02:07Z\",\"lastModifiedTimeUtc\":\"2021-05-19T09:18:43Z\",\"message\":\"kotl\",\"author\":{\"email\":\"yhgsy\",\"name\":\"ogjltdtbnnhad\",\"objectId\":\"0f967ea4-5e96-433e-8a36-37e163fc0c6b\",\"userPrincipalName\":\"rkvcikhnvpa\"}},\"etag\":\"gxqquezik\",\"id\":\"ggxkallatmelwuip\",\"name\":\"ccjzkzivgvv\",\"type\":\"nayrhyrnxxmueedn\"}]}") - .toObject(IncidentCommentList.class); - Assertions.assertEquals("dsytgadgvr", model.value().get(0).etag()); - Assertions.assertEquals("koymkcd", model.value().get(0).message()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentCommentList model = new IncidentCommentList() - .withValue(Arrays.asList(new IncidentCommentInner().withEtag("dsytgadgvr").withMessage("koymkcd"), - new IncidentCommentInner().withEtag("ph").withMessage("fpubjibwwi"), - new IncidentCommentInner().withEtag("z").withMessage("ysuiizynkedya"), - new IncidentCommentInner().withEtag("gxqquezik").withMessage("kotl"))); - model = BinaryData.fromObject(model).toObject(IncidentCommentList.class); - Assertions.assertEquals("dsytgadgvr", model.value().get(0).etag()); - Assertions.assertEquals("koymkcd", model.value().get(0).message()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentPropertiesTests.java deleted file mode 100644 index 356e74a26650..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentPropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentCommentProperties; -import org.junit.jupiter.api.Assertions; - -public final class IncidentCommentPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentCommentProperties model = BinaryData.fromString( - "{\"createdTimeUtc\":\"2021-07-27T00:52:16Z\",\"lastModifiedTimeUtc\":\"2021-09-21T20:48:34Z\",\"message\":\"rey\",\"author\":{\"email\":\"ikf\",\"name\":\"wneaiv\",\"objectId\":\"7f3809ae-7018-4ecc-a220-1b8688af8bd9\",\"userPrincipalName\":\"zel\"}}") - .toObject(IncidentCommentProperties.class); - Assertions.assertEquals("rey", model.message()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentCommentProperties model = new IncidentCommentProperties().withMessage("rey"); - model = BinaryData.fromObject(model).toObject(IncidentCommentProperties.class); - Assertions.assertEquals("rey", model.message()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index d09fe7e43daa..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.IncidentComment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentCommentsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"createdTimeUtc\":\"2021-10-26T16:10:33Z\",\"lastModifiedTimeUtc\":\"2021-01-01T12:15:18Z\",\"message\":\"qkfrbzgowoxqmj\",\"author\":{\"email\":\"cxn\",\"name\":\"gxhlusr\",\"objectId\":\"2075d9be-78f7-465f-b998-fd1aebf9d9f2\",\"userPrincipalName\":\"simjceagbjqvlsu\"}},\"etag\":\"wzas\",\"id\":\"gon\",\"name\":\"yjfqipubyznc\",\"type\":\"k\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - IncidentComment response = manager.incidentComments() - .define("bxbhmedeilbj") - .withExistingIncident("cxetyvkunmignoh", "k", "gqogjwpindedva") - .withEtag("jsllfryvd") - .withMessage("zir") - .create(); - - Assertions.assertEquals("wzas", response.etag()); - Assertions.assertEquals("qkfrbzgowoxqmj", response.message()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsDeleteWithResponseMockTests.java deleted file mode 100644 index 02d7ab2004d9..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentCommentsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.incidentComments() - .deleteWithResponse("iucijjcea", "lijjjrtvam", "a", "zknxkv", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsGetWithResponseMockTests.java deleted file mode 100644 index af3c5ceebfdb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsGetWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.IncidentComment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentCommentsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"createdTimeUtc\":\"2021-02-21T09:44:27Z\",\"lastModifiedTimeUtc\":\"2020-12-24T02:22:44Z\",\"message\":\"p\",\"author\":{\"email\":\"zwv\",\"name\":\"rgyngydgrpxnca\",\"objectId\":\"7ab9689a-8b98-4836-bfe3-ad4c95c8e09b\",\"userPrincipalName\":\"aondjrkclamgg\"}},\"etag\":\"lmf\",\"id\":\"doqey\",\"name\":\"gltygxhqfgq\",\"type\":\"ayejsxtlgflwfgz\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - IncidentComment response = manager.incidentComments() - .getWithResponse("ilfjqqacdmk", "wxdcvjwcyz", "akeciqchx", "tuicds", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("lmf", response.etag()); - Assertions.assertEquals("p", response.message()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsListMockTests.java deleted file mode 100644 index 0be32054f5bf..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentCommentsListMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.IncidentComment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentCommentsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"createdTimeUtc\":\"2021-11-12T06:00:22Z\",\"lastModifiedTimeUtc\":\"2021-11-20T04:49:09Z\",\"message\":\"yrqjcrga\",\"author\":{\"email\":\"z\",\"name\":\"fkb\",\"objectId\":\"bf85342e-23c3-46e5-8608-dea2e8692b16\",\"userPrincipalName\":\"orpdltbqct\"}},\"etag\":\"fg\",\"id\":\"saetgzdgvpyig\",\"name\":\"aqqilzdcduwjoed\",\"type\":\"ngucaifpaurww\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.incidentComments() - .list("gjyy", "pvelszerqze", "xoqeintxwalj", "lzoblqwaafr", "ulhmzyq", 2020132379, "dvaf", - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("fg", response.iterator().next().etag()); - Assertions.assertEquals("yrqjcrga", response.iterator().next().message()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentConfigurationTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentConfigurationTests.java deleted file mode 100644 index 364c42cefb43..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentConfigurationTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertDetail; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.GroupingConfiguration; -import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; -import com.azure.resourcemanager.securityinsights.models.MatchingMethod; -import java.time.Duration; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class IncidentConfigurationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentConfiguration model = BinaryData.fromString( - "{\"createIncident\":true,\"groupingConfiguration\":{\"enabled\":false,\"reopenClosedIncident\":false,\"lookbackDuration\":\"PT218H45M39S\",\"matchingMethod\":\"AnyAlert\",\"groupByEntities\":[\"IP\",\"DNS\",\"Process\"],\"groupByAlertDetails\":[\"DisplayName\",\"DisplayName\"],\"groupByCustomDetails\":[\"izxfpxt\",\"qscjavftjuh\",\"qaz\",\"mtggu\"]}}") - .toObject(IncidentConfiguration.class); - Assertions.assertEquals(true, model.createIncident()); - Assertions.assertEquals(false, model.groupingConfiguration().enabled()); - Assertions.assertEquals(false, model.groupingConfiguration().reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT218H45M39S"), model.groupingConfiguration().lookbackDuration()); - Assertions.assertEquals(MatchingMethod.ANY_ALERT, model.groupingConfiguration().matchingMethod()); - Assertions.assertEquals(EntityMappingType.IP, model.groupingConfiguration().groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.DISPLAY_NAME, model.groupingConfiguration().groupByAlertDetails().get(0)); - Assertions.assertEquals("izxfpxt", model.groupingConfiguration().groupByCustomDetails().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentConfiguration model = new IncidentConfiguration().withCreateIncident(true) - .withGroupingConfiguration(new GroupingConfiguration().withEnabled(false) - .withReopenClosedIncident(false) - .withLookbackDuration(Duration.parse("PT218H45M39S")) - .withMatchingMethod(MatchingMethod.ANY_ALERT) - .withGroupByEntities( - Arrays.asList(EntityMappingType.IP, EntityMappingType.DNS, EntityMappingType.PROCESS)) - .withGroupByAlertDetails(Arrays.asList(AlertDetail.DISPLAY_NAME, AlertDetail.DISPLAY_NAME)) - .withGroupByCustomDetails(Arrays.asList("izxfpxt", "qscjavftjuh", "qaz", "mtggu"))); - model = BinaryData.fromObject(model).toObject(IncidentConfiguration.class); - Assertions.assertEquals(true, model.createIncident()); - Assertions.assertEquals(false, model.groupingConfiguration().enabled()); - Assertions.assertEquals(false, model.groupingConfiguration().reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT218H45M39S"), model.groupingConfiguration().lookbackDuration()); - Assertions.assertEquals(MatchingMethod.ANY_ALERT, model.groupingConfiguration().matchingMethod()); - Assertions.assertEquals(EntityMappingType.IP, model.groupingConfiguration().groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.DISPLAY_NAME, model.groupingConfiguration().groupByAlertDetails().get(0)); - Assertions.assertEquals("izxfpxt", model.groupingConfiguration().groupByCustomDetails().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentEntitiesResponseInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentEntitiesResponseInnerTests.java deleted file mode 100644 index 1a31afb98b49..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentEntitiesResponseInnerTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentEntitiesResponseInner; -import com.azure.resourcemanager.securityinsights.models.Entity; -import com.azure.resourcemanager.securityinsights.models.EntityKindEnum; -import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResultsMetadata; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class IncidentEntitiesResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentEntitiesResponseInner model = BinaryData.fromString( - "{\"entities\":[{\"kind\":\"Entity\",\"id\":\"elsfeaen\",\"name\":\"abfatkl\",\"type\":\"dxbjhwuaanozj\"},{\"kind\":\"Entity\",\"id\":\"ph\",\"name\":\"oulpjrv\",\"type\":\"ag\"}],\"metaData\":[{\"count\":1902797615,\"entityKind\":\"RegistryValue\"},{\"count\":1837530813,\"entityKind\":\"AzureResource\"}]}") - .toObject(IncidentEntitiesResponseInner.class); - Assertions.assertEquals(1902797615, model.metadata().get(0).count()); - Assertions.assertEquals(EntityKindEnum.REGISTRY_VALUE, model.metadata().get(0).entityKind()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentEntitiesResponseInner model - = new IncidentEntitiesResponseInner().withEntities(Arrays.asList(new Entity(), new Entity())) - .withMetadata(Arrays.asList( - new IncidentEntitiesResultsMetadata().withCount(1902797615) - .withEntityKind(EntityKindEnum.REGISTRY_VALUE), - new IncidentEntitiesResultsMetadata().withCount(1837530813) - .withEntityKind(EntityKindEnum.AZURE_RESOURCE))); - model = BinaryData.fromObject(model).toObject(IncidentEntitiesResponseInner.class); - Assertions.assertEquals(1902797615, model.metadata().get(0).count()); - Assertions.assertEquals(EntityKindEnum.REGISTRY_VALUE, model.metadata().get(0).entityKind()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentEntitiesResultsMetadataTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentEntitiesResultsMetadataTests.java deleted file mode 100644 index 1d0d29e8e276..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentEntitiesResultsMetadataTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.EntityKindEnum; -import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResultsMetadata; -import org.junit.jupiter.api.Assertions; - -public final class IncidentEntitiesResultsMetadataTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentEntitiesResultsMetadata model - = BinaryData.fromString("{\"count\":1410903229,\"entityKind\":\"Bookmark\"}") - .toObject(IncidentEntitiesResultsMetadata.class); - Assertions.assertEquals(1410903229, model.count()); - Assertions.assertEquals(EntityKindEnum.BOOKMARK, model.entityKind()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentEntitiesResultsMetadata model - = new IncidentEntitiesResultsMetadata().withCount(1410903229).withEntityKind(EntityKindEnum.BOOKMARK); - model = BinaryData.fromObject(model).toObject(IncidentEntitiesResultsMetadata.class); - Assertions.assertEquals(1410903229, model.count()); - Assertions.assertEquals(EntityKindEnum.BOOKMARK, model.entityKind()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentInfoTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentInfoTests.java deleted file mode 100644 index d0facbe005c3..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentInfoTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.IncidentInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import org.junit.jupiter.api.Assertions; - -public final class IncidentInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentInfo model = BinaryData - .fromString( - "{\"incidentId\":\"pphrcgynco\",\"severity\":\"Medium\",\"title\":\"fvm\",\"relationName\":\"oo\"}") - .toObject(IncidentInfo.class); - Assertions.assertEquals("pphrcgynco", model.incidentId()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, model.severity()); - Assertions.assertEquals("fvm", model.title()); - Assertions.assertEquals("oo", model.relationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentInfo model = new IncidentInfo().withIncidentId("pphrcgynco") - .withSeverity(IncidentSeverity.MEDIUM) - .withTitle("fvm") - .withRelationName("oo"); - model = BinaryData.fromObject(model).toObject(IncidentInfo.class); - Assertions.assertEquals("pphrcgynco", model.incidentId()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, model.severity()); - Assertions.assertEquals("fvm", model.title()); - Assertions.assertEquals("oo", model.relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentInnerTests.java deleted file mode 100644 index 94594dd5adc9..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentInnerTests.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentInner; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentLabel; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class IncidentInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentInner model = BinaryData.fromString( - "{\"properties\":{\"additionalData\":{\"alertsCount\":1288949880,\"bookmarksCount\":38028181,\"commentsCount\":1859867828,\"alertProductNames\":[\"agalpbuxwgipwhon\",\"wkgshwa\",\"kix\",\"bin\"],\"tactics\":[\"PreAttack\"]},\"classification\":\"TruePositive\",\"classificationComment\":\"rywn\",\"classificationReason\":\"InaccurateData\",\"createdTimeUtc\":\"2021-04-28T10:57:32Z\",\"description\":\"iyqzrnk\",\"firstActivityTimeUtc\":\"2021-04-18T03:15:34Z\",\"incidentUrl\":\"xlwhzlsicoh\",\"incidentNumber\":1969001145,\"labels\":[{\"labelName\":\"vlryavwhheunmmq\",\"labelType\":\"User\"}],\"lastActivityTimeUtc\":\"2021-05-31T23:19:13Z\",\"lastModifiedTimeUtc\":\"2021-09-15T07:07:36Z\",\"owner\":{\"email\":\"cukoklyaxuconu\",\"assignedTo\":\"zf\",\"objectId\":\"7669d900-4798-41a9-8c99-3dc89eac8fa5\",\"userPrincipalName\":\"ypewrmjmwvvjekt\",\"ownerType\":\"User\"},\"relatedAnalyticRuleIds\":[\"hwlrsf\",\"rzpwvlqdqgbiq\",\"lihkaetcktvfc\",\"vf\"],\"severity\":\"Informational\",\"status\":\"Closed\",\"title\":\"ymuctqhjfbebrj\"},\"etag\":\"erfuwuttt\",\"id\":\"vjrbirphxepcyvah\",\"name\":\"nljky\",\"type\":\"xjvuujqgidokg\"}") - .toObject(IncidentInner.class); - Assertions.assertEquals("erfuwuttt", model.etag()); - Assertions.assertEquals(IncidentClassification.TRUE_POSITIVE, model.classification()); - Assertions.assertEquals("rywn", model.classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.INACCURATE_DATA, model.classificationReason()); - Assertions.assertEquals("iyqzrnk", model.description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-18T03:15:34Z"), model.firstActivityTimeUtc()); - Assertions.assertEquals("vlryavwhheunmmq", model.labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-31T23:19:13Z"), model.lastActivityTimeUtc()); - Assertions.assertEquals("cukoklyaxuconu", model.owner().email()); - Assertions.assertEquals("zf", model.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("7669d900-4798-41a9-8c99-3dc89eac8fa5"), model.owner().objectId()); - Assertions.assertEquals("ypewrmjmwvvjekt", model.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.USER, model.owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.severity()); - Assertions.assertEquals(IncidentStatus.CLOSED, model.status()); - Assertions.assertEquals("ymuctqhjfbebrj", model.title()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentInner model = new IncidentInner().withEtag("erfuwuttt") - .withClassification(IncidentClassification.TRUE_POSITIVE) - .withClassificationComment("rywn") - .withClassificationReason(IncidentClassificationReason.INACCURATE_DATA) - .withDescription("iyqzrnk") - .withFirstActivityTimeUtc(OffsetDateTime.parse("2021-04-18T03:15:34Z")) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("vlryavwhheunmmq"))) - .withLastActivityTimeUtc(OffsetDateTime.parse("2021-05-31T23:19:13Z")) - .withOwner(new IncidentOwnerInfo().withEmail("cukoklyaxuconu") - .withAssignedTo("zf") - .withObjectId(UUID.fromString("7669d900-4798-41a9-8c99-3dc89eac8fa5")) - .withUserPrincipalName("ypewrmjmwvvjekt") - .withOwnerType(OwnerType.USER)) - .withSeverity(IncidentSeverity.INFORMATIONAL) - .withStatus(IncidentStatus.CLOSED) - .withTitle("ymuctqhjfbebrj"); - model = BinaryData.fromObject(model).toObject(IncidentInner.class); - Assertions.assertEquals("erfuwuttt", model.etag()); - Assertions.assertEquals(IncidentClassification.TRUE_POSITIVE, model.classification()); - Assertions.assertEquals("rywn", model.classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.INACCURATE_DATA, model.classificationReason()); - Assertions.assertEquals("iyqzrnk", model.description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-18T03:15:34Z"), model.firstActivityTimeUtc()); - Assertions.assertEquals("vlryavwhheunmmq", model.labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-31T23:19:13Z"), model.lastActivityTimeUtc()); - Assertions.assertEquals("cukoklyaxuconu", model.owner().email()); - Assertions.assertEquals("zf", model.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("7669d900-4798-41a9-8c99-3dc89eac8fa5"), model.owner().objectId()); - Assertions.assertEquals("ypewrmjmwvvjekt", model.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.USER, model.owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.severity()); - Assertions.assertEquals(IncidentStatus.CLOSED, model.status()); - Assertions.assertEquals("ymuctqhjfbebrj", model.title()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentLabelTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentLabelTests.java deleted file mode 100644 index 2ed9864b7c52..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentLabelTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.IncidentLabel; -import org.junit.jupiter.api.Assertions; - -public final class IncidentLabelTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentLabel model = BinaryData.fromString("{\"labelName\":\"ywbiexzfeyueax\",\"labelType\":\"AutoAssigned\"}") - .toObject(IncidentLabel.class); - Assertions.assertEquals("ywbiexzfeyueax", model.labelName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentLabel model = new IncidentLabel().withLabelName("ywbiexzfeyueax"); - model = BinaryData.fromObject(model).toObject(IncidentLabel.class); - Assertions.assertEquals("ywbiexzfeyueax", model.labelName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentListTests.java deleted file mode 100644 index 822e76400fe6..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentListTests.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentInner; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentLabel; -import com.azure.resourcemanager.securityinsights.models.IncidentList; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class IncidentListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentList model = BinaryData.fromString( - "{\"nextLink\":\"wlbjnpgacftade\",\"value\":[{\"properties\":{\"additionalData\":{\"alertsCount\":1735591195,\"bookmarksCount\":632380018,\"commentsCount\":1715960277,\"alertProductNames\":[\"suesnzw\"],\"tactics\":[\"Discovery\",\"PreAttack\",\"Reconnaissance\"]},\"classification\":\"FalsePositive\",\"classificationComment\":\"zdmohctbqvu\",\"classificationReason\":\"SuspiciousActivity\",\"createdTimeUtc\":\"2021-10-27T15:38:07Z\",\"description\":\"nvowgujju\",\"firstActivityTimeUtc\":\"2021-04-30T19:52:02Z\",\"incidentUrl\":\"cglhslazjdyggdt\",\"incidentNumber\":1916189356,\"labels\":[{\"labelName\":\"kuofqweykhme\",\"labelType\":\"User\"}],\"lastActivityTimeUtc\":\"2021-09-26T05:32:17Z\",\"lastModifiedTimeUtc\":\"2021-10-31T01:47:04Z\",\"owner\":{\"email\":\"hybcibv\",\"assignedTo\":\"dcsi\",\"objectId\":\"d2fc2719-47b0-4e58-ab20-5bbeba5d446d\",\"userPrincipalName\":\"naamde\",\"ownerType\":\"Unknown\"},\"relatedAnalyticRuleIds\":[\"iqscjeypv\"],\"severity\":\"Informational\",\"status\":\"Closed\",\"title\":\"rkgqhcjrefo\"},\"etag\":\"mkqsleyyv\",\"id\":\"qjpkcattpngjcrc\",\"name\":\"zsqpjhvmdajvny\",\"type\":\"ounqecano\"},{\"properties\":{\"additionalData\":{\"alertsCount\":1901274446,\"bookmarksCount\":1111397810,\"commentsCount\":2101228547,\"alertProductNames\":[\"pmopjmc\",\"atuokthfuiu\"],\"tactics\":[\"PreAttack\",\"ResourceDevelopment\",\"ResourceDevelopment\",\"LateralMovement\"]},\"classification\":\"TruePositive\",\"classificationComment\":\"odpuozmyzydag\",\"classificationReason\":\"IncorrectAlertLogic\",\"createdTimeUtc\":\"2021-09-10T01:22:25Z\",\"description\":\"zyiuokk\",\"firstActivityTimeUtc\":\"2021-06-08T13:35Z\",\"incidentUrl\":\"dxwzywqsmbsurexi\",\"incidentNumber\":1115871957,\"labels\":[{\"labelName\":\"cfsf\",\"labelType\":\"User\"}],\"lastActivityTimeUtc\":\"2021-06-13T04:15:30Z\",\"lastModifiedTimeUtc\":\"2021-01-31T18:49:05Z\",\"owner\":{\"email\":\"kiiuxhqyudxor\",\"assignedTo\":\"nbpoczvyifqrvkdv\",\"objectId\":\"c324685a-e2ec-4755-b92c-abc7b59b2d2e\",\"userPrincipalName\":\"lrmv\",\"ownerType\":\"Group\"},\"relatedAnalyticRuleIds\":[\"t\",\"pnpulexxbczwtru\"],\"severity\":\"Medium\",\"status\":\"Active\",\"title\":\"zb\"},\"etag\":\"vsovmyokac\",\"id\":\"kwlhzdo\",\"name\":\"pxjmflbvvnchr\",\"type\":\"cciw\"},{\"properties\":{\"additionalData\":{\"alertsCount\":982290440,\"bookmarksCount\":1059865036,\"commentsCount\":330822059,\"alertProductNames\":[\"iwkuofos\",\"ghsauuimjmvxied\",\"ugidyjrr\",\"byao\"],\"tactics\":[\"PrivilegeEscalation\"]},\"classification\":\"BenignPositive\",\"classificationComment\":\"npc\",\"classificationReason\":\"IncorrectAlertLogic\",\"createdTimeUtc\":\"2021-11-02T21:31:56Z\",\"description\":\"slkevle\",\"firstActivityTimeUtc\":\"2021-02-17T22:26:44Z\",\"incidentUrl\":\"buhfmvfaxkffeiit\",\"incidentNumber\":1335902799,\"labels\":[{\"labelName\":\"zy\",\"labelType\":\"AutoAssigned\"}],\"lastActivityTimeUtc\":\"2021-11-07T07:40:57Z\",\"lastModifiedTimeUtc\":\"2021-04-24T05:01:37Z\",\"owner\":{\"email\":\"zoggigrxwburvjxx\",\"assignedTo\":\"spyd\",\"objectId\":\"b81dbd7e-5aab-4fbd-93ee-17847cfd42b0\",\"userPrincipalName\":\"oenkouknvudwti\",\"ownerType\":\"Unknown\"},\"relatedAnalyticRuleIds\":[\"ngkpocipazy\"],\"severity\":\"High\",\"status\":\"Closed\",\"title\":\"gukgjnpiucgygevq\"},\"etag\":\"typmrbpizcdrqjsd\",\"id\":\"dnfyhxdeoejzicwi\",\"name\":\"sjttgzfbish\",\"type\":\"bkh\"}]}") - .toObject(IncidentList.class); - Assertions.assertEquals("mkqsleyyv", model.value().get(0).etag()); - Assertions.assertEquals(IncidentClassification.FALSE_POSITIVE, model.value().get(0).classification()); - Assertions.assertEquals("zdmohctbqvu", model.value().get(0).classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_ACTIVITY, - model.value().get(0).classificationReason()); - Assertions.assertEquals("nvowgujju", model.value().get(0).description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-30T19:52:02Z"), - model.value().get(0).firstActivityTimeUtc()); - Assertions.assertEquals("kuofqweykhme", model.value().get(0).labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-26T05:32:17Z"), - model.value().get(0).lastActivityTimeUtc()); - Assertions.assertEquals("hybcibv", model.value().get(0).owner().email()); - Assertions.assertEquals("dcsi", model.value().get(0).owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("d2fc2719-47b0-4e58-ab20-5bbeba5d446d"), - model.value().get(0).owner().objectId()); - Assertions.assertEquals("naamde", model.value().get(0).owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.UNKNOWN, model.value().get(0).owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.value().get(0).severity()); - Assertions.assertEquals(IncidentStatus.CLOSED, model.value().get(0).status()); - Assertions.assertEquals("rkgqhcjrefo", model.value().get(0).title()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentList model = new IncidentList().withValue(Arrays.asList( - new IncidentInner().withEtag("mkqsleyyv") - .withClassification(IncidentClassification.FALSE_POSITIVE) - .withClassificationComment("zdmohctbqvu") - .withClassificationReason(IncidentClassificationReason.SUSPICIOUS_ACTIVITY) - .withDescription("nvowgujju") - .withFirstActivityTimeUtc(OffsetDateTime.parse("2021-04-30T19:52:02Z")) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("kuofqweykhme"))) - .withLastActivityTimeUtc(OffsetDateTime.parse("2021-09-26T05:32:17Z")) - .withOwner(new IncidentOwnerInfo().withEmail("hybcibv") - .withAssignedTo("dcsi") - .withObjectId(UUID.fromString("d2fc2719-47b0-4e58-ab20-5bbeba5d446d")) - .withUserPrincipalName("naamde") - .withOwnerType(OwnerType.UNKNOWN)) - .withSeverity(IncidentSeverity.INFORMATIONAL) - .withStatus(IncidentStatus.CLOSED) - .withTitle("rkgqhcjrefo"), - new IncidentInner().withEtag("vsovmyokac") - .withClassification(IncidentClassification.TRUE_POSITIVE) - .withClassificationComment("odpuozmyzydag") - .withClassificationReason(IncidentClassificationReason.INCORRECT_ALERT_LOGIC) - .withDescription("zyiuokk") - .withFirstActivityTimeUtc(OffsetDateTime.parse("2021-06-08T13:35Z")) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("cfsf"))) - .withLastActivityTimeUtc(OffsetDateTime.parse("2021-06-13T04:15:30Z")) - .withOwner(new IncidentOwnerInfo().withEmail("kiiuxhqyudxor") - .withAssignedTo("nbpoczvyifqrvkdv") - .withObjectId(UUID.fromString("c324685a-e2ec-4755-b92c-abc7b59b2d2e")) - .withUserPrincipalName("lrmv") - .withOwnerType(OwnerType.GROUP)) - .withSeverity(IncidentSeverity.MEDIUM) - .withStatus(IncidentStatus.ACTIVE) - .withTitle("zb"), - new IncidentInner().withEtag("typmrbpizcdrqjsd") - .withClassification(IncidentClassification.BENIGN_POSITIVE) - .withClassificationComment("npc") - .withClassificationReason(IncidentClassificationReason.INCORRECT_ALERT_LOGIC) - .withDescription("slkevle") - .withFirstActivityTimeUtc(OffsetDateTime.parse("2021-02-17T22:26:44Z")) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("zy"))) - .withLastActivityTimeUtc(OffsetDateTime.parse("2021-11-07T07:40:57Z")) - .withOwner(new IncidentOwnerInfo().withEmail("zoggigrxwburvjxx") - .withAssignedTo("spyd") - .withObjectId(UUID.fromString("b81dbd7e-5aab-4fbd-93ee-17847cfd42b0")) - .withUserPrincipalName("oenkouknvudwti") - .withOwnerType(OwnerType.UNKNOWN)) - .withSeverity(IncidentSeverity.HIGH) - .withStatus(IncidentStatus.CLOSED) - .withTitle("gukgjnpiucgygevq"))); - model = BinaryData.fromObject(model).toObject(IncidentList.class); - Assertions.assertEquals("mkqsleyyv", model.value().get(0).etag()); - Assertions.assertEquals(IncidentClassification.FALSE_POSITIVE, model.value().get(0).classification()); - Assertions.assertEquals("zdmohctbqvu", model.value().get(0).classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_ACTIVITY, - model.value().get(0).classificationReason()); - Assertions.assertEquals("nvowgujju", model.value().get(0).description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-30T19:52:02Z"), - model.value().get(0).firstActivityTimeUtc()); - Assertions.assertEquals("kuofqweykhme", model.value().get(0).labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-26T05:32:17Z"), - model.value().get(0).lastActivityTimeUtc()); - Assertions.assertEquals("hybcibv", model.value().get(0).owner().email()); - Assertions.assertEquals("dcsi", model.value().get(0).owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("d2fc2719-47b0-4e58-ab20-5bbeba5d446d"), - model.value().get(0).owner().objectId()); - Assertions.assertEquals("naamde", model.value().get(0).owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.UNKNOWN, model.value().get(0).owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, model.value().get(0).severity()); - Assertions.assertEquals(IncidentStatus.CLOSED, model.value().get(0).status()); - Assertions.assertEquals("rkgqhcjrefo", model.value().get(0).title()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentOwnerInfoTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentOwnerInfoTests.java deleted file mode 100644 index 00a90b358ccb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentOwnerInfoTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class IncidentOwnerInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentOwnerInfo model = BinaryData.fromString( - "{\"email\":\"jwbhqwalmuz\",\"assignedTo\":\"xaepdkzjancuxr\",\"objectId\":\"bc6041b3-3f8c-4431-ad35-c5a51cd3ae8a\",\"userPrincipalName\":\"bavxbniwdjswzt\",\"ownerType\":\"Unknown\"}") - .toObject(IncidentOwnerInfo.class); - Assertions.assertEquals("jwbhqwalmuz", model.email()); - Assertions.assertEquals("xaepdkzjancuxr", model.assignedTo()); - Assertions.assertEquals(UUID.fromString("bc6041b3-3f8c-4431-ad35-c5a51cd3ae8a"), model.objectId()); - Assertions.assertEquals("bavxbniwdjswzt", model.userPrincipalName()); - Assertions.assertEquals(OwnerType.UNKNOWN, model.ownerType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentOwnerInfo model = new IncidentOwnerInfo().withEmail("jwbhqwalmuz") - .withAssignedTo("xaepdkzjancuxr") - .withObjectId(UUID.fromString("bc6041b3-3f8c-4431-ad35-c5a51cd3ae8a")) - .withUserPrincipalName("bavxbniwdjswzt") - .withOwnerType(OwnerType.UNKNOWN); - model = BinaryData.fromObject(model).toObject(IncidentOwnerInfo.class); - Assertions.assertEquals("jwbhqwalmuz", model.email()); - Assertions.assertEquals("xaepdkzjancuxr", model.assignedTo()); - Assertions.assertEquals(UUID.fromString("bc6041b3-3f8c-4431-ad35-c5a51cd3ae8a"), model.objectId()); - Assertions.assertEquals("bavxbniwdjswzt", model.userPrincipalName()); - Assertions.assertEquals(OwnerType.UNKNOWN, model.ownerType()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentPropertiesActionTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentPropertiesActionTests.java deleted file mode 100644 index 628c40663511..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentPropertiesActionTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentLabel; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentPropertiesAction; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class IncidentPropertiesActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentPropertiesAction model = BinaryData.fromString( - "{\"severity\":\"Low\",\"status\":\"Closed\",\"classification\":\"FalsePositive\",\"classificationReason\":\"SuspiciousButExpected\",\"classificationComment\":\"rddga\",\"owner\":{\"email\":\"hiosrsjuiv\",\"assignedTo\":\"disyirnxz\",\"objectId\":\"1947767a-4bde-49e4-bfcc-d92753ab77d6\",\"userPrincipalName\":\"exrxzbujrtrhq\",\"ownerType\":\"Group\"},\"labels\":[{\"labelName\":\"khgn\",\"labelType\":\"AutoAssigned\"}]}") - .toObject(IncidentPropertiesAction.class); - Assertions.assertEquals(IncidentSeverity.LOW, model.severity()); - Assertions.assertEquals(IncidentStatus.CLOSED, model.status()); - Assertions.assertEquals(IncidentClassification.FALSE_POSITIVE, model.classification()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_BUT_EXPECTED, model.classificationReason()); - Assertions.assertEquals("rddga", model.classificationComment()); - Assertions.assertEquals("hiosrsjuiv", model.owner().email()); - Assertions.assertEquals("disyirnxz", model.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("1947767a-4bde-49e4-bfcc-d92753ab77d6"), model.owner().objectId()); - Assertions.assertEquals("exrxzbujrtrhq", model.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.GROUP, model.owner().ownerType()); - Assertions.assertEquals("khgn", model.labels().get(0).labelName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentPropertiesAction model = new IncidentPropertiesAction().withSeverity(IncidentSeverity.LOW) - .withStatus(IncidentStatus.CLOSED) - .withClassification(IncidentClassification.FALSE_POSITIVE) - .withClassificationReason(IncidentClassificationReason.SUSPICIOUS_BUT_EXPECTED) - .withClassificationComment("rddga") - .withOwner(new IncidentOwnerInfo().withEmail("hiosrsjuiv") - .withAssignedTo("disyirnxz") - .withObjectId(UUID.fromString("1947767a-4bde-49e4-bfcc-d92753ab77d6")) - .withUserPrincipalName("exrxzbujrtrhq") - .withOwnerType(OwnerType.GROUP)) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("khgn"))); - model = BinaryData.fromObject(model).toObject(IncidentPropertiesAction.class); - Assertions.assertEquals(IncidentSeverity.LOW, model.severity()); - Assertions.assertEquals(IncidentStatus.CLOSED, model.status()); - Assertions.assertEquals(IncidentClassification.FALSE_POSITIVE, model.classification()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_BUT_EXPECTED, model.classificationReason()); - Assertions.assertEquals("rddga", model.classificationComment()); - Assertions.assertEquals("hiosrsjuiv", model.owner().email()); - Assertions.assertEquals("disyirnxz", model.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("1947767a-4bde-49e4-bfcc-d92753ab77d6"), model.owner().objectId()); - Assertions.assertEquals("exrxzbujrtrhq", model.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.GROUP, model.owner().ownerType()); - Assertions.assertEquals("khgn", model.labels().get(0).labelName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentPropertiesTests.java deleted file mode 100644 index bf9ce90e12e1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentPropertiesTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IncidentProperties; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentLabel; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class IncidentPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IncidentProperties model = BinaryData.fromString( - "{\"additionalData\":{\"alertsCount\":1108075171,\"bookmarksCount\":1125977089,\"commentsCount\":649555961,\"alertProductNames\":[\"tbgsncghkj\",\"szzhbijhtxfvgxbf\",\"mxnehmp\"],\"tactics\":[\"Exfiltration\",\"InhibitResponseFunction\"]},\"classification\":\"FalsePositive\",\"classificationComment\":\"bfqkkr\",\"classificationReason\":\"InaccurateData\",\"createdTimeUtc\":\"2021-12-04T19:14:26Z\",\"description\":\"riwflzlfb\",\"firstActivityTimeUtc\":\"2021-09-10T17:06:39Z\",\"incidentUrl\":\"zycispn\",\"incidentNumber\":2071345899,\"labels\":[{\"labelName\":\"gkbrpyyd\",\"labelType\":\"AutoAssigned\"},{\"labelName\":\"nuqqkpikadrgvt\",\"labelType\":\"User\"},{\"labelName\":\"n\",\"labelType\":\"AutoAssigned\"},{\"labelName\":\"nhijggmebfsi\",\"labelType\":\"User\"}],\"lastActivityTimeUtc\":\"2021-08-14T22:49:32Z\",\"lastModifiedTimeUtc\":\"2021-02-21T10:02:12Z\",\"owner\":{\"email\":\"azzmhjrunmpxt\",\"assignedTo\":\"bh\",\"objectId\":\"e3195add-7d60-43aa-a6de-88b3cdeb1276\",\"userPrincipalName\":\"l\",\"ownerType\":\"Group\"},\"relatedAnalyticRuleIds\":[\"yskpbhen\",\"tkcxywnytnrsy\",\"lqidyby\",\"czfc\"],\"severity\":\"Low\",\"status\":\"Active\",\"title\":\"axdbabph\"}") - .toObject(IncidentProperties.class); - Assertions.assertEquals(IncidentClassification.FALSE_POSITIVE, model.classification()); - Assertions.assertEquals("bfqkkr", model.classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.INACCURATE_DATA, model.classificationReason()); - Assertions.assertEquals("riwflzlfb", model.description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T17:06:39Z"), model.firstActivityTimeUtc()); - Assertions.assertEquals("gkbrpyyd", model.labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-14T22:49:32Z"), model.lastActivityTimeUtc()); - Assertions.assertEquals("azzmhjrunmpxt", model.owner().email()); - Assertions.assertEquals("bh", model.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("e3195add-7d60-43aa-a6de-88b3cdeb1276"), model.owner().objectId()); - Assertions.assertEquals("l", model.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.GROUP, model.owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.LOW, model.severity()); - Assertions.assertEquals(IncidentStatus.ACTIVE, model.status()); - Assertions.assertEquals("axdbabph", model.title()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IncidentProperties model = new IncidentProperties().withClassification(IncidentClassification.FALSE_POSITIVE) - .withClassificationComment("bfqkkr") - .withClassificationReason(IncidentClassificationReason.INACCURATE_DATA) - .withDescription("riwflzlfb") - .withFirstActivityTimeUtc(OffsetDateTime.parse("2021-09-10T17:06:39Z")) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("gkbrpyyd"), - new IncidentLabel().withLabelName("nuqqkpikadrgvt"), new IncidentLabel().withLabelName("n"), - new IncidentLabel().withLabelName("nhijggmebfsi"))) - .withLastActivityTimeUtc(OffsetDateTime.parse("2021-08-14T22:49:32Z")) - .withOwner(new IncidentOwnerInfo().withEmail("azzmhjrunmpxt") - .withAssignedTo("bh") - .withObjectId(UUID.fromString("e3195add-7d60-43aa-a6de-88b3cdeb1276")) - .withUserPrincipalName("l") - .withOwnerType(OwnerType.GROUP)) - .withSeverity(IncidentSeverity.LOW) - .withStatus(IncidentStatus.ACTIVE) - .withTitle("axdbabph"); - model = BinaryData.fromObject(model).toObject(IncidentProperties.class); - Assertions.assertEquals(IncidentClassification.FALSE_POSITIVE, model.classification()); - Assertions.assertEquals("bfqkkr", model.classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.INACCURATE_DATA, model.classificationReason()); - Assertions.assertEquals("riwflzlfb", model.description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T17:06:39Z"), model.firstActivityTimeUtc()); - Assertions.assertEquals("gkbrpyyd", model.labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-14T22:49:32Z"), model.lastActivityTimeUtc()); - Assertions.assertEquals("azzmhjrunmpxt", model.owner().email()); - Assertions.assertEquals("bh", model.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("e3195add-7d60-43aa-a6de-88b3cdeb1276"), model.owner().objectId()); - Assertions.assertEquals("l", model.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.GROUP, model.owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.LOW, model.severity()); - Assertions.assertEquals(IncidentStatus.ACTIVE, model.status()); - Assertions.assertEquals("axdbabph", model.title()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index a8706841265d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Relation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentRelationsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"relatedResourceId\":\"vdyznf\",\"relatedResourceName\":\"svkskmqoz\",\"relatedResourceType\":\"ivyhjrliizjixlqf\",\"relatedResourceKind\":\"fkwa\"},\"etag\":\"olro\",\"id\":\"qlmgnlqxsjxt\",\"name\":\"lexhv\",\"type\":\"qbozoolzqoc\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Relation response = manager.incidentRelations() - .define("ezxlhdjzqdca") - .withExistingIncident("t", "azyqbxyxoyfp", "qqi") - .withEtag("ibuyvpirf") - .withRelatedResourceId("vpsozjiihjri") - .create(); - - Assertions.assertEquals("olro", response.etag()); - Assertions.assertEquals("vdyznf", response.relatedResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsDeleteWithResponseMockTests.java deleted file mode 100644 index 23c84cdc9e9e..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentRelationsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.incidentRelations() - .deleteWithResponse("uww", "pphefsbzx", "bzxomeik", "clwzacnmwpfsu", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsGetWithResponseMockTests.java deleted file mode 100644 index e013626a2a0d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsGetWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Relation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentRelationsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"relatedResourceId\":\"srziuct\",\"relatedResourceName\":\"gbdsuifrev\",\"relatedResourceType\":\"apezkiswqjmdghs\",\"relatedResourceKind\":\"arybjufptbjc\"},\"etag\":\"nciuiyqvldaswvpp\",\"id\":\"qqzlgcndhz\",\"name\":\"rr\",\"type\":\"cfsrhkhgsn\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Relation response = manager.incidentRelations() - .getWithResponse("ri", "fohyk", "kxbbcbrwjiutgnj", "zbeewoiymrvzbju", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("nciuiyqvldaswvpp", response.etag()); - Assertions.assertEquals("srziuct", response.relatedResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsListMockTests.java deleted file mode 100644 index ac32017cb7e1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentRelationsListMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Relation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentRelationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"relatedResourceId\":\"wuhvaj\",\"relatedResourceName\":\"ilfemjj\",\"relatedResourceType\":\"kzwjiqullq\",\"relatedResourceKind\":\"dmvr\"},\"etag\":\"mqerndb\",\"id\":\"yeofltfnnxrkad\",\"name\":\"fynn\",\"type\":\"muii\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.incidentRelations() - .list("ke", "bgvopemt", "oqujlyegqavn", "gflqqbtnyjp", "lxdbfvabmvms", 1081151366, "aevwjcnkot", - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("mqerndb", response.iterator().next().etag()); - Assertions.assertEquals("wuhvaj", response.iterator().next().relatedResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 3ca3d739a5e2..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Incident; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentLabel; -import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"additionalData\":{\"alertsCount\":1602665053,\"bookmarksCount\":954240404,\"commentsCount\":962345519,\"alertProductNames\":[\"pgsn\",\"agnchjhgemuowaky\",\"a\"],\"tactics\":[\"PrivilegeEscalation\",\"InitialAccess\"]},\"classification\":\"TruePositive\",\"classificationComment\":\"qt\",\"classificationReason\":\"IncorrectAlertLogic\",\"createdTimeUtc\":\"2021-08-03T01:14:01Z\",\"description\":\"ssoljom\",\"firstActivityTimeUtc\":\"2021-10-11T02:19:13Z\",\"incidentUrl\":\"ycnlbvgjcodk\",\"incidentNumber\":353901873,\"labels\":[{\"labelName\":\"ytssikiz\",\"labelType\":\"AutoAssigned\"},{\"labelName\":\"fqb\",\"labelType\":\"AutoAssigned\"},{\"labelName\":\"nrgmqsorhce\",\"labelType\":\"User\"}],\"lastActivityTimeUtc\":\"2020-12-27T06:15:57Z\",\"lastModifiedTimeUtc\":\"2021-07-13T13:05:34Z\",\"owner\":{\"email\":\"cpwzv\",\"assignedTo\":\"oksqdt\",\"objectId\":\"cd02e2a2-fe01-4773-901e-98dad9b5d876\",\"userPrincipalName\":\"wxlboncqbazqicq\",\"ownerType\":\"User\"},\"relatedAnalyticRuleIds\":[\"v\"],\"severity\":\"Medium\",\"status\":\"New\",\"title\":\"janepubdpkx\"},\"etag\":\"vgxiaodetvo\",\"id\":\"xdxuwsaifmc\",\"name\":\"nosbz\",\"type\":\"ehgcvkbcknjo\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Incident response = manager.incidents() - .define("kzxuiz") - .withExistingWorkspace("ezax", "f") - .withEtag("bckyoikxk") - .withClassification(IncidentClassification.TRUE_POSITIVE) - .withClassificationComment("kb") - .withClassificationReason(IncidentClassificationReason.SUSPICIOUS_BUT_EXPECTED) - .withDescription("bnldpvcbh") - .withFirstActivityTimeUtc(OffsetDateTime.parse("2021-10-02T02:32:06Z")) - .withLabels(Arrays.asList(new IncidentLabel().withLabelName("brruyuuatv"), - new IncidentLabel().withLabelName("jwcolbm"))) - .withLastActivityTimeUtc(OffsetDateTime.parse("2021-01-27T11:36:33Z")) - .withOwner(new IncidentOwnerInfo().withEmail("ahprzrvxhmtfhocn") - .withAssignedTo("cmj") - .withObjectId(UUID.fromString("37c7565c-a8ce-4181-8c0b-483f7314abc3")) - .withUserPrincipalName("xnoqrxtdisn") - .withOwnerType(OwnerType.USER)) - .withSeverity(IncidentSeverity.INFORMATIONAL) - .withStatus(IncidentStatus.NEW) - .withTitle("tjfdoesxxhmw") - .create(); - - Assertions.assertEquals("vgxiaodetvo", response.etag()); - Assertions.assertEquals(IncidentClassification.TRUE_POSITIVE, response.classification()); - Assertions.assertEquals("qt", response.classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.INCORRECT_ALERT_LOGIC, response.classificationReason()); - Assertions.assertEquals("ssoljom", response.description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-11T02:19:13Z"), response.firstActivityTimeUtc()); - Assertions.assertEquals("ytssikiz", response.labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-27T06:15:57Z"), response.lastActivityTimeUtc()); - Assertions.assertEquals("cpwzv", response.owner().email()); - Assertions.assertEquals("oksqdt", response.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("cd02e2a2-fe01-4773-901e-98dad9b5d876"), response.owner().objectId()); - Assertions.assertEquals("wxlboncqbazqicq", response.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.USER, response.owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, response.severity()); - Assertions.assertEquals(IncidentStatus.NEW, response.status()); - Assertions.assertEquals("janepubdpkx", response.title()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsDeleteWithResponseMockTests.java deleted file mode 100644 index 71c138f4059e..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.incidents().deleteWithResponse("jeaoqaqbz", "yh", "w", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsGetWithResponseMockTests.java deleted file mode 100644 index 472728d9e984..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsGetWithResponseMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Incident; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"additionalData\":{\"alertsCount\":522442521,\"bookmarksCount\":1652198165,\"commentsCount\":2134025478,\"alertProductNames\":[\"i\"],\"tactics\":[\"Persistence\"]},\"classification\":\"Undetermined\",\"classificationComment\":\"gvxvatv\",\"classificationReason\":\"SuspiciousButExpected\",\"createdTimeUtc\":\"2021-01-29T22:04:49Z\",\"description\":\"nbqxvhcsyhzlwxae\",\"firstActivityTimeUtc\":\"2021-09-21T01:21:46Z\",\"incidentUrl\":\"rexdndsbd\",\"incidentNumber\":1772286524,\"labels\":[{\"labelName\":\"rzmwn\",\"labelType\":\"User\"}],\"lastActivityTimeUtc\":\"2021-06-07T19:00:04Z\",\"lastModifiedTimeUtc\":\"2021-07-05T10:58:17Z\",\"owner\":{\"email\":\"mmagoaqylkjzt\",\"assignedTo\":\"uazjcgmxitpfinz\",\"objectId\":\"7fcf1d94-b75e-4e89-8b1f-55ea51c2bba2\",\"userPrincipalName\":\"ltkrl\",\"ownerType\":\"Group\"},\"relatedAnalyticRuleIds\":[\"drvcqguef\"],\"severity\":\"Informational\",\"status\":\"New\",\"title\":\"mpheqdur\"},\"etag\":\"yujlfyoumpckyecl\",\"id\":\"igptajbrzmqxucyc\",\"name\":\"joclxiutgjcyzy\",\"type\":\"jdnrqjbt\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Incident response = manager.incidents() - .getWithResponse("fa", "sgftipwc", "byubhiqdxyurnpn", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("yujlfyoumpckyecl", response.etag()); - Assertions.assertEquals(IncidentClassification.UNDETERMINED, response.classification()); - Assertions.assertEquals("gvxvatv", response.classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_BUT_EXPECTED, response.classificationReason()); - Assertions.assertEquals("nbqxvhcsyhzlwxae", response.description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-21T01:21:46Z"), response.firstActivityTimeUtc()); - Assertions.assertEquals("rzmwn", response.labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-07T19:00:04Z"), response.lastActivityTimeUtc()); - Assertions.assertEquals("mmagoaqylkjzt", response.owner().email()); - Assertions.assertEquals("uazjcgmxitpfinz", response.owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("7fcf1d94-b75e-4e89-8b1f-55ea51c2bba2"), response.owner().objectId()); - Assertions.assertEquals("ltkrl", response.owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.GROUP, response.owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, response.severity()); - Assertions.assertEquals(IncidentStatus.NEW, response.status()); - Assertions.assertEquals("mpheqdur", response.title()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListAlertsWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListAlertsWithResponseMockTests.java deleted file mode 100644 index 2fad1532ef5d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListAlertsWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentAlertList; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentsListAlertsWithResponseMockTests { - @Test - public void testListAlertsWithResponse() throws Exception { - String responseStr - = "{\"value\":[{\"kind\":\"SecurityAlert\",\"properties\":{\"alertDisplayName\":\"slpkcvmwfauxxep\",\"alertType\":\"wbormcqmi\",\"compromisedEntity\":\"ijqpkzfbojxjmcs\",\"confidenceLevel\":\"High\",\"confidenceReasons\":[{},{},{},{}],\"confidenceScore\":46.701227253553256,\"confidenceScoreStatus\":\"NotFinal\",\"description\":\"kwywzwofalic\",\"endTimeUtc\":\"2021-09-02T12:29:07Z\",\"intent\":\"PrivilegeEscalation\",\"providerAlertId\":\"tamtyv\",\"processingEndTime\":\"2021-02-15T11:04:24Z\",\"productComponentName\":\"rwzawnvs\",\"productName\":\"fhzag\",\"productVersion\":\"vhycvdimwrzregzg\",\"remediationSteps\":[\"utrwpweryekz\",\"dhme\",\"tta\",\"jyosxwwh\"],\"severity\":\"Informational\",\"startTimeUtc\":\"2021-06-06T09:18:05Z\",\"status\":\"Dismissed\",\"systemAlertId\":\"dpmiljpn\",\"tactics\":[\"Discovery\",\"ResourceDevelopment\"],\"timeGenerated\":\"2021-10-23T23:22:48Z\",\"vendorName\":\"zsauzp\",\"alertLink\":\"xee\",\"resourceIdentifiers\":[\"dataiqhzlr\",\"datayme\",\"dataxls\",\"dataihmxrfdsajredn\"],\"additionalData\":{\"vuafpwzyifr\":\"datashtuwgm\",\"gzdyimsfayorp\":\"datagwltxeqip\",\"sl\":\"dataavkjog\"},\"friendlyName\":\"nsmjkwynqxaekqs\"},\"id\":\"vwjtqpkevmyltjc\",\"name\":\"spxklu\",\"type\":\"cclfgxannn\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - IncidentAlertList response = manager.incidents() - .listAlertsWithResponse("v", "atbwbqam", "e", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, response.value().get(0).severity()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListBookmarksWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListBookmarksWithResponseMockTests.java deleted file mode 100644 index bfe39201552b..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListBookmarksWithResponseMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.IncidentBookmarkList; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentsListBookmarksWithResponseMockTests { - @Test - public void testListBookmarksWithResponse() throws Exception { - String responseStr - = "{\"value\":[{\"kind\":\"Bookmark\",\"properties\":{\"created\":\"2021-10-06T15:52:18Z\",\"createdBy\":{\"email\":\"zyzeyuubeidsz\",\"name\":\"ytoithgygvfl\",\"objectId\":\"3c5742fb-fadf-417b-8855-66d81342861e\"},\"displayName\":\"vdihoynkrx\",\"eventTime\":\"2021-04-11T05:57:12Z\",\"labels\":[\"drcyrucpcun\",\"uzdqumoenod\",\"aienhqhsknd\"],\"notes\":\"lqkaadlknwf\",\"query\":\"anniyopetxivcnr\",\"queryResult\":\"xnucaephblkwqp\",\"updated\":\"2021-06-05T10:07:49Z\",\"updatedBy\":{\"email\":\"sdtcjbctvivuzqym\",\"name\":\"owog\",\"objectId\":\"0a637f55-80a1-436f-9f84-eba4772c58e8\"},\"incidentInfo\":{\"incidentId\":\"sqhzvbrzcdbanfz\",\"severity\":\"Medium\",\"title\":\"xmxeatkdb\",\"relationName\":\"nrd\"},\"additionalData\":{\"axljal\":\"databqbnaomhjrmkuh\",\"cjmobcanc\":\"datai\",\"xf\":\"dataexxqcwg\"},\"friendlyName\":\"aknokzwjjzrl\"},\"id\":\"xldzyyfytpqsix\",\"name\":\"mmpuj\",\"type\":\"vyqlkjuvsmbmslzo\"},{\"kind\":\"Bookmark\",\"properties\":{\"created\":\"2021-09-01T12:35:13Z\",\"createdBy\":{\"email\":\"bpqvybefg\",\"name\":\"x\",\"objectId\":\"84cbd346-159b-4c7a-8055-2fd1b19d4388\"},\"displayName\":\"kcvtl\",\"eventTime\":\"2021-01-01T17:46:17Z\",\"labels\":[\"kvcuartrhunl\",\"iryky\",\"ndzfqivjreuyk\",\"bmnwa\"],\"notes\":\"tbxoee\",\"query\":\"nqlnfwmyymvqd\",\"queryResult\":\"bhfckdvezcrcssb\",\"updated\":\"2021-09-25T14:44:33Z\",\"updatedBy\":{\"email\":\"b\",\"name\":\"qfblhkalehpa\",\"objectId\":\"0ee25afa-17c9-4dd8-b68c-7eedda40f5a5\"},\"incidentInfo\":{\"incidentId\":\"giqjtiogq\",\"severity\":\"Medium\",\"title\":\"nictteajo\",\"relationName\":\"ygspnbonhpczykm\"},\"additionalData\":{\"qcs\":\"datavw\"},\"friendlyName\":\"chkhufm\"},\"id\":\"umqy\",\"name\":\"gy\",\"type\":\"zulo\"},{\"kind\":\"Bookmark\",\"properties\":{\"created\":\"2021-07-13T13:52:02Z\",\"createdBy\":{\"email\":\"a\",\"name\":\"sfnhsenwphp\",\"objectId\":\"b7d57b0a-6502-4190-a501-71d95729c049\"},\"displayName\":\"ngqjclidf\",\"eventTime\":\"2021-10-18T07:20:26Z\",\"labels\":[\"jufwbeqrkuorhtss\"],\"notes\":\"qnmdvhazcvjy\",\"query\":\"iqswbqer\",\"queryResult\":\"xiytxtdgukvl\",\"updated\":\"2021-11-18T11:20:29Z\",\"updatedBy\":{\"email\":\"dstyouam\",\"name\":\"wreswmowegm\",\"objectId\":\"a2b3831b-8f8c-4d7d-a8c4-f7eb64046d12\"},\"incidentInfo\":{\"incidentId\":\"yxey\",\"severity\":\"Informational\",\"title\":\"gijiitnspxlzd\",\"relationName\":\"ygr\"},\"additionalData\":{\"n\":\"dataaiuf\",\"qfrojsydgrhyd\":\"dataaybfu\",\"skieca\":\"dataygywe\"},\"friendlyName\":\"gzmxieqv\"},\"id\":\"makli\",\"name\":\"qcahyhxal\",\"type\":\"bx\"},{\"kind\":\"Bookmark\",\"properties\":{\"created\":\"2021-11-30T21:00:42Z\",\"createdBy\":{\"email\":\"o\",\"name\":\"blxpkkwjdjodq\",\"objectId\":\"f85fa2da-3b13-4c84-8f7d-0990fcd881f2\"},\"displayName\":\"kincnremeh\",\"eventTime\":\"2021-03-18T11:25:17Z\",\"labels\":[\"ceum\",\"qodkadppyibngql\",\"d\"],\"notes\":\"rxwhydtlu\",\"query\":\"vadswzs\",\"queryResult\":\"yemlowuowhlxln\",\"updated\":\"2021-12-07T17:56:08Z\",\"updatedBy\":{\"email\":\"uvblg\",\"name\":\"kzkltrfowt\",\"objectId\":\"b015fb72-7905-471e-b014-0abf069ae86f\"},\"incidentInfo\":{\"incidentId\":\"mvlihcvjdrqcrjid\",\"severity\":\"High\",\"title\":\"kvhd\",\"relationName\":\"wyojbfqzdkfnjyi\"},\"additionalData\":{\"valqjrhuzgfxo\":\"datafratqxmbjroumzz\"},\"friendlyName\":\"tpusllywp\"},\"id\":\"iotzbpdbollgryfq\",\"name\":\"uasigr\",\"type\":\"wsocnequygdjbo\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - IncidentBookmarkList response = manager.incidents() - .listBookmarksWithResponse("ytzpo", "ewxigpxvk", "maupxvpi", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(OffsetDateTime.parse("2021-10-06T15:52:18Z"), response.value().get(0).created()); - Assertions.assertEquals(UUID.fromString("3c5742fb-fadf-417b-8855-66d81342861e"), - response.value().get(0).createdBy().objectId()); - Assertions.assertEquals("vdihoynkrx", response.value().get(0).displayName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-11T05:57:12Z"), response.value().get(0).eventTime()); - Assertions.assertEquals("drcyrucpcun", response.value().get(0).labels().get(0)); - Assertions.assertEquals("lqkaadlknwf", response.value().get(0).notes()); - Assertions.assertEquals("anniyopetxivcnr", response.value().get(0).query()); - Assertions.assertEquals("xnucaephblkwqp", response.value().get(0).queryResult()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-05T10:07:49Z"), response.value().get(0).updated()); - Assertions.assertEquals(UUID.fromString("0a637f55-80a1-436f-9f84-eba4772c58e8"), - response.value().get(0).updatedBy().objectId()); - Assertions.assertEquals("sqhzvbrzcdbanfz", response.value().get(0).incidentInfo().incidentId()); - Assertions.assertEquals(IncidentSeverity.MEDIUM, response.value().get(0).incidentInfo().severity()); - Assertions.assertEquals("xmxeatkdb", response.value().get(0).incidentInfo().title()); - Assertions.assertEquals("nrd", response.value().get(0).incidentInfo().relationName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListEntitiesWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListEntitiesWithResponseMockTests.java deleted file mode 100644 index ccd39ad76327..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListEntitiesWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.EntityKindEnum; -import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentsListEntitiesWithResponseMockTests { - @Test - public void testListEntitiesWithResponse() throws Exception { - String responseStr - = "{\"entities\":[{\"kind\":\"Entity\",\"id\":\"idisczskosw\",\"name\":\"qiqazugamxzkr\",\"type\":\"coiisbamnppcce\"}],\"metaData\":[{\"count\":2123887167,\"entityKind\":\"Ip\"},{\"count\":1946574379,\"entityKind\":\"RegistryKey\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - IncidentEntitiesResponse response = manager.incidents() - .listEntitiesWithResponse("grmtqjk", "evadrmmwiu", "wvcmj", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(2123887167, response.metadata().get(0).count()); - Assertions.assertEquals(EntityKindEnum.IP, response.metadata().get(0).entityKind()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListMockTests.java deleted file mode 100644 index bbdbcce8e88b..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IncidentsListMockTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Incident; -import com.azure.resourcemanager.securityinsights.models.IncidentClassification; -import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason; -import com.azure.resourcemanager.securityinsights.models.IncidentSeverity; -import com.azure.resourcemanager.securityinsights.models.IncidentStatus; -import com.azure.resourcemanager.securityinsights.models.OwnerType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class IncidentsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"additionalData\":{\"alertsCount\":1963541859,\"bookmarksCount\":743054032,\"commentsCount\":1998617228,\"alertProductNames\":[\"dgglmepjpfs\",\"ykgsangpszng\",\"fpgylkve\"],\"tactics\":[\"Collection\",\"Execution\"]},\"classification\":\"BenignPositive\",\"classificationComment\":\"adyedmzrgjfok\",\"classificationReason\":\"SuspiciousButExpected\",\"createdTimeUtc\":\"2021-05-30T12:16:13Z\",\"description\":\"tp\",\"firstActivityTimeUtc\":\"2021-11-22T23:37:09Z\",\"incidentUrl\":\"rgdg\",\"incidentNumber\":1339773074,\"labels\":[{\"labelName\":\"raswugyxpqit\",\"labelType\":\"User\"},{\"labelName\":\"alwvskbu\",\"labelType\":\"AutoAssigned\"},{\"labelName\":\"caqt\",\"labelType\":\"User\"},{\"labelName\":\"co\",\"labelType\":\"AutoAssigned\"}],\"lastActivityTimeUtc\":\"2021-03-15T06:39:11Z\",\"lastModifiedTimeUtc\":\"2021-06-10T09:18:11Z\",\"owner\":{\"email\":\"akuejk\",\"assignedTo\":\"bizt\",\"objectId\":\"856fd1dd-2865-403f-94ab-ca27791198b8\",\"userPrincipalName\":\"qcvov\",\"ownerType\":\"Group\"},\"relatedAnalyticRuleIds\":[\"sj\",\"lbemyej\"],\"severity\":\"Informational\",\"status\":\"New\",\"title\":\"uxegthortudawlpj\"},\"etag\":\"lqerpptcbgqnzm\",\"id\":\"iilialwc\",\"name\":\"gckbb\",\"type\":\"ccgzpraoxnyu\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.incidents() - .list("rftb", "ve", "reuquowtljvf", "hreagk", 1184787439, "xv", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("lqerpptcbgqnzm", response.iterator().next().etag()); - Assertions.assertEquals(IncidentClassification.BENIGN_POSITIVE, response.iterator().next().classification()); - Assertions.assertEquals("adyedmzrgjfok", response.iterator().next().classificationComment()); - Assertions.assertEquals(IncidentClassificationReason.SUSPICIOUS_BUT_EXPECTED, - response.iterator().next().classificationReason()); - Assertions.assertEquals("tp", response.iterator().next().description()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-22T23:37:09Z"), - response.iterator().next().firstActivityTimeUtc()); - Assertions.assertEquals("raswugyxpqit", response.iterator().next().labels().get(0).labelName()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-15T06:39:11Z"), - response.iterator().next().lastActivityTimeUtc()); - Assertions.assertEquals("akuejk", response.iterator().next().owner().email()); - Assertions.assertEquals("bizt", response.iterator().next().owner().assignedTo()); - Assertions.assertEquals(UUID.fromString("856fd1dd-2865-403f-94ab-ca27791198b8"), - response.iterator().next().owner().objectId()); - Assertions.assertEquals("qcvov", response.iterator().next().owner().userPrincipalName()); - Assertions.assertEquals(OwnerType.GROUP, response.iterator().next().owner().ownerType()); - Assertions.assertEquals(IncidentSeverity.INFORMATIONAL, response.iterator().next().severity()); - Assertions.assertEquals(IncidentStatus.NEW, response.iterator().next().status()); - Assertions.assertEquals("uxegthortudawlpj", response.iterator().next().title()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IoTDeviceEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IoTDeviceEntityPropertiesTests.java deleted file mode 100644 index 9e3006ce7ab0..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IoTDeviceEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.IoTDeviceEntityProperties; - -public final class IoTDeviceEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IoTDeviceEntityProperties model = BinaryData.fromString( - "{\"deviceId\":\"jxtxrdc\",\"deviceName\":\"jvidttge\",\"source\":\"slvyjtcvuwkasi\",\"iotSecurityAgentId\":\"ba3f9ce6-cacb-4c01-8778-a7a6e4bf0e08\",\"deviceType\":\"sfuughtuqfecjx\",\"vendor\":\"gtuhxuicbu\",\"edgeId\":\"mr\",\"macAddress\":\"njlx\",\"model\":\"rhwpus\",\"serialNumber\":\"baqehgpdoh\",\"firmwareVersion\":\"qatucoigebxnc\",\"operatingSystem\":\"fepbnwgfmxjgc\",\"iotHubEntityId\":\"jbgdlfgtdysnaquf\",\"hostEntityId\":\"bctqhamzjrwd\",\"ipAddressEntityId\":\"zeqyjleziun\",\"threatIntelligence\":[{\"confidence\":52.45288148920413,\"providerName\":\"tkw\",\"reportLink\":\"gyamlbnseqacjjv\",\"threatDescription\":\"lguooqjagmd\",\"threatName\":\"gueiookjbsahrtdt\",\"threatType\":\"elqacslmot\"},{\"confidence\":44.88763883209227,\"providerName\":\"xofvcjk\",\"reportLink\":\"irazftxejwabmd\",\"threatDescription\":\"tmvcop\",\"threatName\":\"c\",\"threatType\":\"urbuhhlkyqltq\"},{\"confidence\":20.089415326798854,\"providerName\":\"uwkffdjktsysid\",\"reportLink\":\"c\",\"threatDescription\":\"lxnfuijtkbusqogs\",\"threatName\":\"kayi\",\"threatType\":\"sharujtj\"}],\"protocols\":[\"fzyjqt\"],\"additionalData\":{\"qqekewvnqvcdlgu\":\"datakpqhjpenuygbq\",\"nlaxpunjqikcz\":\"dataucmfdj\",\"xmfcsserxhtv\":\"datavitac\",\"tsjgqrsx\":\"dataoxhlw\"},\"friendlyName\":\"ruuuybnch\"}") - .toObject(IoTDeviceEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IoTDeviceEntityProperties model = new IoTDeviceEntityProperties(); - model = BinaryData.fromObject(model).toObject(IoTDeviceEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IoTDeviceEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IoTDeviceEntityTests.java deleted file mode 100644 index 8668e7140b36..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/IoTDeviceEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.IoTDeviceEntity; - -public final class IoTDeviceEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IoTDeviceEntity model = BinaryData.fromString( - "{\"kind\":\"IoTDevice\",\"properties\":{\"deviceId\":\"ebqinjipnw\",\"deviceName\":\"ujqlafcbahh\",\"source\":\"pofoi\",\"iotSecurityAgentId\":\"34cc2481-801e-491b-a659-2b18f00be92c\",\"deviceType\":\"p\",\"vendor\":\"lkmkkholvdndvi\",\"edgeId\":\"ogphuartvtiu\",\"macAddress\":\"efchn\",\"model\":\"ahmnxhkxjqirw\",\"serialNumber\":\"eooxffifh\",\"firmwareVersion\":\"rsnewmozqvbubqma\",\"operatingSystem\":\"sycxhxzgaz\",\"iotHubEntityId\":\"abo\",\"hostEntityId\":\"vmfqhppubo\",\"ipAddressEntityId\":\"epdfgkmtdherng\",\"threatIntelligence\":[{\"confidence\":33.38182566342388,\"providerName\":\"okqtobk\",\"reportLink\":\"xof\",\"threatDescription\":\"fphwpnu\",\"threatName\":\"iywzejy\",\"threatType\":\"slwkojpl\"}],\"protocols\":[\"npdwr\",\"qafgfugsnnfhyet\",\"fypococtfjgti\"],\"additionalData\":{\"wolba\":\"datavzuyturmlmu\",\"pngajin\":\"datairopionszon\"},\"friendlyName\":\"xjawrt\"},\"id\":\"fjmyccxlzhco\",\"name\":\"ovne\",\"type\":\"henlusfnr\"}") - .toObject(IoTDeviceEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IoTDeviceEntity model = new IoTDeviceEntity(); - model = BinaryData.fromObject(model).toObject(IoTDeviceEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailClusterEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailClusterEntityPropertiesTests.java deleted file mode 100644 index f94f3582cab4..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailClusterEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.MailClusterEntityProperties; - -public final class MailClusterEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MailClusterEntityProperties model = BinaryData.fromString( - "{\"networkMessageIds\":[\"oafcluqvox\"],\"countByDeliveryStatus\":\"datacjimryvwgcwwpbmz\",\"countByThreatType\":\"dataesyds\",\"countByProtectionStatus\":\"dataefoh\",\"threats\":[\"vopwndyqleallk\",\"mtkhlowkxxpvbr\",\"fjmzsyzfho\"],\"query\":\"h\",\"queryTime\":\"2021-04-25T11:24:14Z\",\"mailCount\":2107805309,\"isVolumeAnomaly\":false,\"source\":\"nsjlpjrtws\",\"clusterSourceIdentifier\":\"vv\",\"clusterSourceType\":\"c\",\"clusterQueryStartTime\":\"2021-07-19T03:46:29Z\",\"clusterQueryEndTime\":\"2021-09-11T09:13:01Z\",\"clusterGroup\":\"mhwrb\",\"additionalData\":{\"yzlwh\":\"datayflubhvjglroc\"},\"friendlyName\":\"emhooclutnpq\"}") - .toObject(MailClusterEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MailClusterEntityProperties model = new MailClusterEntityProperties(); - model = BinaryData.fromObject(model).toObject(MailClusterEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailClusterEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailClusterEntityTests.java deleted file mode 100644 index 21766c329ac5..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailClusterEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.MailClusterEntity; - -public final class MailClusterEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MailClusterEntity model = BinaryData.fromString( - "{\"kind\":\"MailCluster\",\"properties\":{\"networkMessageIds\":[\"jhbzxliohrdddtf\"],\"countByDeliveryStatus\":\"dataqbawpcbbnzqcykn\",\"countByThreatType\":\"dataqofyuicdhzbdy\",\"countByProtectionStatus\":\"datawgbdvibidmhmwffp\",\"threats\":[\"u\",\"apckccrrvw\"],\"query\":\"oxoyyukp\",\"queryTime\":\"2021-02-08T12:14:50Z\",\"mailCount\":617111065,\"isVolumeAnomaly\":true,\"source\":\"qboshbra\",\"clusterSourceIdentifier\":\"pyyrmfs\",\"clusterSourceType\":\"pavbo\",\"clusterQueryStartTime\":\"2021-06-03T07:36:41Z\",\"clusterQueryEndTime\":\"2021-09-22T17:44:07Z\",\"clusterGroup\":\"wnupgahxku\",\"additionalData\":{\"hqepvufhbzehewh\":\"datajcaacfdmmcpugm\",\"eaclgschorimk\":\"dataqhnlbqnbld\",\"ucsofldpuviyf\":\"datasrrm\",\"bsxtkcudfbsfarfs\":\"dataaabeolhbhlvbmxuq\"},\"friendlyName\":\"wlkjxn\"},\"id\":\"vwgf\",\"name\":\"tmhqykiz\",\"type\":\"d\"}") - .toObject(MailClusterEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MailClusterEntity model = new MailClusterEntity(); - model = BinaryData.fromObject(model).toObject(MailClusterEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailMessageEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailMessageEntityPropertiesTests.java deleted file mode 100644 index 832735e2cddb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailMessageEntityPropertiesTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.MailMessageEntityProperties; -import com.azure.resourcemanager.securityinsights.models.AntispamMailDirection; -import com.azure.resourcemanager.securityinsights.models.DeliveryAction; -import com.azure.resourcemanager.securityinsights.models.DeliveryLocation; -import org.junit.jupiter.api.Assertions; - -public final class MailMessageEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MailMessageEntityProperties model = BinaryData.fromString( - "{\"fileEntityIds\":[\"lanrupdwvnp\",\"cnzqtpjhmqr\",\"v\",\"hlaiwd\"],\"recipient\":\"smlzzhzdtxetlgy\",\"urls\":[\"qvlnnpxybafiqgea\",\"rbgjekglkl\",\"yulidwcwvm\",\"eg\"],\"threats\":[\"fhjirwgdnqzbrfk\",\"pzhz\",\"tk\",\"jcitdigsxcdglj\"],\"p1Sender\":\"keuachtomf\",\"p1SenderDisplayName\":\"ytswfp\",\"p1SenderDomain\":\"dgycxnmskwhqjjy\",\"senderIP\":\"urlpshh\",\"p2Sender\":\"pedwqsl\",\"p2SenderDisplayName\":\"hmpqvw\",\"p2SenderDomain\":\"kondcb\",\"receiveDate\":\"2021-03-14T03:56:56Z\",\"networkMessageId\":\"2f4e80f2-f3c5-4da4-aa46-c2ee2adf52ce\",\"internetMessageId\":\"vqejosovy\",\"subject\":\"leaesi\",\"language\":\"qtljqobbpihehc\",\"threatDetectionMethods\":[\"bmrqbrjbbmp\",\"dlvykfrex\",\"rseqwjksghudgz\"],\"bodyFingerprintBin1\":1903316554,\"bodyFingerprintBin2\":1557581128,\"bodyFingerprintBin3\":770792528,\"bodyFingerprintBin4\":1356644601,\"bodyFingerprintBin5\":210376116,\"antispamDirection\":\"Inbound\",\"deliveryAction\":\"Delivered\",\"deliveryLocation\":\"JunkFolder\",\"additionalData\":{\"y\":\"datahrkmdyomkxfbvfbh\",\"gddeimaw\":\"datarhpw\",\"gkkumuikjcj\":\"datao\"},\"friendlyName\":\"ztbws\"}") - .toObject(MailMessageEntityProperties.class); - Assertions.assertEquals(1903316554, model.bodyFingerprintBin1()); - Assertions.assertEquals(1557581128, model.bodyFingerprintBin2()); - Assertions.assertEquals(770792528, model.bodyFingerprintBin3()); - Assertions.assertEquals(1356644601, model.bodyFingerprintBin4()); - Assertions.assertEquals(210376116, model.bodyFingerprintBin5()); - Assertions.assertEquals(AntispamMailDirection.INBOUND, model.antispamDirection()); - Assertions.assertEquals(DeliveryAction.DELIVERED, model.deliveryAction()); - Assertions.assertEquals(DeliveryLocation.JUNK_FOLDER, model.deliveryLocation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MailMessageEntityProperties model = new MailMessageEntityProperties().withBodyFingerprintBin1(1903316554) - .withBodyFingerprintBin2(1557581128) - .withBodyFingerprintBin3(770792528) - .withBodyFingerprintBin4(1356644601) - .withBodyFingerprintBin5(210376116) - .withAntispamDirection(AntispamMailDirection.INBOUND) - .withDeliveryAction(DeliveryAction.DELIVERED) - .withDeliveryLocation(DeliveryLocation.JUNK_FOLDER); - model = BinaryData.fromObject(model).toObject(MailMessageEntityProperties.class); - Assertions.assertEquals(1903316554, model.bodyFingerprintBin1()); - Assertions.assertEquals(1557581128, model.bodyFingerprintBin2()); - Assertions.assertEquals(770792528, model.bodyFingerprintBin3()); - Assertions.assertEquals(1356644601, model.bodyFingerprintBin4()); - Assertions.assertEquals(210376116, model.bodyFingerprintBin5()); - Assertions.assertEquals(AntispamMailDirection.INBOUND, model.antispamDirection()); - Assertions.assertEquals(DeliveryAction.DELIVERED, model.deliveryAction()); - Assertions.assertEquals(DeliveryLocation.JUNK_FOLDER, model.deliveryLocation()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailMessageEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailMessageEntityTests.java deleted file mode 100644 index 624abf3bf03a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailMessageEntityTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AntispamMailDirection; -import com.azure.resourcemanager.securityinsights.models.DeliveryAction; -import com.azure.resourcemanager.securityinsights.models.DeliveryLocation; -import com.azure.resourcemanager.securityinsights.models.MailMessageEntity; -import org.junit.jupiter.api.Assertions; - -public final class MailMessageEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MailMessageEntity model = BinaryData.fromString( - "{\"kind\":\"MailMessage\",\"properties\":{\"fileEntityIds\":[\"zjkmmykyujxs\"],\"recipient\":\"hsrrryejylmbkz\",\"urls\":[\"igrfihotjewl\",\"xuzzjgnrefq\",\"hqo\",\"oihiqak\"],\"threats\":[\"wf\",\"rkwpzdqtvhcspod\",\"qaxsipietgbebjf\",\"lbmoichd\"],\"p1Sender\":\"nfpubntnbatz\",\"p1SenderDisplayName\":\"qs\",\"p1SenderDomain\":\"saaelca\",\"senderIP\":\"cjuhplrvkm\",\"p2Sender\":\"wmj\",\"p2SenderDisplayName\":\"gfggcvkyylizrzbj\",\"p2SenderDomain\":\"fxsfuztlvtmv\",\"receiveDate\":\"2021-03-12T08:06:56Z\",\"networkMessageId\":\"9d3ce6ba-4d46-4e09-b8b6-fa300a33f4e9\",\"internetMessageId\":\"dqlvhukoveof\",\"subject\":\"rvjfnmjmvlw\",\"language\":\"giblkujrllf\",\"threatDetectionMethods\":[\"idjpuuyju\",\"ejikzoeovvtzejet\",\"kl\",\"tikyj\"],\"bodyFingerprintBin1\":191041134,\"bodyFingerprintBin2\":1716135154,\"bodyFingerprintBin3\":1169828149,\"bodyFingerprintBin4\":762753424,\"bodyFingerprintBin5\":886631090,\"antispamDirection\":\"Outbound\",\"deliveryAction\":\"DeliveredAsSpam\",\"deliveryLocation\":\"Dropped\",\"additionalData\":{\"zpcrrkolawj\":\"datahtgv\",\"xfzzzwyjafitlhgu\":\"datajsmwrokc\",\"us\":\"datanuchlgmltxdwhmo\",\"pafolp\":\"datazvlnsnnjz\"},\"friendlyName\":\"wamxqzrag\"},\"id\":\"dphtv\",\"name\":\"ulajvlejchc\",\"type\":\"rlzk\"}") - .toObject(MailMessageEntity.class); - Assertions.assertEquals(191041134, model.bodyFingerprintBin1()); - Assertions.assertEquals(1716135154, model.bodyFingerprintBin2()); - Assertions.assertEquals(1169828149, model.bodyFingerprintBin3()); - Assertions.assertEquals(762753424, model.bodyFingerprintBin4()); - Assertions.assertEquals(886631090, model.bodyFingerprintBin5()); - Assertions.assertEquals(AntispamMailDirection.OUTBOUND, model.antispamDirection()); - Assertions.assertEquals(DeliveryAction.DELIVERED_AS_SPAM, model.deliveryAction()); - Assertions.assertEquals(DeliveryLocation.DROPPED, model.deliveryLocation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MailMessageEntity model = new MailMessageEntity().withBodyFingerprintBin1(191041134) - .withBodyFingerprintBin2(1716135154) - .withBodyFingerprintBin3(1169828149) - .withBodyFingerprintBin4(762753424) - .withBodyFingerprintBin5(886631090) - .withAntispamDirection(AntispamMailDirection.OUTBOUND) - .withDeliveryAction(DeliveryAction.DELIVERED_AS_SPAM) - .withDeliveryLocation(DeliveryLocation.DROPPED); - model = BinaryData.fromObject(model).toObject(MailMessageEntity.class); - Assertions.assertEquals(191041134, model.bodyFingerprintBin1()); - Assertions.assertEquals(1716135154, model.bodyFingerprintBin2()); - Assertions.assertEquals(1169828149, model.bodyFingerprintBin3()); - Assertions.assertEquals(762753424, model.bodyFingerprintBin4()); - Assertions.assertEquals(886631090, model.bodyFingerprintBin5()); - Assertions.assertEquals(AntispamMailDirection.OUTBOUND, model.antispamDirection()); - Assertions.assertEquals(DeliveryAction.DELIVERED_AS_SPAM, model.deliveryAction()); - Assertions.assertEquals(DeliveryLocation.DROPPED, model.deliveryLocation()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailboxEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailboxEntityPropertiesTests.java deleted file mode 100644 index 09b4fe1046a2..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailboxEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.MailboxEntityProperties; - -public final class MailboxEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MailboxEntityProperties model = BinaryData.fromString( - "{\"mailboxPrimaryAddress\":\"inqcymczngnbdxxe\",\"displayName\":\"ninvudbchaqdt\",\"upn\":\"ec\",\"externalDirectoryObjectId\":\"dfbd8756-87da-44b5-a09a-a48aac91cf6f\",\"additionalData\":{\"ytxzvtznapxbanno\":\"datamxxdtddmflh\",\"nwvroevytlyokrr\":\"datavoxczytpr\",\"uxvnsasbcrymodi\":\"datao\",\"lmv\":\"datarxklobdxnazpmk\"},\"friendlyName\":\"f\"}") - .toObject(MailboxEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MailboxEntityProperties model = new MailboxEntityProperties(); - model = BinaryData.fromObject(model).toObject(MailboxEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailboxEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailboxEntityTests.java deleted file mode 100644 index f4687c820b5d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MailboxEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.MailboxEntity; - -public final class MailboxEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MailboxEntity model = BinaryData.fromString( - "{\"kind\":\"Mailbox\",\"properties\":{\"mailboxPrimaryAddress\":\"dlpukhpyrne\",\"displayName\":\"jcpeogkhnmg\",\"upn\":\"ouxddbhfhpfpazj\",\"externalDirectoryObjectId\":\"92562bc9-b4d6-4c40-8dfc-867973c0fa94\",\"additionalData\":{\"qwtehtuevr\":\"datajxhpdulontacn\",\"gwbsreurf\":\"datarljyoogwxhnsdu\",\"htkln\":\"datakfuarenlv\"},\"friendlyName\":\"afvvk\"},\"id\":\"edev\",\"name\":\"bo\",\"type\":\"lcqxypokk\"}") - .toObject(MailboxEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MailboxEntity model = new MailboxEntity(); - model = BinaryData.fromObject(model).toObject(MailboxEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MalwareEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MalwareEntityPropertiesTests.java deleted file mode 100644 index 4a4a778d9b2f..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MalwareEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.MalwareEntityProperties; - -public final class MalwareEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MalwareEntityProperties model = BinaryData.fromString( - "{\"category\":\"wxvgpiudeugfsxze\",\"fileEntityIds\":[\"xw\"],\"malwareName\":\"fykhvuhxepmru\",\"processEntityIds\":[\"abaobnslujdjltym\",\"mvguihywart\",\"pphkixkykxds\"],\"additionalData\":{\"kkflrmymyincqlhr\":\"dataemmucfxh\",\"sl\":\"datas\",\"ctotiowlx\":\"dataiiiovgqcgxuugq\"},\"friendlyName\":\"qd\"}") - .toObject(MalwareEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MalwareEntityProperties model = new MalwareEntityProperties(); - model = BinaryData.fromObject(model).toObject(MalwareEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MalwareEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MalwareEntityTests.java deleted file mode 100644 index f67579007a4b..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MalwareEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.MalwareEntity; - -public final class MalwareEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MalwareEntity model = BinaryData.fromString( - "{\"kind\":\"Malware\",\"properties\":{\"category\":\"owxwcomli\",\"fileEntityIds\":[\"wvczcswkacve\"],\"malwareName\":\"fdv\",\"processEntityIds\":[\"b\",\"rnfxtgddp\",\"th\",\"hn\"],\"additionalData\":{\"kcoeqswank\":\"dataoya\",\"tmhdroznnhdr\":\"datat\",\"sggux\":\"dataktgj\",\"ywaeeczgf\":\"dataeml\"},\"friendlyName\":\"kklelssxblycs\"},\"id\":\"ujksrlsmdesqplpv\",\"name\":\"jcdoewb\",\"type\":\"dyvt\"}") - .toObject(MalwareEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MalwareEntity model = new MalwareEntity(); - model = BinaryData.fromObject(model).toObject(MalwareEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorDataTypesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorDataTypesTests.java deleted file mode 100644 index 59f9a5c77adc..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorDataTypesTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.McasDataConnectorDataTypes; -import org.junit.jupiter.api.Assertions; - -public final class McasDataConnectorDataTypesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - McasDataConnectorDataTypes model - = BinaryData.fromString("{\"discoveryLogs\":{\"state\":\"Disabled\"},\"alerts\":{\"state\":\"Enabled\"}}") - .toObject(McasDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.alerts().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.discoveryLogs().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - McasDataConnectorDataTypes model = new McasDataConnectorDataTypes() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED)) - .withDiscoveryLogs(new DataConnectorDataTypeCommon().withState(DataTypeState.DISABLED)); - model = BinaryData.fromObject(model).toObject(McasDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.alerts().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.discoveryLogs().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorPropertiesTests.java deleted file mode 100644 index 36d6666291a0..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorPropertiesTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.McasDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.McasDataConnectorDataTypes; -import org.junit.jupiter.api.Assertions; - -public final class McasDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - McasDataConnectorProperties model = BinaryData.fromString( - "{\"tenantId\":\"q\",\"dataTypes\":{\"discoveryLogs\":{\"state\":\"Disabled\"},\"alerts\":{\"state\":\"Enabled\"}}}") - .toObject(McasDataConnectorProperties.class); - Assertions.assertEquals("q", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().discoveryLogs().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - McasDataConnectorProperties model = new McasDataConnectorProperties().withTenantId("q") - .withDataTypes(new McasDataConnectorDataTypes() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED)) - .withDiscoveryLogs(new DataConnectorDataTypeCommon().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(McasDataConnectorProperties.class); - Assertions.assertEquals("q", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().discoveryLogs().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorTests.java deleted file mode 100644 index 1bd968adb7c4..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/McasDataConnectorTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.McasDataConnector; -import com.azure.resourcemanager.securityinsights.models.McasDataConnectorDataTypes; -import org.junit.jupiter.api.Assertions; - -public final class McasDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - McasDataConnector model = BinaryData.fromString( - "{\"kind\":\"MicrosoftCloudAppSecurity\",\"properties\":{\"tenantId\":\"fczbgom\",\"dataTypes\":{\"discoveryLogs\":{\"state\":\"Enabled\"},\"alerts\":{\"state\":\"Enabled\"}}},\"etag\":\"eohibet\",\"id\":\"uankrrfxeeeb\",\"name\":\"ij\",\"type\":\"acvbmqz\"}") - .toObject(McasDataConnector.class); - Assertions.assertEquals("eohibet", model.etag()); - Assertions.assertEquals("fczbgom", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().discoveryLogs().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - McasDataConnector model = new McasDataConnector().withEtag("eohibet") - .withTenantId("fczbgom") - .withDataTypes(new McasDataConnectorDataTypes() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED)) - .withDiscoveryLogs(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(McasDataConnector.class); - Assertions.assertEquals("eohibet", model.etag()); - Assertions.assertEquals("fczbgom", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().discoveryLogs().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MdatpDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MdatpDataConnectorPropertiesTests.java deleted file mode 100644 index 08302f47ba11..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MdatpDataConnectorPropertiesTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.MdatpDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import org.junit.jupiter.api.Assertions; - -public final class MdatpDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MdatpDataConnectorProperties model - = BinaryData.fromString("{\"tenantId\":\"h\",\"dataTypes\":{\"alerts\":{\"state\":\"Disabled\"}}}") - .toObject(MdatpDataConnectorProperties.class); - Assertions.assertEquals("h", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MdatpDataConnectorProperties model = new MdatpDataConnectorProperties().withTenantId("h") - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(MdatpDataConnectorProperties.class); - Assertions.assertEquals("h", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MdatpDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MdatpDataConnectorTests.java deleted file mode 100644 index 6de9dd38eb44..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MdatpDataConnectorTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertsDataTypeOfDataConnector; -import com.azure.resourcemanager.securityinsights.models.DataConnectorDataTypeCommon; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.MdatpDataConnector; -import org.junit.jupiter.api.Assertions; - -public final class MdatpDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MdatpDataConnector model = BinaryData.fromString( - "{\"kind\":\"MicrosoftDefenderAdvancedThreatProtection\",\"properties\":{\"tenantId\":\"uyxoaf\",\"dataTypes\":{\"alerts\":{\"state\":\"Enabled\"}}},\"etag\":\"faey\",\"id\":\"nm\",\"name\":\"gv\",\"type\":\"irpghriypoqeyh\"}") - .toObject(MdatpDataConnector.class); - Assertions.assertEquals("faey", model.etag()); - Assertions.assertEquals("uyxoaf", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MdatpDataConnector model = new MdatpDataConnector().withEtag("faey") - .withTenantId("uyxoaf") - .withDataTypes(new AlertsDataTypeOfDataConnector() - .withAlerts(new DataConnectorDataTypeCommon().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(MdatpDataConnector.class); - Assertions.assertEquals("faey", model.etag()); - Assertions.assertEquals("uyxoaf", model.tenantId()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().alerts().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleCommonPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleCommonPropertiesTests.java deleted file mode 100644 index 17d2fb4745ab..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleCommonPropertiesTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRuleCommonProperties; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MicrosoftSecurityIncidentCreationAlertRuleCommonPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleCommonProperties model = BinaryData.fromString( - "{\"displayNamesFilter\":[\"kvvjgslordilmyww\",\"kgkxn\",\"edabgyvudtjue\"],\"displayNamesExcludeFilter\":[\"ihxuuwh\",\"j\",\"xccybvpa\"],\"productFilter\":\"Azure Active Directory Identity Protection\",\"severitiesFilter\":[\"Informational\",\"Low\",\"High\"]}") - .toObject(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.class); - Assertions.assertEquals("kvvjgslordilmyww", model.displayNamesFilter().get(0)); - Assertions.assertEquals("ihxuuwh", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_ACTIVE_DIRECTORY_IDENTITY_PROTECTION, - model.productFilter()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severitiesFilter().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleCommonProperties model - = new MicrosoftSecurityIncidentCreationAlertRuleCommonProperties() - .withDisplayNamesFilter(Arrays.asList("kvvjgslordilmyww", "kgkxn", "edabgyvudtjue")) - .withDisplayNamesExcludeFilter(Arrays.asList("ihxuuwh", "j", "xccybvpa")) - .withProductFilter(MicrosoftSecurityProductName.AZURE_ACTIVE_DIRECTORY_IDENTITY_PROTECTION) - .withSeveritiesFilter( - Arrays.asList(AlertSeverity.INFORMATIONAL, AlertSeverity.LOW, AlertSeverity.HIGH)); - model = BinaryData.fromObject(model).toObject(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.class); - Assertions.assertEquals("kvvjgslordilmyww", model.displayNamesFilter().get(0)); - Assertions.assertEquals("ihxuuwh", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_ACTIVE_DIRECTORY_IDENTITY_PROTECTION, - model.productFilter()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severitiesFilter().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRulePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRulePropertiesTests.java deleted file mode 100644 index f60184a18c02..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRulePropertiesTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.MicrosoftSecurityIncidentCreationAlertRuleProperties; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MicrosoftSecurityIncidentCreationAlertRulePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleProperties model = BinaryData.fromString( - "{\"alertRuleTemplateName\":\"zivj\",\"description\":\"rqttbajlkatnw\",\"displayName\":\"yiopi\",\"enabled\":false,\"lastModifiedUtc\":\"2021-07-26T10:21:10Z\",\"displayNamesFilter\":[\"uvscxkdmligov\",\"brxk\",\"mloazuru\"],\"displayNamesExcludeFilter\":[\"goorbteo\"],\"productFilter\":\"Azure Security Center for IoT\",\"severitiesFilter\":[\"Medium\"]}") - .toObject(MicrosoftSecurityIncidentCreationAlertRuleProperties.class); - Assertions.assertEquals("uvscxkdmligov", model.displayNamesFilter().get(0)); - Assertions.assertEquals("goorbteo", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_SECURITY_CENTER_FOR_IOT, model.productFilter()); - Assertions.assertEquals(AlertSeverity.MEDIUM, model.severitiesFilter().get(0)); - Assertions.assertEquals("zivj", model.alertRuleTemplateName()); - Assertions.assertEquals("rqttbajlkatnw", model.description()); - Assertions.assertEquals("yiopi", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleProperties model - = new MicrosoftSecurityIncidentCreationAlertRuleProperties() - .withDisplayNamesFilter(Arrays.asList("uvscxkdmligov", "brxk", "mloazuru")) - .withDisplayNamesExcludeFilter(Arrays.asList("goorbteo")) - .withProductFilter(MicrosoftSecurityProductName.AZURE_SECURITY_CENTER_FOR_IOT) - .withSeveritiesFilter(Arrays.asList(AlertSeverity.MEDIUM)) - .withAlertRuleTemplateName("zivj") - .withDescription("rqttbajlkatnw") - .withDisplayName("yiopi") - .withEnabled(false); - model = BinaryData.fromObject(model).toObject(MicrosoftSecurityIncidentCreationAlertRuleProperties.class); - Assertions.assertEquals("uvscxkdmligov", model.displayNamesFilter().get(0)); - Assertions.assertEquals("goorbteo", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_SECURITY_CENTER_FOR_IOT, model.productFilter()); - Assertions.assertEquals(AlertSeverity.MEDIUM, model.severitiesFilter().get(0)); - Assertions.assertEquals("zivj", model.alertRuleTemplateName()); - Assertions.assertEquals("rqttbajlkatnw", model.description()); - Assertions.assertEquals("yiopi", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTemplatePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTemplatePropertiesTests.java deleted file mode 100644 index 3f69b1f77edb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTemplatePropertiesTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; -import com.azure.resourcemanager.securityinsights.models.TemplateStatus; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MicrosoftSecurityIncidentCreationAlertRuleTemplatePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties model = BinaryData.fromString( - "{\"alertRulesCreatedByTemplateCount\":595342906,\"createdDateUTC\":\"2021-11-02T17:47:35Z\",\"lastUpdatedDateUTC\":\"2021-04-11T00:27:16Z\",\"description\":\"xrkjpvdw\",\"displayName\":\"zwiivwzjbhyzs\",\"requiredDataConnectors\":[{\"connectorId\":\"ambtrnegvm\",\"dataTypes\":[\"q\",\"qvldspastjbkkd\"]},{\"connectorId\":\"lves\",\"dataTypes\":[\"lx\"]}],\"status\":\"Available\",\"displayNamesFilter\":[\"zapeewchpx\",\"ktwkuziyc\"],\"displayNamesExcludeFilter\":[\"vu\",\"uztcktyhjtqed\",\"gzulwmmrqzzr\"],\"productFilter\":\"Microsoft Cloud App Security\",\"severitiesFilter\":[\"High\",\"Medium\"]}") - .toObject(MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.class); - Assertions.assertEquals(595342906, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("xrkjpvdw", model.description()); - Assertions.assertEquals("zwiivwzjbhyzs", model.displayName()); - Assertions.assertEquals("ambtrnegvm", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("q", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.AVAILABLE, model.status()); - Assertions.assertEquals("zapeewchpx", model.displayNamesFilter().get(0)); - Assertions.assertEquals("vu", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.MICROSOFT_CLOUD_APP_SECURITY, model.productFilter()); - Assertions.assertEquals(AlertSeverity.HIGH, model.severitiesFilter().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties model - = new MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties() - .withAlertRulesCreatedByTemplateCount(595342906) - .withDescription("xrkjpvdw") - .withDisplayName("zwiivwzjbhyzs") - .withRequiredDataConnectors(Arrays.asList( - new AlertRuleTemplateDataSource().withConnectorId("ambtrnegvm") - .withDataTypes(Arrays.asList("q", "qvldspastjbkkd")), - new AlertRuleTemplateDataSource().withConnectorId("lves").withDataTypes(Arrays.asList("lx")))) - .withStatus(TemplateStatus.AVAILABLE) - .withDisplayNamesFilter(Arrays.asList("zapeewchpx", "ktwkuziyc")) - .withDisplayNamesExcludeFilter(Arrays.asList("vu", "uztcktyhjtqed", "gzulwmmrqzzr")) - .withProductFilter(MicrosoftSecurityProductName.MICROSOFT_CLOUD_APP_SECURITY) - .withSeveritiesFilter(Arrays.asList(AlertSeverity.HIGH, AlertSeverity.MEDIUM)); - model - = BinaryData.fromObject(model).toObject(MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties.class); - Assertions.assertEquals(595342906, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("xrkjpvdw", model.description()); - Assertions.assertEquals("zwiivwzjbhyzs", model.displayName()); - Assertions.assertEquals("ambtrnegvm", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("q", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.AVAILABLE, model.status()); - Assertions.assertEquals("zapeewchpx", model.displayNamesFilter().get(0)); - Assertions.assertEquals("vu", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.MICROSOFT_CLOUD_APP_SECURITY, model.productFilter()); - Assertions.assertEquals(AlertSeverity.HIGH, model.severitiesFilter().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTemplateTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTemplateTests.java deleted file mode 100644 index 376a240b9f17..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTemplateTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRuleTemplate; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; -import com.azure.resourcemanager.securityinsights.models.TemplateStatus; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MicrosoftSecurityIncidentCreationAlertRuleTemplateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleTemplate model = BinaryData.fromString( - "{\"kind\":\"MicrosoftSecurityIncidentCreation\",\"properties\":{\"alertRulesCreatedByTemplateCount\":2015749730,\"createdDateUTC\":\"2021-11-14T05:13:38Z\",\"lastUpdatedDateUTC\":\"2021-07-01T17:47:57Z\",\"description\":\"agst\",\"displayName\":\"ohpfkyrkdbdgiog\",\"requiredDataConnectors\":[{\"connectorId\":\"nwqjnoba\",\"dataTypes\":[\"ddviacegfnmntfpm\"]},{\"connectorId\":\"emfnczdwvvbal\",\"dataTypes\":[\"lchpodbzevwrdn\"]},{\"connectorId\":\"ukuv\",\"dataTypes\":[\"swsmys\",\"uluqypfc\",\"lerchpq\"]},{\"connectorId\":\"f\",\"dataTypes\":[\"abwidfcxsspuun\",\"oxyhkxgqddrihpf\",\"oqcaaewdaomdj\"]}],\"status\":\"Installed\",\"displayNamesFilter\":[\"xkzb\"],\"displayNamesExcludeFilter\":[\"geivsiykzkdncj\",\"xonbzoggculapz\"],\"productFilter\":\"Azure Advanced Threat Protection\",\"severitiesFilter\":[\"Informational\",\"Low\",\"Medium\"]},\"id\":\"qxepnylbfuaj\",\"name\":\"yjt\",\"type\":\"vofqzhvfc\"}") - .toObject(MicrosoftSecurityIncidentCreationAlertRuleTemplate.class); - Assertions.assertEquals(2015749730, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("agst", model.description()); - Assertions.assertEquals("ohpfkyrkdbdgiog", model.displayName()); - Assertions.assertEquals("nwqjnoba", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("ddviacegfnmntfpm", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.INSTALLED, model.status()); - Assertions.assertEquals("xkzb", model.displayNamesFilter().get(0)); - Assertions.assertEquals("geivsiykzkdncj", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_ADVANCED_THREAT_PROTECTION, model.productFilter()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severitiesFilter().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRuleTemplate model - = new MicrosoftSecurityIncidentCreationAlertRuleTemplate().withAlertRulesCreatedByTemplateCount(2015749730) - .withDescription("agst") - .withDisplayName("ohpfkyrkdbdgiog") - .withRequiredDataConnectors(Arrays.asList( - new AlertRuleTemplateDataSource().withConnectorId("nwqjnoba") - .withDataTypes(Arrays.asList("ddviacegfnmntfpm")), - new AlertRuleTemplateDataSource().withConnectorId("emfnczdwvvbal") - .withDataTypes(Arrays.asList("lchpodbzevwrdn")), - new AlertRuleTemplateDataSource().withConnectorId("ukuv") - .withDataTypes(Arrays.asList("swsmys", "uluqypfc", "lerchpq")), - new AlertRuleTemplateDataSource().withConnectorId("f") - .withDataTypes(Arrays.asList("abwidfcxsspuun", "oxyhkxgqddrihpf", "oqcaaewdaomdj")))) - .withStatus(TemplateStatus.INSTALLED) - .withDisplayNamesFilter(Arrays.asList("xkzb")) - .withDisplayNamesExcludeFilter(Arrays.asList("geivsiykzkdncj", "xonbzoggculapz")) - .withProductFilter(MicrosoftSecurityProductName.AZURE_ADVANCED_THREAT_PROTECTION) - .withSeveritiesFilter( - Arrays.asList(AlertSeverity.INFORMATIONAL, AlertSeverity.LOW, AlertSeverity.MEDIUM)); - model = BinaryData.fromObject(model).toObject(MicrosoftSecurityIncidentCreationAlertRuleTemplate.class); - Assertions.assertEquals(2015749730, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("agst", model.description()); - Assertions.assertEquals("ohpfkyrkdbdgiog", model.displayName()); - Assertions.assertEquals("nwqjnoba", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("ddviacegfnmntfpm", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.INSTALLED, model.status()); - Assertions.assertEquals("xkzb", model.displayNamesFilter().get(0)); - Assertions.assertEquals("geivsiykzkdncj", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_ADVANCED_THREAT_PROTECTION, model.productFilter()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severitiesFilter().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTests.java deleted file mode 100644 index 254b46871b89..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/MicrosoftSecurityIncidentCreationAlertRuleTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityIncidentCreationAlertRule; -import com.azure.resourcemanager.securityinsights.models.MicrosoftSecurityProductName; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MicrosoftSecurityIncidentCreationAlertRuleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRule model = BinaryData.fromString( - "{\"kind\":\"MicrosoftSecurityIncidentCreation\",\"properties\":{\"alertRuleTemplateName\":\"mlqoljx\",\"description\":\"gxxlxsffgcvizq\",\"displayName\":\"dwl\",\"enabled\":false,\"lastModifiedUtc\":\"2021-04-26T05:35:21Z\",\"displayNamesFilter\":[\"pfgfbkjub\",\"yhgk\"],\"displayNamesExcludeFilter\":[\"nsgowzfttst\"],\"productFilter\":\"Azure Advanced Threat Protection\",\"severitiesFilter\":[\"Informational\"]},\"etag\":\"bqactxtgzukx\",\"id\":\"mmqtgqqqxhr\",\"name\":\"xrxc\",\"type\":\"juisavokqdzf\"}") - .toObject(MicrosoftSecurityIncidentCreationAlertRule.class); - Assertions.assertEquals("bqactxtgzukx", model.etag()); - Assertions.assertEquals("mlqoljx", model.alertRuleTemplateName()); - Assertions.assertEquals("gxxlxsffgcvizq", model.description()); - Assertions.assertEquals("dwl", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - Assertions.assertEquals("pfgfbkjub", model.displayNamesFilter().get(0)); - Assertions.assertEquals("nsgowzfttst", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_ADVANCED_THREAT_PROTECTION, model.productFilter()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severitiesFilter().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MicrosoftSecurityIncidentCreationAlertRule model - = new MicrosoftSecurityIncidentCreationAlertRule().withEtag("bqactxtgzukx") - .withAlertRuleTemplateName("mlqoljx") - .withDescription("gxxlxsffgcvizq") - .withDisplayName("dwl") - .withEnabled(false) - .withDisplayNamesFilter(Arrays.asList("pfgfbkjub", "yhgk")) - .withDisplayNamesExcludeFilter(Arrays.asList("nsgowzfttst")) - .withProductFilter(MicrosoftSecurityProductName.AZURE_ADVANCED_THREAT_PROTECTION) - .withSeveritiesFilter(Arrays.asList(AlertSeverity.INFORMATIONAL)); - model = BinaryData.fromObject(model).toObject(MicrosoftSecurityIncidentCreationAlertRule.class); - Assertions.assertEquals("bqactxtgzukx", model.etag()); - Assertions.assertEquals("mlqoljx", model.alertRuleTemplateName()); - Assertions.assertEquals("gxxlxsffgcvizq", model.description()); - Assertions.assertEquals("dwl", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - Assertions.assertEquals("pfgfbkjub", model.displayNamesFilter().get(0)); - Assertions.assertEquals("nsgowzfttst", model.displayNamesExcludeFilter().get(0)); - Assertions.assertEquals(MicrosoftSecurityProductName.AZURE_ADVANCED_THREAT_PROTECTION, model.productFilter()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severitiesFilter().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesExchangeTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesExchangeTests.java deleted file mode 100644 index eb813ee10797..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesExchangeTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesExchange; -import org.junit.jupiter.api.Assertions; - -public final class OfficeDataConnectorDataTypesExchangeTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfficeDataConnectorDataTypesExchange model - = BinaryData.fromString("{\"state\":\"Enabled\"}").toObject(OfficeDataConnectorDataTypesExchange.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfficeDataConnectorDataTypesExchange model - = new OfficeDataConnectorDataTypesExchange().withState(DataTypeState.ENABLED); - model = BinaryData.fromObject(model).toObject(OfficeDataConnectorDataTypesExchange.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesSharePointTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesSharePointTests.java deleted file mode 100644 index deb9127be6b2..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesSharePointTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesSharePoint; -import org.junit.jupiter.api.Assertions; - -public final class OfficeDataConnectorDataTypesSharePointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfficeDataConnectorDataTypesSharePoint model - = BinaryData.fromString("{\"state\":\"Enabled\"}").toObject(OfficeDataConnectorDataTypesSharePoint.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfficeDataConnectorDataTypesSharePoint model - = new OfficeDataConnectorDataTypesSharePoint().withState(DataTypeState.ENABLED); - model = BinaryData.fromObject(model).toObject(OfficeDataConnectorDataTypesSharePoint.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesTeamsTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesTeamsTests.java deleted file mode 100644 index fd205a62a1d4..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesTeamsTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesTeams; -import org.junit.jupiter.api.Assertions; - -public final class OfficeDataConnectorDataTypesTeamsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfficeDataConnectorDataTypesTeams model - = BinaryData.fromString("{\"state\":\"Disabled\"}").toObject(OfficeDataConnectorDataTypesTeams.class); - Assertions.assertEquals(DataTypeState.DISABLED, model.state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfficeDataConnectorDataTypesTeams model - = new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.DISABLED); - model = BinaryData.fromObject(model).toObject(OfficeDataConnectorDataTypesTeams.class); - Assertions.assertEquals(DataTypeState.DISABLED, model.state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesTests.java deleted file mode 100644 index 65a77237bdac..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorDataTypesTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesExchange; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesSharePoint; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesTeams; -import org.junit.jupiter.api.Assertions; - -public final class OfficeDataConnectorDataTypesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfficeDataConnectorDataTypes model = BinaryData.fromString( - "{\"exchange\":{\"state\":\"Disabled\"},\"sharePoint\":{\"state\":\"Disabled\"},\"teams\":{\"state\":\"Disabled\"}}") - .toObject(OfficeDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.DISABLED, model.exchange().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.sharePoint().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.teams().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfficeDataConnectorDataTypes model = new OfficeDataConnectorDataTypes() - .withExchange(new OfficeDataConnectorDataTypesExchange().withState(DataTypeState.DISABLED)) - .withSharePoint(new OfficeDataConnectorDataTypesSharePoint().withState(DataTypeState.DISABLED)) - .withTeams(new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.DISABLED)); - model = BinaryData.fromObject(model).toObject(OfficeDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.DISABLED, model.exchange().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.sharePoint().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.teams().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorPropertiesTests.java deleted file mode 100644 index 31105e91509f..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorPropertiesTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.OfficeDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesExchange; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesSharePoint; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesTeams; -import org.junit.jupiter.api.Assertions; - -public final class OfficeDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfficeDataConnectorProperties model = BinaryData.fromString( - "{\"tenantId\":\"sufco\",\"dataTypes\":{\"exchange\":{\"state\":\"Disabled\"},\"sharePoint\":{\"state\":\"Disabled\"},\"teams\":{\"state\":\"Enabled\"}}}") - .toObject(OfficeDataConnectorProperties.class); - Assertions.assertEquals("sufco", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().exchange().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().sharePoint().state()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().teams().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfficeDataConnectorProperties model = new OfficeDataConnectorProperties().withTenantId("sufco") - .withDataTypes(new OfficeDataConnectorDataTypes() - .withExchange(new OfficeDataConnectorDataTypesExchange().withState(DataTypeState.DISABLED)) - .withSharePoint(new OfficeDataConnectorDataTypesSharePoint().withState(DataTypeState.DISABLED)) - .withTeams(new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.ENABLED))); - model = BinaryData.fromObject(model).toObject(OfficeDataConnectorProperties.class); - Assertions.assertEquals("sufco", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().exchange().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().sharePoint().state()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().teams().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorTests.java deleted file mode 100644 index d29a13610487..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OfficeDataConnectorTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnector; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesExchange; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesSharePoint; -import com.azure.resourcemanager.securityinsights.models.OfficeDataConnectorDataTypesTeams; -import org.junit.jupiter.api.Assertions; - -public final class OfficeDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OfficeDataConnector model = BinaryData.fromString( - "{\"kind\":\"Office365\",\"properties\":{\"tenantId\":\"mdtzfjltfvnzc\",\"dataTypes\":{\"exchange\":{\"state\":\"Disabled\"},\"sharePoint\":{\"state\":\"Enabled\"},\"teams\":{\"state\":\"Disabled\"}}},\"etag\":\"dbzqgqqihed\",\"id\":\"qwthmky\",\"name\":\"bcysih\",\"type\":\"gqcwdhohsdtmc\"}") - .toObject(OfficeDataConnector.class); - Assertions.assertEquals("dbzqgqqihed", model.etag()); - Assertions.assertEquals("mdtzfjltfvnzc", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().exchange().state()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().sharePoint().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().teams().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OfficeDataConnector model = new OfficeDataConnector().withEtag("dbzqgqqihed") - .withTenantId("mdtzfjltfvnzc") - .withDataTypes(new OfficeDataConnectorDataTypes() - .withExchange(new OfficeDataConnectorDataTypesExchange().withState(DataTypeState.DISABLED)) - .withSharePoint(new OfficeDataConnectorDataTypesSharePoint().withState(DataTypeState.ENABLED)) - .withTeams(new OfficeDataConnectorDataTypesTeams().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(OfficeDataConnector.class); - Assertions.assertEquals("dbzqgqqihed", model.etag()); - Assertions.assertEquals("mdtzfjltfvnzc", model.tenantId()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().exchange().state()); - Assertions.assertEquals(DataTypeState.ENABLED, model.dataTypes().sharePoint().state()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().teams().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationDisplayTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationDisplayTests.java deleted file mode 100644 index 6bcfa53f8d29..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationDisplayTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = BinaryData.fromString( - "{\"description\":\"ltfnhtbaxkgx\",\"operation\":\"rc\",\"provider\":\"yklyhpluodpvruud\",\"resource\":\"zibt\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("ltfnhtbaxkgx", model.description()); - Assertions.assertEquals("rc", model.operation()); - Assertions.assertEquals("yklyhpluodpvruud", model.provider()); - Assertions.assertEquals("zibt", model.resource()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay().withDescription("ltfnhtbaxkgx") - .withOperation("rc") - .withProvider("yklyhpluodpvruud") - .withResource("zibt"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("ltfnhtbaxkgx", model.description()); - Assertions.assertEquals("rc", model.operation()); - Assertions.assertEquals("yklyhpluodpvruud", model.provider()); - Assertions.assertEquals("zibt", model.resource()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationInnerTests.java deleted file mode 100644 index 5cfeb601aeb5..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationInnerTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.OperationInner; -import com.azure.resourcemanager.securityinsights.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = BinaryData.fromString( - "{\"display\":{\"description\":\"nssxmojmsvpk\",\"operation\":\"rvkwc\",\"provider\":\"ql\",\"resource\":\"x\"},\"name\":\"czheyd\",\"origin\":\"dshmkxmaehvbbx\",\"isDataAction\":false}") - .toObject(OperationInner.class); - Assertions.assertEquals("nssxmojmsvpk", model.display().description()); - Assertions.assertEquals("rvkwc", model.display().operation()); - Assertions.assertEquals("ql", model.display().provider()); - Assertions.assertEquals("x", model.display().resource()); - Assertions.assertEquals("czheyd", model.name()); - Assertions.assertEquals("dshmkxmaehvbbx", model.origin()); - Assertions.assertEquals(false, model.isDataAction()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay().withDescription("nssxmojmsvpk") - .withOperation("rvkwc") - .withProvider("ql") - .withResource("x")).withName("czheyd").withOrigin("dshmkxmaehvbbx").withIsDataAction(false); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - Assertions.assertEquals("nssxmojmsvpk", model.display().description()); - Assertions.assertEquals("rvkwc", model.display().operation()); - Assertions.assertEquals("ql", model.display().provider()); - Assertions.assertEquals("x", model.display().resource()); - Assertions.assertEquals("czheyd", model.name()); - Assertions.assertEquals("dshmkxmaehvbbx", model.origin()); - Assertions.assertEquals(false, model.isDataAction()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationsListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationsListMockTests.java deleted file mode 100644 index de2d8d90d1e1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationsListMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.Operation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"display\":{\"description\":\"xzajlnsjhwjuyxxb\",\"operation\":\"vmv\",\"provider\":\"ytuadxkxeqbwp\",\"resource\":\"ghyksarcdrnxs\"},\"name\":\"vlzladl\",\"origin\":\"kpbqhvfdqqjw\",\"isDataAction\":true}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("xzajlnsjhwjuyxxb", response.iterator().next().display().description()); - Assertions.assertEquals("vmv", response.iterator().next().display().operation()); - Assertions.assertEquals("ytuadxkxeqbwp", response.iterator().next().display().provider()); - Assertions.assertEquals("ghyksarcdrnxs", response.iterator().next().display().resource()); - Assertions.assertEquals("vlzladl", response.iterator().next().name()); - Assertions.assertEquals("kpbqhvfdqqjw", response.iterator().next().origin()); - Assertions.assertEquals(true, response.iterator().next().isDataAction()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationsListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationsListTests.java deleted file mode 100644 index 13a54a85bae1..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/OperationsListTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.OperationInner; -import com.azure.resourcemanager.securityinsights.models.OperationDisplay; -import com.azure.resourcemanager.securityinsights.models.OperationsList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationsListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationsList model = BinaryData.fromString( - "{\"nextLink\":\"txifqj\",\"value\":[{\"display\":{\"description\":\"rhublwpcesutrg\",\"operation\":\"pauutpw\",\"provider\":\"hihejqgwzpnfqn\",\"resource\":\"ypsxjvfoim\"},\"name\":\"slirciz\",\"origin\":\"vydfceacvlhvygdy\",\"isDataAction\":true},{\"display\":{\"description\":\"twnawjslbiwkojgc\",\"operation\":\"tsf\",\"provider\":\"nbaeqphchqn\",\"resource\":\"rpxeh\"},\"name\":\"rykqgaifmvikl\",\"origin\":\"dvk\",\"isDataAction\":false},{\"display\":{\"description\":\"znxcvds\",\"operation\":\"njivolvtnovq\",\"provider\":\"gemjdftuljltdu\",\"resource\":\"amtmcz\"},\"name\":\"m\",\"origin\":\"wcw\",\"isDataAction\":true}]}") - .toObject(OperationsList.class); - Assertions.assertEquals("rhublwpcesutrg", model.value().get(0).display().description()); - Assertions.assertEquals("pauutpw", model.value().get(0).display().operation()); - Assertions.assertEquals("hihejqgwzpnfqn", model.value().get(0).display().provider()); - Assertions.assertEquals("ypsxjvfoim", model.value().get(0).display().resource()); - Assertions.assertEquals("slirciz", model.value().get(0).name()); - Assertions.assertEquals("vydfceacvlhvygdy", model.value().get(0).origin()); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationsList model - = new OperationsList() - .withValue( - Arrays.asList( - new OperationInner() - .withDisplay(new OperationDisplay().withDescription("rhublwpcesutrg") - .withOperation("pauutpw") - .withProvider("hihejqgwzpnfqn") - .withResource("ypsxjvfoim")) - .withName("slirciz") - .withOrigin("vydfceacvlhvygdy") - .withIsDataAction(true), - new OperationInner() - .withDisplay(new OperationDisplay().withDescription("twnawjslbiwkojgc") - .withOperation("tsf") - .withProvider("nbaeqphchqn") - .withResource("rpxeh")) - .withName("rykqgaifmvikl") - .withOrigin("dvk") - .withIsDataAction(false), - new OperationInner().withDisplay(new OperationDisplay().withDescription("znxcvds") - .withOperation("njivolvtnovq") - .withProvider("gemjdftuljltdu") - .withResource("amtmcz")).withName("m").withOrigin("wcw").withIsDataAction(true))); - model = BinaryData.fromObject(model).toObject(OperationsList.class); - Assertions.assertEquals("rhublwpcesutrg", model.value().get(0).display().description()); - Assertions.assertEquals("pauutpw", model.value().get(0).display().operation()); - Assertions.assertEquals("hihejqgwzpnfqn", model.value().get(0).display().provider()); - Assertions.assertEquals("ypsxjvfoim", model.value().get(0).display().resource()); - Assertions.assertEquals("slirciz", model.value().get(0).name()); - Assertions.assertEquals("vydfceacvlhvygdy", model.value().get(0).origin()); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PlaybookActionPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PlaybookActionPropertiesTests.java deleted file mode 100644 index 3e8a9e418ff2..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PlaybookActionPropertiesTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.PlaybookActionProperties; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class PlaybookActionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PlaybookActionProperties model = BinaryData - .fromString("{\"logicAppResourceId\":\"v\",\"tenantId\":\"47ec73ff-0a55-4f22-8db8-cbf311a170e2\"}") - .toObject(PlaybookActionProperties.class); - Assertions.assertEquals("v", model.logicAppResourceId()); - Assertions.assertEquals(UUID.fromString("47ec73ff-0a55-4f22-8db8-cbf311a170e2"), model.tenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PlaybookActionProperties model = new PlaybookActionProperties().withLogicAppResourceId("v") - .withTenantId(UUID.fromString("47ec73ff-0a55-4f22-8db8-cbf311a170e2")); - model = BinaryData.fromObject(model).toObject(PlaybookActionProperties.class); - Assertions.assertEquals("v", model.logicAppResourceId()); - Assertions.assertEquals(UUID.fromString("47ec73ff-0a55-4f22-8db8-cbf311a170e2"), model.tenantId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyArrayChangedConditionPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyArrayChangedConditionPropertiesTests.java deleted file mode 100644 index 5fda8d5445bb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyArrayChangedConditionPropertiesTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyArrayChangedConditionSupportedArrayType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyArrayChangedConditionSupportedChangeType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyArrayChangedValuesCondition; -import com.azure.resourcemanager.securityinsights.models.PropertyArrayChangedConditionProperties; -import org.junit.jupiter.api.Assertions; - -public final class PropertyArrayChangedConditionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PropertyArrayChangedConditionProperties model = BinaryData.fromString( - "{\"conditionType\":\"PropertyArrayChanged\",\"conditionProperties\":{\"arrayType\":\"Labels\",\"changeType\":\"Added\"}}") - .toObject(PropertyArrayChangedConditionProperties.class); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedArrayType.LABELS, - model.conditionProperties().arrayType()); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedChangeType.ADDED, - model.conditionProperties().changeType()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PropertyArrayChangedConditionProperties model = new PropertyArrayChangedConditionProperties() - .withConditionProperties(new AutomationRulePropertyArrayChangedValuesCondition() - .withArrayType(AutomationRulePropertyArrayChangedConditionSupportedArrayType.LABELS) - .withChangeType(AutomationRulePropertyArrayChangedConditionSupportedChangeType.ADDED)); - model = BinaryData.fromObject(model).toObject(PropertyArrayChangedConditionProperties.class); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedArrayType.LABELS, - model.conditionProperties().arrayType()); - Assertions.assertEquals(AutomationRulePropertyArrayChangedConditionSupportedChangeType.ADDED, - model.conditionProperties().changeType()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyChangedConditionPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyChangedConditionPropertiesTests.java deleted file mode 100644 index 11b5c1055e10..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyChangedConditionPropertiesTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyChangedConditionSupportedChangedType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyChangedConditionSupportedPropertyType; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyConditionSupportedOperator; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyValuesChangedCondition; -import com.azure.resourcemanager.securityinsights.models.PropertyChangedConditionProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PropertyChangedConditionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PropertyChangedConditionProperties model = BinaryData.fromString( - "{\"conditionType\":\"PropertyChanged\",\"conditionProperties\":{\"propertyName\":\"IncidentStatus\",\"changeType\":\"ChangedTo\",\"operator\":\"NotStartsWith\",\"propertyValues\":[\"kdasvflyhbxcudch\",\"gsrboldforobw\"]}}") - .toObject(PropertyChangedConditionProperties.class); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedPropertyType.INCIDENT_STATUS, - model.conditionProperties().propertyName()); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedChangedType.CHANGED_TO, - model.conditionProperties().changeType()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.NOT_STARTS_WITH, - model.conditionProperties().operator()); - Assertions.assertEquals("kdasvflyhbxcudch", model.conditionProperties().propertyValues().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PropertyChangedConditionProperties model = new PropertyChangedConditionProperties() - .withConditionProperties(new AutomationRulePropertyValuesChangedCondition() - .withPropertyName(AutomationRulePropertyChangedConditionSupportedPropertyType.INCIDENT_STATUS) - .withChangeType(AutomationRulePropertyChangedConditionSupportedChangedType.CHANGED_TO) - .withOperator(AutomationRulePropertyConditionSupportedOperator.NOT_STARTS_WITH) - .withPropertyValues(Arrays.asList("kdasvflyhbxcudch", "gsrboldforobw"))); - model = BinaryData.fromObject(model).toObject(PropertyChangedConditionProperties.class); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedPropertyType.INCIDENT_STATUS, - model.conditionProperties().propertyName()); - Assertions.assertEquals(AutomationRulePropertyChangedConditionSupportedChangedType.CHANGED_TO, - model.conditionProperties().changeType()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.NOT_STARTS_WITH, - model.conditionProperties().operator()); - Assertions.assertEquals("kdasvflyhbxcudch", model.conditionProperties().propertyValues().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyConditionPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyConditionPropertiesTests.java deleted file mode 100644 index f06d0a73e90f..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/PropertyConditionPropertiesTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyConditionSupportedOperator; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyConditionSupportedProperty; -import com.azure.resourcemanager.securityinsights.models.AutomationRulePropertyValuesCondition; -import com.azure.resourcemanager.securityinsights.models.PropertyConditionProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PropertyConditionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PropertyConditionProperties model = BinaryData.fromString( - "{\"conditionType\":\"Property\",\"conditionProperties\":{\"propertyName\":\"HostAzureID\",\"operator\":\"NotStartsWith\",\"propertyValues\":[\"fovvacqpbtuodxes\",\"abbelawumuaslzk\",\"rrwoycqucwyhahn\"]}}") - .toObject(PropertyConditionProperties.class); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedProperty.HOST_AZURE_ID, - model.conditionProperties().propertyName()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.NOT_STARTS_WITH, - model.conditionProperties().operator()); - Assertions.assertEquals("fovvacqpbtuodxes", model.conditionProperties().propertyValues().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PropertyConditionProperties model - = new PropertyConditionProperties().withConditionProperties(new AutomationRulePropertyValuesCondition() - .withPropertyName(AutomationRulePropertyConditionSupportedProperty.HOST_AZURE_ID) - .withOperator(AutomationRulePropertyConditionSupportedOperator.NOT_STARTS_WITH) - .withPropertyValues(Arrays.asList("fovvacqpbtuodxes", "abbelawumuaslzk", "rrwoycqucwyhahn"))); - model = BinaryData.fromObject(model).toObject(PropertyConditionProperties.class); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedProperty.HOST_AZURE_ID, - model.conditionProperties().propertyName()); - Assertions.assertEquals(AutomationRulePropertyConditionSupportedOperator.NOT_STARTS_WITH, - model.conditionProperties().operator()); - Assertions.assertEquals("fovvacqpbtuodxes", model.conditionProperties().propertyValues().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationInnerTests.java deleted file mode 100644 index dbd4898197a0..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationInnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; -import org.junit.jupiter.api.Assertions; - -public final class RelationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RelationInner model = BinaryData.fromString( - "{\"properties\":{\"relatedResourceId\":\"wlycoduhpkxkg\",\"relatedResourceName\":\"areqna\",\"relatedResourceType\":\"qugjhkycube\",\"relatedResourceKind\":\"gssofwq\"},\"etag\":\"qal\",\"id\":\"mnjijpxacqqudf\",\"name\":\"byxbaaabjy\",\"type\":\"ayffim\"}") - .toObject(RelationInner.class); - Assertions.assertEquals("qal", model.etag()); - Assertions.assertEquals("wlycoduhpkxkg", model.relatedResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RelationInner model = new RelationInner().withEtag("qal").withRelatedResourceId("wlycoduhpkxkg"); - model = BinaryData.fromObject(model).toObject(RelationInner.class); - Assertions.assertEquals("qal", model.etag()); - Assertions.assertEquals("wlycoduhpkxkg", model.relatedResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationListTests.java deleted file mode 100644 index bd18da7a04bb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationListTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner; -import com.azure.resourcemanager.securityinsights.models.RelationList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class RelationListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RelationList model = BinaryData.fromString( - "{\"nextLink\":\"tx\",\"value\":[{\"properties\":{\"relatedResourceId\":\"skfc\",\"relatedResourceName\":\"qumiek\",\"relatedResourceType\":\"zzikhlyfjhdg\",\"relatedResourceKind\":\"gebdunygaeq\"},\"etag\":\"bqfatpxllrxcyjmo\",\"id\":\"su\",\"name\":\"arm\",\"type\":\"wdmjsjqbjhhyx\"}]}") - .toObject(RelationList.class); - Assertions.assertEquals("bqfatpxllrxcyjmo", model.value().get(0).etag()); - Assertions.assertEquals("skfc", model.value().get(0).relatedResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RelationList model = new RelationList() - .withValue(Arrays.asList(new RelationInner().withEtag("bqfatpxllrxcyjmo").withRelatedResourceId("skfc"))); - model = BinaryData.fromObject(model).toObject(RelationList.class); - Assertions.assertEquals("bqfatpxllrxcyjmo", model.value().get(0).etag()); - Assertions.assertEquals("skfc", model.value().get(0).relatedResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationPropertiesTests.java deleted file mode 100644 index 23a96004c2ad..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/RelationPropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.RelationProperties; -import org.junit.jupiter.api.Assertions; - -public final class RelationPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RelationProperties model = BinaryData.fromString( - "{\"relatedResourceId\":\"zrtuzq\",\"relatedResourceName\":\"sexnevfdnw\",\"relatedResourceType\":\"mewzsyyc\",\"relatedResourceKind\":\"zsoibjudpfrxtr\"}") - .toObject(RelationProperties.class); - Assertions.assertEquals("zrtuzq", model.relatedResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RelationProperties model = new RelationProperties().withRelatedResourceId("zrtuzq"); - model = BinaryData.fromObject(model).toObject(RelationProperties.class); - Assertions.assertEquals("zrtuzq", model.relatedResourceId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ResourceWithEtagTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ResourceWithEtagTests.java deleted file mode 100644 index 6082918c7c19..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ResourceWithEtagTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag; -import org.junit.jupiter.api.Assertions; - -public final class ResourceWithEtagTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceWithEtag model = BinaryData.fromString( - "{\"etag\":\"qjnqglhqgnufoooj\",\"id\":\"ifsqesaagdfmg\",\"name\":\"zlhjxrifkwmrvkt\",\"type\":\"izntocipao\"}") - .toObject(ResourceWithEtag.class); - Assertions.assertEquals("qjnqglhqgnufoooj", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceWithEtag model = new ResourceWithEtag().withEtag("qjnqglhqgnufoooj"); - model = BinaryData.fromObject(model).toObject(ResourceWithEtag.class); - Assertions.assertEquals("qjnqglhqgnufoooj", model.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleCommonPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleCommonPropertiesTests.java deleted file mode 100644 index a05b8f5608b3..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleCommonPropertiesTests.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.EntityMapping; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; -import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRuleCommonProperties; -import com.azure.resourcemanager.securityinsights.models.TriggerOperator; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ScheduledAlertRuleCommonPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ScheduledAlertRuleCommonProperties model = BinaryData.fromString( - "{\"query\":\"iwrxgkn\",\"queryFrequency\":\"PT12H25M8S\",\"queryPeriod\":\"PT154H27M34S\",\"severity\":\"Low\",\"triggerOperator\":\"GreaterThan\",\"triggerThreshold\":623780438,\"eventGroupingSettings\":{\"aggregationKind\":\"SingleAlert\"},\"customDetails\":{\"zflbqvg\":\"oxgsgbpfgzdjtx\",\"sdtutnwlduyc\":\"qvlgafcqusrdvetn\",\"kuqgsjjxundxgket\":\"uzhyrmewipmvekdx\"},\"entityMappings\":[{\"entityType\":\"Malware\",\"fieldMappings\":[{\"identifier\":\"jmhvvmuvgpmuneq\",\"columnName\":\"vmhfbuz\"},{\"identifier\":\"ihsasb\",\"columnName\":\"dyp\"}]},{\"entityType\":\"DNS\",\"fieldMappings\":[{\"identifier\":\"slynsqyrpfoo\",\"columnName\":\"lttymsjn\"},{\"identifier\":\"qdnfwqzdz\",\"columnName\":\"ilaxhn\"},{\"identifier\":\"qlyvijo\",\"columnName\":\"iv\"}]}],\"alertDetailsOverride\":{\"alertDisplayNameFormat\":\"yzunbixxrtikv\",\"alertDescriptionFormat\":\"wpgclrcivt\",\"alertTacticsColumnName\":\"xfrk\",\"alertSeverityColumnName\":\"xpmyyefrpmpdnq\"}}") - .toObject(ScheduledAlertRuleCommonProperties.class); - Assertions.assertEquals("iwrxgkn", model.query()); - Assertions.assertEquals(Duration.parse("PT12H25M8S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT154H27M34S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(TriggerOperator.GREATER_THAN, model.triggerOperator()); - Assertions.assertEquals(623780438, model.triggerThreshold()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("oxgsgbpfgzdjtx", model.customDetails().get("zflbqvg")); - Assertions.assertEquals(EntityMappingType.MALWARE, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("jmhvvmuvgpmuneq", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("vmhfbuz", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("yzunbixxrtikv", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("wpgclrcivt", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("xfrk", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("xpmyyefrpmpdnq", model.alertDetailsOverride().alertSeverityColumnName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ScheduledAlertRuleCommonProperties model - = new ScheduledAlertRuleCommonProperties().withQuery("iwrxgkn") - .withQueryFrequency(Duration.parse("PT12H25M8S")) - .withQueryPeriod(Duration.parse("PT154H27M34S")) - .withSeverity(AlertSeverity.LOW) - .withTriggerOperator(TriggerOperator.GREATER_THAN) - .withTriggerThreshold(623780438) - .withEventGroupingSettings( - new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.SINGLE_ALERT)) - .withCustomDetails(mapOf("zflbqvg", "oxgsgbpfgzdjtx", "sdtutnwlduyc", "qvlgafcqusrdvetn", - "kuqgsjjxundxgket", "uzhyrmewipmvekdx")) - .withEntityMappings( - Arrays.asList( - new EntityMapping().withEntityType(EntityMappingType.MALWARE) - .withFieldMappings(Arrays - .asList(new FieldMapping().withIdentifier("jmhvvmuvgpmuneq").withColumnName("vmhfbuz"), - new FieldMapping().withIdentifier("ihsasb").withColumnName("dyp"))), - new EntityMapping().withEntityType(EntityMappingType.DNS) - .withFieldMappings(Arrays.asList( - new FieldMapping().withIdentifier("slynsqyrpfoo").withColumnName("lttymsjn"), - new FieldMapping().withIdentifier("qdnfwqzdz").withColumnName("ilaxhn"), - new FieldMapping().withIdentifier("qlyvijo").withColumnName("iv"))))) - .withAlertDetailsOverride(new AlertDetailsOverride().withAlertDisplayNameFormat("yzunbixxrtikv") - .withAlertDescriptionFormat("wpgclrcivt") - .withAlertTacticsColumnName("xfrk") - .withAlertSeverityColumnName("xpmyyefrpmpdnq")); - model = BinaryData.fromObject(model).toObject(ScheduledAlertRuleCommonProperties.class); - Assertions.assertEquals("iwrxgkn", model.query()); - Assertions.assertEquals(Duration.parse("PT12H25M8S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT154H27M34S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(TriggerOperator.GREATER_THAN, model.triggerOperator()); - Assertions.assertEquals(623780438, model.triggerThreshold()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("oxgsgbpfgzdjtx", model.customDetails().get("zflbqvg")); - Assertions.assertEquals(EntityMappingType.MALWARE, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("jmhvvmuvgpmuneq", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("vmhfbuz", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("yzunbixxrtikv", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("wpgclrcivt", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("xfrk", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("xpmyyefrpmpdnq", model.alertDetailsOverride().alertSeverityColumnName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRulePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRulePropertiesTests.java deleted file mode 100644 index 4dc3cd927718..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRulePropertiesTests.java +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ScheduledAlertRuleProperties; -import com.azure.resourcemanager.securityinsights.models.AlertDetail; -import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.EntityMapping; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; -import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import com.azure.resourcemanager.securityinsights.models.GroupingConfiguration; -import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; -import com.azure.resourcemanager.securityinsights.models.MatchingMethod; -import com.azure.resourcemanager.securityinsights.models.TriggerOperator; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ScheduledAlertRulePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ScheduledAlertRuleProperties model = BinaryData.fromString( - "{\"alertRuleTemplateName\":\"qfby\",\"templateVersion\":\"rfgi\",\"description\":\"tcojocqwo\",\"displayName\":\"fnzjvusfzldm\",\"enabled\":true,\"lastModifiedUtc\":\"2021-08-07T02:58:02Z\",\"suppressionDuration\":\"PT132H40M7S\",\"suppressionEnabled\":true,\"tactics\":[\"InitialAccess\",\"DefenseEvasion\",\"DefenseEvasion\",\"InhibitResponseFunction\"],\"techniques\":[\"ysownbtgkbug\",\"jqctojcmisofie\"],\"incidentConfiguration\":{\"createIncident\":true,\"groupingConfiguration\":{\"enabled\":true,\"reopenClosedIncident\":false,\"lookbackDuration\":\"PT66H50M3S\",\"matchingMethod\":\"Selected\",\"groupByEntities\":[\"Host\",\"IP\"],\"groupByAlertDetails\":[\"DisplayName\",\"DisplayName\"],\"groupByCustomDetails\":[\"wkhihihlhzdsqt\",\"bsrgnowc\"]}},\"query\":\"fgmvecactxmwo\",\"queryFrequency\":\"PT44H36M46S\",\"queryPeriod\":\"PT110H48M2S\",\"severity\":\"Low\",\"triggerOperator\":\"Equal\",\"triggerThreshold\":1896348924,\"eventGroupingSettings\":{\"aggregationKind\":\"SingleAlert\"},\"customDetails\":{\"wifzmp\":\"qo\",\"cvhrfsp\":\"wyivqikf\",\"kvyklxubyjaffmm\":\"uagrttikteusqc\"},\"entityMappings\":[{\"entityType\":\"Mailbox\",\"fieldMappings\":[{\"identifier\":\"bgq\",\"columnName\":\"rtalmet\"}]},{\"entityType\":\"Malware\",\"fieldMappings\":[{\"identifier\":\"lqxihhrmooiz\",\"columnName\":\"eypxiutcxapzhyr\"},{\"identifier\":\"togebjoxsl\",\"columnName\":\"nhl\"},{\"identifier\":\"rqnkkzjcjbtr\",\"columnName\":\"ehvvib\"},{\"identifier\":\"jj\",\"columnName\":\"oqbeitpkxzt\"}]},{\"entityType\":\"SecurityGroup\",\"fieldMappings\":[{\"identifier\":\"ft\",\"columnName\":\"gfcwqmpimaqxzhem\"}]},{\"entityType\":\"Account\",\"fieldMappings\":[{\"identifier\":\"jswtwkozzwc\",\"columnName\":\"kb\"},{\"identifier\":\"pfajnjwltlwtjj\",\"columnName\":\"ktalhsnvkcdmxz\"},{\"identifier\":\"oaimlnw\",\"columnName\":\"aomylwea\"},{\"identifier\":\"lcsethwwnpj\",\"columnName\":\"fz\"}]}],\"alertDetailsOverride\":{\"alertDisplayNameFormat\":\"ch\",\"alertDescriptionFormat\":\"hfbousnfepgfew\",\"alertTacticsColumnName\":\"wlyxgncxyk\",\"alertSeverityColumnName\":\"djhlimm\"}}") - .toObject(ScheduledAlertRuleProperties.class); - Assertions.assertEquals("fgmvecactxmwo", model.query()); - Assertions.assertEquals(Duration.parse("PT44H36M46S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT110H48M2S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(TriggerOperator.EQUAL, model.triggerOperator()); - Assertions.assertEquals(1896348924, model.triggerThreshold()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("qo", model.customDetails().get("wifzmp")); - Assertions.assertEquals(EntityMappingType.MAILBOX, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("bgq", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("rtalmet", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("ch", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("hfbousnfepgfew", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("wlyxgncxyk", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("djhlimm", model.alertDetailsOverride().alertSeverityColumnName()); - Assertions.assertEquals("qfby", model.alertRuleTemplateName()); - Assertions.assertEquals("rfgi", model.templateVersion()); - Assertions.assertEquals("tcojocqwo", model.description()); - Assertions.assertEquals("fnzjvusfzldm", model.displayName()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(Duration.parse("PT132H40M7S"), model.suppressionDuration()); - Assertions.assertEquals(true, model.suppressionEnabled()); - Assertions.assertEquals(AttackTactic.INITIAL_ACCESS, model.tactics().get(0)); - Assertions.assertEquals("ysownbtgkbug", model.techniques().get(0)); - Assertions.assertEquals(true, model.incidentConfiguration().createIncident()); - Assertions.assertEquals(true, model.incidentConfiguration().groupingConfiguration().enabled()); - Assertions.assertEquals(false, model.incidentConfiguration().groupingConfiguration().reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT66H50M3S"), - model.incidentConfiguration().groupingConfiguration().lookbackDuration()); - Assertions.assertEquals(MatchingMethod.SELECTED, - model.incidentConfiguration().groupingConfiguration().matchingMethod()); - Assertions.assertEquals(EntityMappingType.HOST, - model.incidentConfiguration().groupingConfiguration().groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.DISPLAY_NAME, - model.incidentConfiguration().groupingConfiguration().groupByAlertDetails().get(0)); - Assertions.assertEquals("wkhihihlhzdsqt", - model.incidentConfiguration().groupingConfiguration().groupByCustomDetails().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ScheduledAlertRuleProperties model = new ScheduledAlertRuleProperties().withQuery("fgmvecactxmwo") - .withQueryFrequency(Duration.parse("PT44H36M46S")) - .withQueryPeriod(Duration.parse("PT110H48M2S")) - .withSeverity(AlertSeverity.LOW) - .withTriggerOperator(TriggerOperator.EQUAL) - .withTriggerThreshold(1896348924) - .withEventGroupingSettings( - new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.SINGLE_ALERT)) - .withCustomDetails(mapOf("wifzmp", "qo", "cvhrfsp", "wyivqikf", "kvyklxubyjaffmm", "uagrttikteusqc")) - .withEntityMappings(Arrays.asList(new EntityMapping().withEntityType(EntityMappingType.MAILBOX) - .withFieldMappings(Arrays.asList(new FieldMapping().withIdentifier("bgq").withColumnName("rtalmet"))), - new EntityMapping().withEntityType(EntityMappingType.MALWARE) - .withFieldMappings(Arrays.asList( - new FieldMapping().withIdentifier("lqxihhrmooiz").withColumnName("eypxiutcxapzhyr"), - new FieldMapping().withIdentifier("togebjoxsl").withColumnName("nhl"), - new FieldMapping().withIdentifier("rqnkkzjcjbtr").withColumnName("ehvvib"), - new FieldMapping().withIdentifier("jj").withColumnName("oqbeitpkxzt"))), - new EntityMapping().withEntityType(EntityMappingType.SECURITY_GROUP) - .withFieldMappings( - Arrays.asList(new FieldMapping().withIdentifier("ft").withColumnName("gfcwqmpimaqxzhem"))), - new EntityMapping().withEntityType(EntityMappingType.ACCOUNT) - .withFieldMappings( - Arrays.asList(new FieldMapping().withIdentifier("jswtwkozzwc").withColumnName("kb"), - new FieldMapping().withIdentifier("pfajnjwltlwtjj").withColumnName("ktalhsnvkcdmxz"), - new FieldMapping().withIdentifier("oaimlnw").withColumnName("aomylwea"), - new FieldMapping().withIdentifier("lcsethwwnpj").withColumnName("fz"))))) - .withAlertDetailsOverride(new AlertDetailsOverride().withAlertDisplayNameFormat("ch") - .withAlertDescriptionFormat("hfbousnfepgfew") - .withAlertTacticsColumnName("wlyxgncxyk") - .withAlertSeverityColumnName("djhlimm")) - .withAlertRuleTemplateName("qfby") - .withTemplateVersion("rfgi") - .withDescription("tcojocqwo") - .withDisplayName("fnzjvusfzldm") - .withEnabled(true) - .withSuppressionDuration(Duration.parse("PT132H40M7S")) - .withSuppressionEnabled(true) - .withTactics(Arrays.asList(AttackTactic.INITIAL_ACCESS, AttackTactic.DEFENSE_EVASION, - AttackTactic.DEFENSE_EVASION, AttackTactic.INHIBIT_RESPONSE_FUNCTION)) - .withTechniques(Arrays.asList("ysownbtgkbug", "jqctojcmisofie")) - .withIncidentConfiguration(new IncidentConfiguration().withCreateIncident(true) - .withGroupingConfiguration(new GroupingConfiguration().withEnabled(true) - .withReopenClosedIncident(false) - .withLookbackDuration(Duration.parse("PT66H50M3S")) - .withMatchingMethod(MatchingMethod.SELECTED) - .withGroupByEntities(Arrays.asList(EntityMappingType.HOST, EntityMappingType.IP)) - .withGroupByAlertDetails(Arrays.asList(AlertDetail.DISPLAY_NAME, AlertDetail.DISPLAY_NAME)) - .withGroupByCustomDetails(Arrays.asList("wkhihihlhzdsqt", "bsrgnowc")))); - model = BinaryData.fromObject(model).toObject(ScheduledAlertRuleProperties.class); - Assertions.assertEquals("fgmvecactxmwo", model.query()); - Assertions.assertEquals(Duration.parse("PT44H36M46S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT110H48M2S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(TriggerOperator.EQUAL, model.triggerOperator()); - Assertions.assertEquals(1896348924, model.triggerThreshold()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("qo", model.customDetails().get("wifzmp")); - Assertions.assertEquals(EntityMappingType.MAILBOX, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("bgq", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("rtalmet", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("ch", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("hfbousnfepgfew", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("wlyxgncxyk", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("djhlimm", model.alertDetailsOverride().alertSeverityColumnName()); - Assertions.assertEquals("qfby", model.alertRuleTemplateName()); - Assertions.assertEquals("rfgi", model.templateVersion()); - Assertions.assertEquals("tcojocqwo", model.description()); - Assertions.assertEquals("fnzjvusfzldm", model.displayName()); - Assertions.assertEquals(true, model.enabled()); - Assertions.assertEquals(Duration.parse("PT132H40M7S"), model.suppressionDuration()); - Assertions.assertEquals(true, model.suppressionEnabled()); - Assertions.assertEquals(AttackTactic.INITIAL_ACCESS, model.tactics().get(0)); - Assertions.assertEquals("ysownbtgkbug", model.techniques().get(0)); - Assertions.assertEquals(true, model.incidentConfiguration().createIncident()); - Assertions.assertEquals(true, model.incidentConfiguration().groupingConfiguration().enabled()); - Assertions.assertEquals(false, model.incidentConfiguration().groupingConfiguration().reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT66H50M3S"), - model.incidentConfiguration().groupingConfiguration().lookbackDuration()); - Assertions.assertEquals(MatchingMethod.SELECTED, - model.incidentConfiguration().groupingConfiguration().matchingMethod()); - Assertions.assertEquals(EntityMappingType.HOST, - model.incidentConfiguration().groupingConfiguration().groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.DISPLAY_NAME, - model.incidentConfiguration().groupingConfiguration().groupByAlertDetails().get(0)); - Assertions.assertEquals("wkhihihlhzdsqt", - model.incidentConfiguration().groupingConfiguration().groupByCustomDetails().get(0)); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTemplatePropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTemplatePropertiesTests.java deleted file mode 100644 index 0bddd6ed05d3..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTemplatePropertiesTests.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ScheduledAlertRuleTemplateProperties; -import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.EntityMapping; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; -import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import com.azure.resourcemanager.securityinsights.models.TemplateStatus; -import com.azure.resourcemanager.securityinsights.models.TriggerOperator; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ScheduledAlertRuleTemplatePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ScheduledAlertRuleTemplateProperties model = BinaryData.fromString( - "{\"alertRulesCreatedByTemplateCount\":1428181970,\"createdDateUTC\":\"2021-06-30T10:02:52Z\",\"lastUpdatedDateUTC\":\"2021-01-29T18:46:46Z\",\"description\":\"hzbezkgi\",\"displayName\":\"idxas\",\"requiredDataConnectors\":[{\"connectorId\":\"yvvjskgfmo\",\"dataTypes\":[\"hpqgatjeaahhvj\"]},{\"connectorId\":\"na\",\"dataTypes\":[\"bbjjidjksyxk\",\"xvxevblbjednljla\",\"euaulxu\"]},{\"connectorId\":\"mjbnk\",\"dataTypes\":[\"ynenlsvxeizz\",\"wklnsrmffeyc\"]}],\"status\":\"NotAvailable\",\"query\":\"piymerteea\",\"queryFrequency\":\"PT193H10M30S\",\"queryPeriod\":\"PT111H41M8S\",\"severity\":\"High\",\"triggerOperator\":\"NotEqual\",\"triggerThreshold\":416757302,\"tactics\":[\"Execution\",\"Exfiltration\",\"DefenseEvasion\",\"Discovery\"],\"techniques\":[\"bmxva\",\"refdee\",\"vecuijpx\"],\"version\":\"s\",\"eventGroupingSettings\":{\"aggregationKind\":\"AlertPerResult\"},\"customDetails\":{\"vit\":\"jwsawddjibab\",\"ecdmdqbwpy\":\"tvtzeexavoxtfg\",\"gsfjac\":\"q\",\"d\":\"slhhxudbxv\"},\"entityMappings\":[{\"entityType\":\"RegistryKey\",\"fieldMappings\":[{\"identifier\":\"hzmme\",\"columnName\":\"kdlpa\"}]},{\"entityType\":\"RegistryValue\",\"fieldMappings\":[{\"identifier\":\"a\",\"columnName\":\"cfxwmdbox\"}]}],\"alertDetailsOverride\":{\"alertDisplayNameFormat\":\"sftufqobrjlna\",\"alertDescriptionFormat\":\"cc\",\"alertTacticsColumnName\":\"nhxk\",\"alertSeverityColumnName\":\"v\"}}") - .toObject(ScheduledAlertRuleTemplateProperties.class); - Assertions.assertEquals(1428181970, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("hzbezkgi", model.description()); - Assertions.assertEquals("idxas", model.displayName()); - Assertions.assertEquals("yvvjskgfmo", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("hpqgatjeaahhvj", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.NOT_AVAILABLE, model.status()); - Assertions.assertEquals("piymerteea", model.query()); - Assertions.assertEquals(Duration.parse("PT193H10M30S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT111H41M8S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.HIGH, model.severity()); - Assertions.assertEquals(TriggerOperator.NOT_EQUAL, model.triggerOperator()); - Assertions.assertEquals(416757302, model.triggerThreshold()); - Assertions.assertEquals(AttackTactic.EXECUTION, model.tactics().get(0)); - Assertions.assertEquals("bmxva", model.techniques().get(0)); - Assertions.assertEquals("s", model.version()); - Assertions.assertEquals(EventGroupingAggregationKind.ALERT_PER_RESULT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("jwsawddjibab", model.customDetails().get("vit")); - Assertions.assertEquals(EntityMappingType.REGISTRY_KEY, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("hzmme", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("kdlpa", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("sftufqobrjlna", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("cc", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("nhxk", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("v", model.alertDetailsOverride().alertSeverityColumnName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ScheduledAlertRuleTemplateProperties model - = new ScheduledAlertRuleTemplateProperties().withAlertRulesCreatedByTemplateCount(1428181970) - .withDescription("hzbezkgi") - .withDisplayName("idxas") - .withRequiredDataConnectors(Arrays.asList( - new AlertRuleTemplateDataSource().withConnectorId("yvvjskgfmo") - .withDataTypes(Arrays.asList("hpqgatjeaahhvj")), - new AlertRuleTemplateDataSource().withConnectorId("na") - .withDataTypes(Arrays.asList("bbjjidjksyxk", "xvxevblbjednljla", "euaulxu")), - new AlertRuleTemplateDataSource().withConnectorId("mjbnk") - .withDataTypes(Arrays.asList("ynenlsvxeizz", "wklnsrmffeyc")))) - .withStatus(TemplateStatus.NOT_AVAILABLE) - .withQuery("piymerteea") - .withQueryFrequency(Duration.parse("PT193H10M30S")) - .withQueryPeriod(Duration.parse("PT111H41M8S")) - .withSeverity(AlertSeverity.HIGH) - .withTriggerOperator(TriggerOperator.NOT_EQUAL) - .withTriggerThreshold(416757302) - .withTactics(Arrays.asList(AttackTactic.EXECUTION, AttackTactic.EXFILTRATION, - AttackTactic.DEFENSE_EVASION, AttackTactic.DISCOVERY)) - .withTechniques(Arrays.asList("bmxva", "refdee", "vecuijpx")) - .withVersion("s") - .withEventGroupingSettings( - new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.ALERT_PER_RESULT)) - .withCustomDetails( - mapOf("vit", "jwsawddjibab", "ecdmdqbwpy", "tvtzeexavoxtfg", "gsfjac", "q", "d", "slhhxudbxv")) - .withEntityMappings(Arrays.asList( - new EntityMapping().withEntityType(EntityMappingType.REGISTRY_KEY) - .withFieldMappings( - Arrays.asList(new FieldMapping().withIdentifier("hzmme").withColumnName("kdlpa"))), - new EntityMapping().withEntityType(EntityMappingType.REGISTRY_VALUE) - .withFieldMappings( - Arrays.asList(new FieldMapping().withIdentifier("a").withColumnName("cfxwmdbox"))))) - .withAlertDetailsOverride(new AlertDetailsOverride().withAlertDisplayNameFormat("sftufqobrjlna") - .withAlertDescriptionFormat("cc") - .withAlertTacticsColumnName("nhxk") - .withAlertSeverityColumnName("v")); - model = BinaryData.fromObject(model).toObject(ScheduledAlertRuleTemplateProperties.class); - Assertions.assertEquals(1428181970, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("hzbezkgi", model.description()); - Assertions.assertEquals("idxas", model.displayName()); - Assertions.assertEquals("yvvjskgfmo", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("hpqgatjeaahhvj", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.NOT_AVAILABLE, model.status()); - Assertions.assertEquals("piymerteea", model.query()); - Assertions.assertEquals(Duration.parse("PT193H10M30S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT111H41M8S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.HIGH, model.severity()); - Assertions.assertEquals(TriggerOperator.NOT_EQUAL, model.triggerOperator()); - Assertions.assertEquals(416757302, model.triggerThreshold()); - Assertions.assertEquals(AttackTactic.EXECUTION, model.tactics().get(0)); - Assertions.assertEquals("bmxva", model.techniques().get(0)); - Assertions.assertEquals("s", model.version()); - Assertions.assertEquals(EventGroupingAggregationKind.ALERT_PER_RESULT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("jwsawddjibab", model.customDetails().get("vit")); - Assertions.assertEquals(EntityMappingType.REGISTRY_KEY, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("hzmme", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("kdlpa", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("sftufqobrjlna", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("cc", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("nhxk", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("v", model.alertDetailsOverride().alertSeverityColumnName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTemplateTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTemplateTests.java deleted file mode 100644 index 9faa1646af2c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTemplateTests.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; -import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.EntityMapping; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; -import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRuleTemplate; -import com.azure.resourcemanager.securityinsights.models.TemplateStatus; -import com.azure.resourcemanager.securityinsights.models.TriggerOperator; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ScheduledAlertRuleTemplateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ScheduledAlertRuleTemplate model = BinaryData.fromString( - "{\"kind\":\"Scheduled\",\"properties\":{\"alertRulesCreatedByTemplateCount\":1311687390,\"createdDateUTC\":\"2021-05-12T20:14:31Z\",\"lastUpdatedDateUTC\":\"2021-08-20T10:37:04Z\",\"description\":\"r\",\"displayName\":\"eranokqgukkjqnv\",\"requiredDataConnectors\":[{\"connectorId\":\"laxxulc\",\"dataTypes\":[\"dosfjbjsvgjrw\",\"r\",\"vyc\",\"t\"]},{\"connectorId\":\"lxgccknfnwmbtm\",\"dataTypes\":[\"vjdhttzaefedxih\",\"hrphkmcrjdqn\",\"dfzpbgtgkylkdg\"]}],\"status\":\"Installed\",\"query\":\"uutlwxezwzhok\",\"queryFrequency\":\"PT8H14M23S\",\"queryPeriod\":\"PT58H5M9S\",\"severity\":\"Low\",\"triggerOperator\":\"LessThan\",\"triggerThreshold\":1214606185,\"tactics\":[\"ImpairProcessControl\",\"CommandAndControl\"],\"techniques\":[\"ifhpf\",\"oajvgcxtxjcs\",\"eafidltugsresm\",\"ssjhoiftxfkf\"],\"version\":\"gpr\",\"eventGroupingSettings\":{\"aggregationKind\":\"SingleAlert\"},\"customDetails\":{\"qtgdqohmcwsl\":\"ucb\",\"tpwb\":\"riz\",\"llibphbqzmizak\":\"a\",\"jpdn\":\"kan\"},\"entityMappings\":[{\"entityType\":\"File\",\"fieldMappings\":[{\"identifier\":\"hjlmu\",\"columnName\":\"xprimrsop\"},{\"identifier\":\"ecj\",\"columnName\":\"islstv\"}]}],\"alertDetailsOverride\":{\"alertDisplayNameFormat\":\"lwxdzaum\",\"alertDescriptionFormat\":\"oohgu\",\"alertTacticsColumnName\":\"uzboyjathw\",\"alertSeverityColumnName\":\"olbaemwmdx\"}},\"id\":\"bwjscjpahlxveab\",\"name\":\"qxnmwmqt\",\"type\":\"bxyijddtvq\"}") - .toObject(ScheduledAlertRuleTemplate.class); - Assertions.assertEquals(1311687390, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("r", model.description()); - Assertions.assertEquals("eranokqgukkjqnv", model.displayName()); - Assertions.assertEquals("laxxulc", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("dosfjbjsvgjrw", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.INSTALLED, model.status()); - Assertions.assertEquals("uutlwxezwzhok", model.query()); - Assertions.assertEquals(Duration.parse("PT8H14M23S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT58H5M9S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(TriggerOperator.LESS_THAN, model.triggerOperator()); - Assertions.assertEquals(1214606185, model.triggerThreshold()); - Assertions.assertEquals(AttackTactic.IMPAIR_PROCESS_CONTROL, model.tactics().get(0)); - Assertions.assertEquals("ifhpf", model.techniques().get(0)); - Assertions.assertEquals("gpr", model.version()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("ucb", model.customDetails().get("qtgdqohmcwsl")); - Assertions.assertEquals(EntityMappingType.FILE, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("hjlmu", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("xprimrsop", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("lwxdzaum", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("oohgu", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("uzboyjathw", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("olbaemwmdx", model.alertDetailsOverride().alertSeverityColumnName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ScheduledAlertRuleTemplate model = new ScheduledAlertRuleTemplate() - .withAlertRulesCreatedByTemplateCount(1311687390) - .withDescription("r") - .withDisplayName("eranokqgukkjqnv") - .withRequiredDataConnectors(Arrays.asList( - new AlertRuleTemplateDataSource().withConnectorId("laxxulc") - .withDataTypes(Arrays.asList("dosfjbjsvgjrw", "r", "vyc", "t")), - new AlertRuleTemplateDataSource().withConnectorId("lxgccknfnwmbtm") - .withDataTypes(Arrays.asList("vjdhttzaefedxih", "hrphkmcrjdqn", "dfzpbgtgkylkdg")))) - .withStatus(TemplateStatus.INSTALLED) - .withQuery("uutlwxezwzhok") - .withQueryFrequency(Duration.parse("PT8H14M23S")) - .withQueryPeriod(Duration.parse("PT58H5M9S")) - .withSeverity(AlertSeverity.LOW) - .withTriggerOperator(TriggerOperator.LESS_THAN) - .withTriggerThreshold(1214606185) - .withTactics(Arrays.asList(AttackTactic.IMPAIR_PROCESS_CONTROL, AttackTactic.COMMAND_AND_CONTROL)) - .withTechniques(Arrays.asList("ifhpf", "oajvgcxtxjcs", "eafidltugsresm", "ssjhoiftxfkf")) - .withVersion("gpr") - .withEventGroupingSettings( - new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.SINGLE_ALERT)) - .withCustomDetails(mapOf("qtgdqohmcwsl", "ucb", "tpwb", "riz", "llibphbqzmizak", "a", "jpdn", "kan")) - .withEntityMappings(Arrays.asList(new EntityMapping().withEntityType(EntityMappingType.FILE) - .withFieldMappings(Arrays.asList(new FieldMapping().withIdentifier("hjlmu").withColumnName("xprimrsop"), - new FieldMapping().withIdentifier("ecj").withColumnName("islstv"))))) - .withAlertDetailsOverride(new AlertDetailsOverride().withAlertDisplayNameFormat("lwxdzaum") - .withAlertDescriptionFormat("oohgu") - .withAlertTacticsColumnName("uzboyjathw") - .withAlertSeverityColumnName("olbaemwmdx")); - model = BinaryData.fromObject(model).toObject(ScheduledAlertRuleTemplate.class); - Assertions.assertEquals(1311687390, model.alertRulesCreatedByTemplateCount()); - Assertions.assertEquals("r", model.description()); - Assertions.assertEquals("eranokqgukkjqnv", model.displayName()); - Assertions.assertEquals("laxxulc", model.requiredDataConnectors().get(0).connectorId()); - Assertions.assertEquals("dosfjbjsvgjrw", model.requiredDataConnectors().get(0).dataTypes().get(0)); - Assertions.assertEquals(TemplateStatus.INSTALLED, model.status()); - Assertions.assertEquals("uutlwxezwzhok", model.query()); - Assertions.assertEquals(Duration.parse("PT8H14M23S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT58H5M9S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - Assertions.assertEquals(TriggerOperator.LESS_THAN, model.triggerOperator()); - Assertions.assertEquals(1214606185, model.triggerThreshold()); - Assertions.assertEquals(AttackTactic.IMPAIR_PROCESS_CONTROL, model.tactics().get(0)); - Assertions.assertEquals("ifhpf", model.techniques().get(0)); - Assertions.assertEquals("gpr", model.version()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("ucb", model.customDetails().get("qtgdqohmcwsl")); - Assertions.assertEquals(EntityMappingType.FILE, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("hjlmu", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("xprimrsop", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("lwxdzaum", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("oohgu", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("uzboyjathw", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("olbaemwmdx", model.alertDetailsOverride().alertSeverityColumnName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTests.java deleted file mode 100644 index ae904508a745..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ScheduledAlertRuleTests.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertDetail; -import com.azure.resourcemanager.securityinsights.models.AlertDetailsOverride; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.AttackTactic; -import com.azure.resourcemanager.securityinsights.models.EntityMapping; -import com.azure.resourcemanager.securityinsights.models.EntityMappingType; -import com.azure.resourcemanager.securityinsights.models.EventGroupingAggregationKind; -import com.azure.resourcemanager.securityinsights.models.EventGroupingSettings; -import com.azure.resourcemanager.securityinsights.models.FieldMapping; -import com.azure.resourcemanager.securityinsights.models.GroupingConfiguration; -import com.azure.resourcemanager.securityinsights.models.IncidentConfiguration; -import com.azure.resourcemanager.securityinsights.models.MatchingMethod; -import com.azure.resourcemanager.securityinsights.models.ScheduledAlertRule; -import com.azure.resourcemanager.securityinsights.models.TriggerOperator; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ScheduledAlertRuleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ScheduledAlertRule model = BinaryData.fromString( - "{\"kind\":\"Scheduled\",\"properties\":{\"alertRuleTemplateName\":\"zgkrvqe\",\"templateVersion\":\"toepryu\",\"description\":\"wytpzdmovz\",\"displayName\":\"fvaawzqa\",\"enabled\":false,\"lastModifiedUtc\":\"2021-08-12T09:55:05Z\",\"suppressionDuration\":\"PT90H15M52S\",\"suppressionEnabled\":false,\"tactics\":[\"InitialAccess\",\"InhibitResponseFunction\"],\"techniques\":[\"cx\"],\"incidentConfiguration\":{\"createIncident\":false,\"groupingConfiguration\":{\"enabled\":false,\"reopenClosedIncident\":false,\"lookbackDuration\":\"PT157H29M48S\",\"matchingMethod\":\"AllEntities\",\"groupByEntities\":[\"URL\",\"SecurityGroup\",\"FileHash\"],\"groupByAlertDetails\":[\"DisplayName\",\"Severity\",\"Severity\"],\"groupByCustomDetails\":[\"bf\",\"rclnpkc\",\"ayzri\"]}},\"query\":\"hya\",\"queryFrequency\":\"PT53H1M13S\",\"queryPeriod\":\"PT47H45M53S\",\"severity\":\"Informational\",\"triggerOperator\":\"Equal\",\"triggerThreshold\":1339269194,\"eventGroupingSettings\":{\"aggregationKind\":\"SingleAlert\"},\"customDetails\":{\"nraauzz\":\"omdynhdwdigum\"},\"entityMappings\":[{\"entityType\":\"MailMessage\",\"fieldMappings\":[{\"identifier\":\"zhezwwvaiq\",\"columnName\":\"vv\"},{\"identifier\":\"nk\",\"columnName\":\"hqyikvy\"}]},{\"entityType\":\"RegistryKey\",\"fieldMappings\":[{\"identifier\":\"luwmncst\",\"columnName\":\"jfybvpoekrsgsgb\"},{\"identifier\":\"uzqgnjdgkynsc\",\"columnName\":\"qhzvhxnkomt\"},{\"identifier\":\"bo\",\"columnName\":\"pnvdxz\"}]},{\"entityType\":\"FileHash\",\"fieldMappings\":[{\"identifier\":\"bbc\",\"columnName\":\"qagt\"},{\"identifier\":\"dhlfkqojpykvgt\",\"columnName\":\"cnifm\"}]},{\"entityType\":\"Process\",\"fieldMappings\":[{\"identifier\":\"brn\",\"columnName\":\"u\"},{\"identifier\":\"prafwgckhoc\",\"columnName\":\"d\"},{\"identifier\":\"fwafqrouda\",\"columnName\":\"avehhrvkbunzo\"},{\"identifier\":\"dhcxgkmoy\",\"columnName\":\"dyuib\"}]}],\"alertDetailsOverride\":{\"alertDisplayNameFormat\":\"dnbzydvfvfcjn\",\"alertDescriptionFormat\":\"oisrvhmgorffu\",\"alertTacticsColumnName\":\"scvwmzhwplef\",\"alertSeverityColumnName\":\"vxilcbt\"}},\"etag\":\"hnze\",\"id\":\"xtjjfzqlqhycav\",\"name\":\"dggxdbeesmi\",\"type\":\"knlrariaawiuagy\"}") - .toObject(ScheduledAlertRule.class); - Assertions.assertEquals("hnze", model.etag()); - Assertions.assertEquals("zgkrvqe", model.alertRuleTemplateName()); - Assertions.assertEquals("toepryu", model.templateVersion()); - Assertions.assertEquals("wytpzdmovz", model.description()); - Assertions.assertEquals("fvaawzqa", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - Assertions.assertEquals(Duration.parse("PT90H15M52S"), model.suppressionDuration()); - Assertions.assertEquals(false, model.suppressionEnabled()); - Assertions.assertEquals(AttackTactic.INITIAL_ACCESS, model.tactics().get(0)); - Assertions.assertEquals("cx", model.techniques().get(0)); - Assertions.assertEquals(false, model.incidentConfiguration().createIncident()); - Assertions.assertEquals(false, model.incidentConfiguration().groupingConfiguration().enabled()); - Assertions.assertEquals(false, model.incidentConfiguration().groupingConfiguration().reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT157H29M48S"), - model.incidentConfiguration().groupingConfiguration().lookbackDuration()); - Assertions.assertEquals(MatchingMethod.ALL_ENTITIES, - model.incidentConfiguration().groupingConfiguration().matchingMethod()); - Assertions.assertEquals(EntityMappingType.URL, - model.incidentConfiguration().groupingConfiguration().groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.DISPLAY_NAME, - model.incidentConfiguration().groupingConfiguration().groupByAlertDetails().get(0)); - Assertions.assertEquals("bf", - model.incidentConfiguration().groupingConfiguration().groupByCustomDetails().get(0)); - Assertions.assertEquals("hya", model.query()); - Assertions.assertEquals(Duration.parse("PT53H1M13S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT47H45M53S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severity()); - Assertions.assertEquals(TriggerOperator.EQUAL, model.triggerOperator()); - Assertions.assertEquals(1339269194, model.triggerThreshold()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("omdynhdwdigum", model.customDetails().get("nraauzz")); - Assertions.assertEquals(EntityMappingType.MAIL_MESSAGE, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("zhezwwvaiq", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("vv", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("dnbzydvfvfcjn", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("oisrvhmgorffu", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("scvwmzhwplef", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("vxilcbt", model.alertDetailsOverride().alertSeverityColumnName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ScheduledAlertRule model = new ScheduledAlertRule().withEtag("hnze") - .withAlertRuleTemplateName("zgkrvqe") - .withTemplateVersion("toepryu") - .withDescription("wytpzdmovz") - .withDisplayName("fvaawzqa") - .withEnabled(false) - .withSuppressionDuration(Duration.parse("PT90H15M52S")) - .withSuppressionEnabled(false) - .withTactics(Arrays.asList(AttackTactic.INITIAL_ACCESS, AttackTactic.INHIBIT_RESPONSE_FUNCTION)) - .withTechniques(Arrays.asList("cx")) - .withIncidentConfiguration(new IncidentConfiguration().withCreateIncident(false) - .withGroupingConfiguration(new GroupingConfiguration().withEnabled(false) - .withReopenClosedIncident(false) - .withLookbackDuration(Duration.parse("PT157H29M48S")) - .withMatchingMethod(MatchingMethod.ALL_ENTITIES) - .withGroupByEntities(Arrays.asList(EntityMappingType.URL, EntityMappingType.SECURITY_GROUP, - EntityMappingType.FILE_HASH)) - .withGroupByAlertDetails( - Arrays.asList(AlertDetail.DISPLAY_NAME, AlertDetail.SEVERITY, AlertDetail.SEVERITY)) - .withGroupByCustomDetails(Arrays.asList("bf", "rclnpkc", "ayzri")))) - .withQuery("hya") - .withQueryFrequency(Duration.parse("PT53H1M13S")) - .withQueryPeriod(Duration.parse("PT47H45M53S")) - .withSeverity(AlertSeverity.INFORMATIONAL) - .withTriggerOperator(TriggerOperator.EQUAL) - .withTriggerThreshold(1339269194) - .withEventGroupingSettings( - new EventGroupingSettings().withAggregationKind(EventGroupingAggregationKind.SINGLE_ALERT)) - .withCustomDetails(mapOf("nraauzz", "omdynhdwdigum")) - .withEntityMappings(Arrays.asList(new EntityMapping().withEntityType(EntityMappingType.MAIL_MESSAGE) - .withFieldMappings(Arrays.asList(new FieldMapping().withIdentifier("zhezwwvaiq").withColumnName("vv"), - new FieldMapping().withIdentifier("nk").withColumnName("hqyikvy"))), - new EntityMapping().withEntityType(EntityMappingType.REGISTRY_KEY) - .withFieldMappings( - Arrays.asList(new FieldMapping().withIdentifier("luwmncst").withColumnName("jfybvpoekrsgsgb"), - new FieldMapping().withIdentifier("uzqgnjdgkynsc").withColumnName("qhzvhxnkomt"), - new FieldMapping().withIdentifier("bo").withColumnName("pnvdxz"))), - new EntityMapping().withEntityType(EntityMappingType.FILE_HASH) - .withFieldMappings(Arrays.asList(new FieldMapping().withIdentifier("bbc").withColumnName("qagt"), - new FieldMapping().withIdentifier("dhlfkqojpykvgt").withColumnName("cnifm"))), - new EntityMapping().withEntityType(EntityMappingType.PROCESS) - .withFieldMappings(Arrays.asList(new FieldMapping().withIdentifier("brn").withColumnName("u"), - new FieldMapping().withIdentifier("prafwgckhoc").withColumnName("d"), - new FieldMapping().withIdentifier("fwafqrouda").withColumnName("avehhrvkbunzo"), - new FieldMapping().withIdentifier("dhcxgkmoy").withColumnName("dyuib"))))) - .withAlertDetailsOverride(new AlertDetailsOverride().withAlertDisplayNameFormat("dnbzydvfvfcjn") - .withAlertDescriptionFormat("oisrvhmgorffu") - .withAlertTacticsColumnName("scvwmzhwplef") - .withAlertSeverityColumnName("vxilcbt")); - model = BinaryData.fromObject(model).toObject(ScheduledAlertRule.class); - Assertions.assertEquals("hnze", model.etag()); - Assertions.assertEquals("zgkrvqe", model.alertRuleTemplateName()); - Assertions.assertEquals("toepryu", model.templateVersion()); - Assertions.assertEquals("wytpzdmovz", model.description()); - Assertions.assertEquals("fvaawzqa", model.displayName()); - Assertions.assertEquals(false, model.enabled()); - Assertions.assertEquals(Duration.parse("PT90H15M52S"), model.suppressionDuration()); - Assertions.assertEquals(false, model.suppressionEnabled()); - Assertions.assertEquals(AttackTactic.INITIAL_ACCESS, model.tactics().get(0)); - Assertions.assertEquals("cx", model.techniques().get(0)); - Assertions.assertEquals(false, model.incidentConfiguration().createIncident()); - Assertions.assertEquals(false, model.incidentConfiguration().groupingConfiguration().enabled()); - Assertions.assertEquals(false, model.incidentConfiguration().groupingConfiguration().reopenClosedIncident()); - Assertions.assertEquals(Duration.parse("PT157H29M48S"), - model.incidentConfiguration().groupingConfiguration().lookbackDuration()); - Assertions.assertEquals(MatchingMethod.ALL_ENTITIES, - model.incidentConfiguration().groupingConfiguration().matchingMethod()); - Assertions.assertEquals(EntityMappingType.URL, - model.incidentConfiguration().groupingConfiguration().groupByEntities().get(0)); - Assertions.assertEquals(AlertDetail.DISPLAY_NAME, - model.incidentConfiguration().groupingConfiguration().groupByAlertDetails().get(0)); - Assertions.assertEquals("bf", - model.incidentConfiguration().groupingConfiguration().groupByCustomDetails().get(0)); - Assertions.assertEquals("hya", model.query()); - Assertions.assertEquals(Duration.parse("PT53H1M13S"), model.queryFrequency()); - Assertions.assertEquals(Duration.parse("PT47H45M53S"), model.queryPeriod()); - Assertions.assertEquals(AlertSeverity.INFORMATIONAL, model.severity()); - Assertions.assertEquals(TriggerOperator.EQUAL, model.triggerOperator()); - Assertions.assertEquals(1339269194, model.triggerThreshold()); - Assertions.assertEquals(EventGroupingAggregationKind.SINGLE_ALERT, - model.eventGroupingSettings().aggregationKind()); - Assertions.assertEquals("omdynhdwdigum", model.customDetails().get("nraauzz")); - Assertions.assertEquals(EntityMappingType.MAIL_MESSAGE, model.entityMappings().get(0).entityType()); - Assertions.assertEquals("zhezwwvaiq", model.entityMappings().get(0).fieldMappings().get(0).identifier()); - Assertions.assertEquals("vv", model.entityMappings().get(0).fieldMappings().get(0).columnName()); - Assertions.assertEquals("dnbzydvfvfcjn", model.alertDetailsOverride().alertDisplayNameFormat()); - Assertions.assertEquals("oisrvhmgorffu", model.alertDetailsOverride().alertDescriptionFormat()); - Assertions.assertEquals("scvwmzhwplef", model.alertDetailsOverride().alertTacticsColumnName()); - Assertions.assertEquals("vxilcbt", model.alertDetailsOverride().alertSeverityColumnName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertPropertiesConfidenceReasonsItemTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertPropertiesConfidenceReasonsItemTests.java deleted file mode 100644 index 5138684d69c8..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertPropertiesConfidenceReasonsItemTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.SecurityAlertPropertiesConfidenceReasonsItem; - -public final class SecurityAlertPropertiesConfidenceReasonsItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityAlertPropertiesConfidenceReasonsItem model - = BinaryData.fromString("{\"reason\":\"cwzzhxgktr\",\"reasonType\":\"ucnapkteoellwp\"}") - .toObject(SecurityAlertPropertiesConfidenceReasonsItem.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityAlertPropertiesConfidenceReasonsItem model = new SecurityAlertPropertiesConfidenceReasonsItem(); - model = BinaryData.fromObject(model).toObject(SecurityAlertPropertiesConfidenceReasonsItem.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertPropertiesTests.java deleted file mode 100644 index b5758e862be4..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertPropertiesTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.SecurityAlertProperties; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import org.junit.jupiter.api.Assertions; - -public final class SecurityAlertPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityAlertProperties model = BinaryData.fromString( - "{\"alertDisplayName\":\"bbcswsrtjri\",\"alertType\":\"rbpbewtghfgblcg\",\"compromisedEntity\":\"zvlvqhjkbegib\",\"confidenceLevel\":\"Low\",\"confidenceReasons\":[{\"reason\":\"bwwaloa\",\"reasonType\":\"cgwrtzjuz\"},{\"reason\":\"yzm\",\"reasonType\":\"xongmtsavjcbpwxq\"},{\"reason\":\"rknftguvriuhprwm\",\"reasonType\":\"vxqtayriwwroyqbe\"},{\"reason\":\"mcqibycnojv\",\"reasonType\":\"mefqsgzvahapjyzh\"}],\"confidenceScore\":33.436857957529575,\"confidenceScoreStatus\":\"Final\",\"description\":\"rvxdjzlmw\",\"endTimeUtc\":\"2021-07-11T22:18:52Z\",\"intent\":\"CredentialAccess\",\"providerAlertId\":\"hzovawjvzunlut\",\"processingEndTime\":\"2021-09-06T05:22:37Z\",\"productComponentName\":\"rnxipei\",\"productName\":\"jzuaejxdultskzbb\",\"productVersion\":\"zumveekgpwo\",\"remediationSteps\":[\"kfpbs\",\"yofd\"],\"severity\":\"Low\",\"startTimeUtc\":\"2021-06-15T07:35:54Z\",\"status\":\"Dismissed\",\"systemAlertId\":\"ouwaboekqvkeln\",\"tactics\":[\"ImpairProcessControl\",\"DefenseEvasion\",\"PrivilegeEscalation\"],\"timeGenerated\":\"2021-08-14T03:50:42Z\",\"vendorName\":\"flhhcaal\",\"alertLink\":\"ixisxyawjoy\",\"resourceIdentifiers\":[\"dataslyjpkiid\",\"datayexz\"],\"additionalData\":{\"lhbnxkna\":\"dataixhnrztf\",\"pnapnyiropuh\":\"dataaulppggd\",\"git\":\"dataigvpgylg\"},\"friendlyName\":\"edjvcslynqw\"}") - .toObject(SecurityAlertProperties.class); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityAlertProperties model = new SecurityAlertProperties().withSeverity(AlertSeverity.LOW); - model = BinaryData.fromObject(model).toObject(SecurityAlertProperties.class); - Assertions.assertEquals(AlertSeverity.LOW, model.severity()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertTests.java deleted file mode 100644 index d69a1f9fd63a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityAlertTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.AlertSeverity; -import com.azure.resourcemanager.securityinsights.models.SecurityAlert; -import org.junit.jupiter.api.Assertions; - -public final class SecurityAlertTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityAlert model = BinaryData.fromString( - "{\"kind\":\"SecurityAlert\",\"properties\":{\"alertDisplayName\":\"kfrlhrxsbky\",\"alertType\":\"ycanuzbpzkafku\",\"compromisedEntity\":\"crnwbmeh\",\"confidenceLevel\":\"High\",\"confidenceReasons\":[{\"reason\":\"us\",\"reasonType\":\"slhs\"}],\"confidenceScore\":36.31152947614292,\"confidenceScoreStatus\":\"NotFinal\",\"description\":\"ofmxagkvtmelmqkr\",\"endTimeUtc\":\"2021-09-27T01:04:36Z\",\"intent\":\"Execution\",\"providerAlertId\":\"uahaquhcdhmd\",\"processingEndTime\":\"2021-08-16T04:58:12Z\",\"productComponentName\":\"exq\",\"productName\":\"fadmws\",\"productVersion\":\"r\",\"remediationSteps\":[\"pv\",\"omzlfmi\"],\"severity\":\"High\",\"startTimeUtc\":\"2021-01-11T23:53:59Z\",\"status\":\"New\",\"systemAlertId\":\"ldawkzbaliourqha\",\"tactics\":[\"PreAttack\",\"Execution\",\"PreAttack\"],\"timeGenerated\":\"2021-10-31T19:11:47Z\",\"vendorName\":\"wxosowzxcug\",\"alertLink\":\"jooxdjebw\",\"resourceIdentifiers\":[\"datawwfvov\",\"datavmeueci\",\"datayhz\"],\"additionalData\":{\"ytdxwit\":\"dataojgjrwjueiotwmc\",\"hniskxfbkpyc\":\"datanrjawgqwg\"},\"friendlyName\":\"lwn\"},\"id\":\"hjdauwhvylwz\",\"name\":\"tdhxujznbmpowuwp\",\"type\":\"zqlveualupjmkhf\"}") - .toObject(SecurityAlert.class); - Assertions.assertEquals(AlertSeverity.HIGH, model.severity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityAlert model = new SecurityAlert().withSeverity(AlertSeverity.HIGH); - model = BinaryData.fromObject(model).toObject(SecurityAlert.class); - Assertions.assertEquals(AlertSeverity.HIGH, model.severity()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityGroupEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityGroupEntityPropertiesTests.java deleted file mode 100644 index de9277bb3bb2..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityGroupEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.SecurityGroupEntityProperties; - -public final class SecurityGroupEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityGroupEntityProperties model = BinaryData.fromString( - "{\"distinguishedName\":\"oaedsxjwuivedwcg\",\"objectGuid\":\"3fbf2976-7689-4559-9a1f-9adc88bce981\",\"sid\":\"wxeiqbpsmgomg\",\"additionalData\":{\"gaufcs\":\"dataljdlrgmspl\",\"wgnxkympqanxrj\":\"datahvn\",\"bta\":\"dataixt\",\"lhkgmnsghp\":\"dataypnyghshxc\"},\"friendlyName\":\"cphdrwjjkhvyo\"}") - .toObject(SecurityGroupEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityGroupEntityProperties model = new SecurityGroupEntityProperties(); - model = BinaryData.fromObject(model).toObject(SecurityGroupEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityGroupEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityGroupEntityTests.java deleted file mode 100644 index 82fafe2300a5..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityGroupEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.SecurityGroupEntity; - -public final class SecurityGroupEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityGroupEntity model = BinaryData.fromString( - "{\"kind\":\"SecurityGroup\",\"properties\":{\"distinguishedName\":\"mrjgeihfqlggwfi\",\"objectGuid\":\"3a7769ca-865b-49bd-861b-07935c840b63\",\"sid\":\"xmjpbyep\",\"additionalData\":{\"ljvrcmyfqipgxhnp\":\"datat\"},\"friendlyName\":\"yqwcabvnuil\"},\"id\":\"yaswlpaugmr\",\"name\":\"fjlrxwtoauk\",\"type\":\"fkvcisi\"}") - .toObject(SecurityGroupEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityGroupEntity model = new SecurityGroupEntity(); - model = BinaryData.fromObject(model).toObject(SecurityGroupEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingInnerTests.java deleted file mode 100644 index 03d0dec60668..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingInnerTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.SecurityMLAnalyticsSettingInner; -import org.junit.jupiter.api.Assertions; - -public final class SecurityMLAnalyticsSettingInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityMLAnalyticsSettingInner model = BinaryData.fromString( - "{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"eyvpnqicvinvkj\",\"id\":\"dxrbuukzcle\",\"name\":\"yhmlwpaztzp\",\"type\":\"fn\"}") - .toObject(SecurityMLAnalyticsSettingInner.class); - Assertions.assertEquals("eyvpnqicvinvkj", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityMLAnalyticsSettingInner model = new SecurityMLAnalyticsSettingInner().withEtag("eyvpnqicvinvkj"); - model = BinaryData.fromObject(model).toObject(SecurityMLAnalyticsSettingInner.class); - Assertions.assertEquals("eyvpnqicvinvkj", model.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsCreateOrUpdateWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index ef40b595085c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.fluent.models.SecurityMLAnalyticsSettingInner; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSetting; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SecurityMLAnalyticsSettingsCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"mseharx\",\"id\":\"vqnrxtmbpj\",\"name\":\"tnvw\",\"type\":\"hrsidq\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - SecurityMLAnalyticsSetting response = manager.securityMLAnalyticsSettings() - .createOrUpdateWithResponse("fkd", "chlzvfi", "tnkjjwgcwnphb", - new SecurityMLAnalyticsSettingInner().withEtag("fyrtogmhmjp"), com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("mseharx", response.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDataSourceTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDataSourceTests.java deleted file mode 100644 index 1c86ce7599ae..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDataSourceTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettingsDataSource; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SecurityMLAnalyticsSettingsDataSourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityMLAnalyticsSettingsDataSource model = BinaryData.fromString( - "{\"connectorId\":\"xtbjwgnyfusfzsv\",\"dataTypes\":[\"kzhajqglcfhm\",\"rqryxynqn\",\"rd\",\"sovwxznptgoeiyb\"]}") - .toObject(SecurityMLAnalyticsSettingsDataSource.class); - Assertions.assertEquals("xtbjwgnyfusfzsv", model.connectorId()); - Assertions.assertEquals("kzhajqglcfhm", model.dataTypes().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityMLAnalyticsSettingsDataSource model - = new SecurityMLAnalyticsSettingsDataSource().withConnectorId("xtbjwgnyfusfzsv") - .withDataTypes(Arrays.asList("kzhajqglcfhm", "rqryxynqn", "rd", "sovwxznptgoeiyb")); - model = BinaryData.fromObject(model).toObject(SecurityMLAnalyticsSettingsDataSource.class); - Assertions.assertEquals("xtbjwgnyfusfzsv", model.connectorId()); - Assertions.assertEquals("kzhajqglcfhm", model.dataTypes().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDeleteWithResponseMockTests.java deleted file mode 100644 index 5f2276ab3f49..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SecurityMLAnalyticsSettingsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.securityMLAnalyticsSettings() - .deleteWithResponse("xlbtp", "kft", "gatwmykyu", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsGetWithResponseMockTests.java deleted file mode 100644 index 6536d97f8479..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsGetWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSetting; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SecurityMLAnalyticsSettingsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"pfulube\",\"id\":\"ybpmf\",\"name\":\"fununmpzk\",\"type\":\"vfy\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - SecurityMLAnalyticsSetting response = manager.securityMLAnalyticsSettings() - .getWithResponse("vmywhsbrcarycsjj", "yvoaqajuvehzp", "dmkrrb", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("pfulube", response.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListMockTests.java deleted file mode 100644 index 8adbf9b88218..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSetting; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SecurityMLAnalyticsSettingsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"wbnfddepl\",\"id\":\"qjn\",\"name\":\"f\",\"type\":\"ygleexa\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.securityMLAnalyticsSettings() - .list("ptyrilkfbnrqqxv", "tpbnfnqtxjtoma", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("wbnfddepl", response.iterator().next().etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListTests.java deleted file mode 100644 index b15b9113e35a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SecurityMLAnalyticsSettingsListTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.SecurityMLAnalyticsSettingInner; -import com.azure.resourcemanager.securityinsights.models.SecurityMLAnalyticsSettingsList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SecurityMLAnalyticsSettingsListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SecurityMLAnalyticsSettingsList model = BinaryData.fromString( - "{\"nextLink\":\"brqubp\",\"value\":[{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"exiili\",\"id\":\"dtiirqt\",\"name\":\"qoaxoruzfgs\",\"type\":\"uyfxrxxleptramxj\"},{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"wlwnwxuqlcv\",\"id\":\"ypatdooaojkniod\",\"name\":\"oo\",\"type\":\"bw\"},{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"jhemms\",\"id\":\"dkcrodt\",\"name\":\"infwjlfltkacjve\",\"type\":\"kdlfoa\"},{\"kind\":\"SecurityMLAnalyticsSetting\",\"etag\":\"gkfpaga\",\"id\":\"pulpqblylsyxk\",\"name\":\"jnsjervtiagxsd\",\"type\":\"zuempsbzkf\"}]}") - .toObject(SecurityMLAnalyticsSettingsList.class); - Assertions.assertEquals("exiili", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SecurityMLAnalyticsSettingsList model = new SecurityMLAnalyticsSettingsList() - .withValue(Arrays.asList(new SecurityMLAnalyticsSettingInner().withEtag("exiili"), - new SecurityMLAnalyticsSettingInner().withEtag("wlwnwxuqlcv"), - new SecurityMLAnalyticsSettingInner().withEtag("jhemms"), - new SecurityMLAnalyticsSettingInner().withEtag("gkfpaga"))); - model = BinaryData.fromObject(model).toObject(SecurityMLAnalyticsSettingsList.class); - Assertions.assertEquals("exiili", model.value().get(0).etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesDeleteWithResponseMockTests.java deleted file mode 100644 index af10894f33f8..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SentinelOnboardingStatesDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SentinelOnboardingStatesDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.sentinelOnboardingStates() - .deleteWithResponse("myck", "exn", "akckywym", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SubmissionMailEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SubmissionMailEntityPropertiesTests.java deleted file mode 100644 index d546c9864440..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SubmissionMailEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.SubmissionMailEntityProperties; - -public final class SubmissionMailEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubmissionMailEntityProperties model = BinaryData.fromString( - "{\"networkMessageId\":\"09792fe3-0a81-469d-8aa4-bafbee39423f\",\"submissionId\":\"e70c4d1c-6897-4885-a064-b2462c12363b\",\"submitter\":\"m\",\"submissionDate\":\"2021-09-03T01:56:24Z\",\"timestamp\":\"2021-09-20T20:14:10Z\",\"recipient\":\"hspnxwqagnepz\",\"sender\":\"klsbsbqqqagw\",\"senderIp\":\"xaomzisglrrc\",\"subject\":\"zkhhltnjadhqo\",\"reportType\":\"jqoyueayfbpcm\",\"additionalData\":{\"mg\":\"databyrrueqth\",\"gdhxi\":\"datambscbbx\"},\"friendlyName\":\"lopedbwdpyqyyb\"}") - .toObject(SubmissionMailEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubmissionMailEntityProperties model = new SubmissionMailEntityProperties(); - model = BinaryData.fromObject(model).toObject(SubmissionMailEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SubmissionMailEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SubmissionMailEntityTests.java deleted file mode 100644 index 11da8f05b310..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/SubmissionMailEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.SubmissionMailEntity; - -public final class SubmissionMailEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubmissionMailEntity model = BinaryData.fromString( - "{\"kind\":\"SubmissionMail\",\"properties\":{\"networkMessageId\":\"70dd29cb-b486-4ae4-bfe1-27271c47a3c5\",\"submissionId\":\"5c651281-e263-4736-b0fa-dc622e6d86d4\",\"submitter\":\"zvxnqmhrp\",\"submissionDate\":\"2021-05-17T11:48:53Z\",\"timestamp\":\"2021-11-23T19:55:35Z\",\"recipient\":\"kois\",\"sender\":\"ssffxuifmc\",\"senderIp\":\"p\",\"subject\":\"kdqzrdzsylo\",\"reportType\":\"gtrczzydmxzjijpv\",\"additionalData\":{\"fx\":\"datarkihcirld\",\"ja\":\"datadcoxnbk\"},\"friendlyName\":\"rnnqb\"},\"id\":\"bpizxqltgr\",\"name\":\"ogypxrxvbfihwu\",\"type\":\"vctafsrb\"}") - .toObject(SubmissionMailEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubmissionMailEntity model = new SubmissionMailEntity(); - model = BinaryData.fromObject(model).toObject(SubmissionMailEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorDataTypesIndicatorsTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorDataTypesIndicatorsTests.java deleted file mode 100644 index e5791c167151..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorDataTypesIndicatorsTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypesIndicators; -import org.junit.jupiter.api.Assertions; - -public final class TIDataConnectorDataTypesIndicatorsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TIDataConnectorDataTypesIndicators model - = BinaryData.fromString("{\"state\":\"Disabled\"}").toObject(TIDataConnectorDataTypesIndicators.class); - Assertions.assertEquals(DataTypeState.DISABLED, model.state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TIDataConnectorDataTypesIndicators model - = new TIDataConnectorDataTypesIndicators().withState(DataTypeState.DISABLED); - model = BinaryData.fromObject(model).toObject(TIDataConnectorDataTypesIndicators.class); - Assertions.assertEquals(DataTypeState.DISABLED, model.state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorDataTypesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorDataTypesTests.java deleted file mode 100644 index 260016f76572..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorDataTypesTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypesIndicators; -import org.junit.jupiter.api.Assertions; - -public final class TIDataConnectorDataTypesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TIDataConnectorDataTypes model = BinaryData.fromString("{\"indicators\":{\"state\":\"Enabled\"}}") - .toObject(TIDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.indicators().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TIDataConnectorDataTypes model = new TIDataConnectorDataTypes() - .withIndicators(new TIDataConnectorDataTypesIndicators().withState(DataTypeState.ENABLED)); - model = BinaryData.fromObject(model).toObject(TIDataConnectorDataTypes.class); - Assertions.assertEquals(DataTypeState.ENABLED, model.indicators().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorPropertiesTests.java deleted file mode 100644 index f7904c8361c3..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorPropertiesTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.TIDataConnectorProperties; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypesIndicators; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class TIDataConnectorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TIDataConnectorProperties model = BinaryData.fromString( - "{\"tenantId\":\"ypundmbxhugc\",\"tipLookbackPeriod\":\"2021-02-05T12:35:53Z\",\"dataTypes\":{\"indicators\":{\"state\":\"Disabled\"}}}") - .toObject(TIDataConnectorProperties.class); - Assertions.assertEquals("ypundmbxhugc", model.tenantId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-05T12:35:53Z"), model.tipLookbackPeriod()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().indicators().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TIDataConnectorProperties model = new TIDataConnectorProperties().withTenantId("ypundmbxhugc") - .withTipLookbackPeriod(OffsetDateTime.parse("2021-02-05T12:35:53Z")) - .withDataTypes(new TIDataConnectorDataTypes() - .withIndicators(new TIDataConnectorDataTypesIndicators().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(TIDataConnectorProperties.class); - Assertions.assertEquals("ypundmbxhugc", model.tenantId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-05T12:35:53Z"), model.tipLookbackPeriod()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().indicators().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorTests.java deleted file mode 100644 index f47b6b20c386..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/TIDataConnectorTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.DataTypeState; -import com.azure.resourcemanager.securityinsights.models.TIDataConnector; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypes; -import com.azure.resourcemanager.securityinsights.models.TIDataConnectorDataTypesIndicators; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class TIDataConnectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TIDataConnector model = BinaryData.fromString( - "{\"kind\":\"ThreatIntelligence\",\"properties\":{\"tenantId\":\"znuciqdsm\",\"tipLookbackPeriod\":\"2021-05-19T04:46:27Z\",\"dataTypes\":{\"indicators\":{\"state\":\"Disabled\"}}},\"etag\":\"xtyasiibmiyb\",\"id\":\"ustgnljhnmgixhc\",\"name\":\"avmqfoudor\",\"type\":\"cgyypro\"}") - .toObject(TIDataConnector.class); - Assertions.assertEquals("xtyasiibmiyb", model.etag()); - Assertions.assertEquals("znuciqdsm", model.tenantId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-19T04:46:27Z"), model.tipLookbackPeriod()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().indicators().state()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TIDataConnector model = new TIDataConnector().withEtag("xtyasiibmiyb") - .withTenantId("znuciqdsm") - .withTipLookbackPeriod(OffsetDateTime.parse("2021-05-19T04:46:27Z")) - .withDataTypes(new TIDataConnectorDataTypes() - .withIndicators(new TIDataConnectorDataTypesIndicators().withState(DataTypeState.DISABLED))); - model = BinaryData.fromObject(model).toObject(TIDataConnector.class); - Assertions.assertEquals("xtyasiibmiyb", model.etag()); - Assertions.assertEquals("znuciqdsm", model.tenantId()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-19T04:46:27Z"), model.tipLookbackPeriod()); - Assertions.assertEquals(DataTypeState.DISABLED, model.dataTypes().indicators().state()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceAppendTagsTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceAppendTagsTests.java deleted file mode 100644 index 3566177486ea..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceAppendTagsTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceAppendTags; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceAppendTagsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceAppendTags model - = BinaryData.fromString("{\"threatIntelligenceTags\":[\"qufegxuvwzfbn\",\"lmctlpd\",\"gitvg\"]}") - .toObject(ThreatIntelligenceAppendTags.class); - Assertions.assertEquals("qufegxuvwzfbn", model.threatIntelligenceTags().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceAppendTags model = new ThreatIntelligenceAppendTags() - .withThreatIntelligenceTags(Arrays.asList("qufegxuvwzfbn", "lmctlpd", "gitvg")); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceAppendTags.class); - Assertions.assertEquals("qufegxuvwzfbn", model.threatIntelligenceTags().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceExternalReferenceTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceExternalReferenceTests.java deleted file mode 100644 index f098e4344a0d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceExternalReferenceTests.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceExternalReference; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceExternalReferenceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceExternalReference model = BinaryData.fromString( - "{\"description\":\"swhccsphk\",\"externalId\":\"vwitqscyw\",\"sourceName\":\"gwol\",\"url\":\"czbwemhairsbr\",\"hashes\":{\"ggicccnxqhue\":\"wmsweypqwd\",\"zrncsdt\":\"mkttlstvlzywem\",\"bsfgytguslfea\":\"lusiy\"}}") - .toObject(ThreatIntelligenceExternalReference.class); - Assertions.assertEquals("swhccsphk", model.description()); - Assertions.assertEquals("vwitqscyw", model.externalId()); - Assertions.assertEquals("gwol", model.sourceName()); - Assertions.assertEquals("czbwemhairsbr", model.url()); - Assertions.assertEquals("wmsweypqwd", model.hashes().get("ggicccnxqhue")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceExternalReference model - = new ThreatIntelligenceExternalReference().withDescription("swhccsphk") - .withExternalId("vwitqscyw") - .withSourceName("gwol") - .withUrl("czbwemhairsbr") - .withHashes(mapOf("ggicccnxqhue", "wmsweypqwd", "zrncsdt", "mkttlstvlzywem", "bsfgytguslfea", "lusiy")); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceExternalReference.class); - Assertions.assertEquals("swhccsphk", model.description()); - Assertions.assertEquals("vwitqscyw", model.externalId()); - Assertions.assertEquals("gwol", model.sourceName()); - Assertions.assertEquals("czbwemhairsbr", model.url()); - Assertions.assertEquals("wmsweypqwd", model.hashes().get("ggicccnxqhue")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceGranularMarkingModelTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceGranularMarkingModelTests.java deleted file mode 100644 index bfa97beed4bf..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceGranularMarkingModelTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceGranularMarkingModel; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceGranularMarkingModelTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceGranularMarkingModel model = BinaryData.fromString( - "{\"language\":\"ygqukyhejh\",\"markingRef\":435176888,\"selectors\":[\"fpel\",\"lppvksrpq\",\"ujzra\",\"htwdwrftswibyrcd\"]}") - .toObject(ThreatIntelligenceGranularMarkingModel.class); - Assertions.assertEquals("ygqukyhejh", model.language()); - Assertions.assertEquals(435176888, model.markingRef()); - Assertions.assertEquals("fpel", model.selectors().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceGranularMarkingModel model - = new ThreatIntelligenceGranularMarkingModel().withLanguage("ygqukyhejh") - .withMarkingRef(435176888) - .withSelectors(Arrays.asList("fpel", "lppvksrpq", "ujzra", "htwdwrftswibyrcd")); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceGranularMarkingModel.class); - Assertions.assertEquals("ygqukyhejh", model.language()); - Assertions.assertEquals(435176888, model.markingRef()); - Assertions.assertEquals("fpel", model.selectors().get(0)); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorMetricsListWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorMetricsListWithResponseMockTests.java deleted file mode 100644 index 9751c1f21e69..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorMetricsListWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetricsList; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ThreatIntelligenceIndicatorMetricsListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"lastUpdatedTimeUtc\":\"bicziuswswj\",\"threatTypeMetrics\":[{}],\"patternTypeMetrics\":[{},{}],\"sourceMetrics\":[{},{},{},{}]}},{\"properties\":{\"lastUpdatedTimeUtc\":\"qqvyfscyrfw\",\"threatTypeMetrics\":[{},{}],\"patternTypeMetrics\":[{},{},{}],\"sourceMetrics\":[{},{}]}},{\"properties\":{\"lastUpdatedTimeUtc\":\"yzwvbhlimbyqec\",\"threatTypeMetrics\":[{},{},{},{}],\"patternTypeMetrics\":[{},{}],\"sourceMetrics\":[{},{},{},{}]}},{\"properties\":{\"lastUpdatedTimeUtc\":\"rdaasaxxo\",\"threatTypeMetrics\":[{},{},{}],\"patternTypeMetrics\":[{}],\"sourceMetrics\":[{},{}]}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ThreatIntelligenceMetricsList response = manager.threatIntelligenceIndicatorMetrics() - .listWithResponse("cldpkawn", "nlaimouxwksqmudm", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("bicziuswswj", response.value().get(0).properties().lastUpdatedTimeUtc()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsAppendTagsWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsAppendTagsWithResponseMockTests.java deleted file mode 100644 index e1c59f642a16..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsAppendTagsWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceAppendTags; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ThreatIntelligenceIndicatorsAppendTagsWithResponseMockTests { - @Test - public void testAppendTagsWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.threatIntelligenceIndicators() - .appendTagsWithResponse( - "crdcueljti", "hxmfqryarvsxzqb", "lcjkayspthzodub", new ThreatIntelligenceAppendTags() - .withThreatIntelligenceTags(Arrays.asList("jtgblios", "kfmkmfdjxyxgbk", "qvjcteoe", "l")), - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsDeleteWithResponseMockTests.java deleted file mode 100644 index 36fad5c7d313..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ThreatIntelligenceIndicatorsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.threatIntelligenceIndicators() - .deleteWithResponse("dr", "bfcmkrfts", "cwjjxsgmbawvif", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsGetWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsGetWithResponseMockTests.java deleted file mode 100644 index a1a98e0a662c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsGetWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceInformation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ThreatIntelligenceIndicatorsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"kind\":\"ThreatIntelligenceInformation\",\"etag\":\"wvaexhdctr\",\"id\":\"qnkbrupobehdm\",\"name\":\"jzacvumepjpbibn\",\"type\":\"pphepifexl\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ThreatIntelligenceInformation response = manager.threatIntelligenceIndicators() - .getWithResponse("w", "lqkznxhhllxricct", "wmuqqoajxeiygle", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("wvaexhdctr", response.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsOperationsListMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsOperationsListMockTests.java deleted file mode 100644 index 0eb920f27217..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceIndicatorsOperationsListMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceInformation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ThreatIntelligenceIndicatorsOperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"kind\":\"ThreatIntelligenceInformation\",\"etag\":\"nwfrkebsmhpd\",\"id\":\"dig\",\"name\":\"toleksc\",\"type\":\"ctnanqimwbzxp\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.threatIntelligenceIndicatorsOperations() - .list("qbmfuvqarwz", "uqrebluimmbwx", "fgtdmbvx", 1608233960, "raokqkbudb", "waokbavlytta", - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("nwfrkebsmhpd", response.iterator().next().etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceInformationInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceInformationInnerTests.java deleted file mode 100644 index 71030ba8c2a7..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceInformationInnerTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceInformationInner; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceInformationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceInformationInner model = BinaryData.fromString( - "{\"kind\":\"ThreatIntelligenceInformation\",\"etag\":\"h\",\"id\":\"fwpracstwi\",\"name\":\"ykhevxccedcpnmdy\",\"type\":\"dnwzxltjcvnhltiu\"}") - .toObject(ThreatIntelligenceInformationInner.class); - Assertions.assertEquals("h", model.etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceInformationInner model = new ThreatIntelligenceInformationInner().withEtag("h"); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceInformationInner.class); - Assertions.assertEquals("h", model.etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceInformationListTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceInformationListTests.java deleted file mode 100644 index c88c01ec1765..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceInformationListTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceInformationInner; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceInformationList; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceInformationListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceInformationList model = BinaryData.fromString( - "{\"nextLink\":\"xnavvwxq\",\"value\":[{\"kind\":\"ThreatIntelligenceInformation\",\"etag\":\"qunyowxwlmdjr\",\"id\":\"fgbvfvpdbo\",\"name\":\"acizsjqlhkrr\",\"type\":\"bdeibqipqk\"},{\"kind\":\"ThreatIntelligenceInformation\",\"etag\":\"vxndz\",\"id\":\"krefajpjo\",\"name\":\"wkqnyhg\",\"type\":\"ij\"}]}") - .toObject(ThreatIntelligenceInformationList.class); - Assertions.assertEquals("qunyowxwlmdjr", model.value().get(0).etag()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceInformationList model = new ThreatIntelligenceInformationList() - .withValue(Arrays.asList(new ThreatIntelligenceInformationInner().withEtag("qunyowxwlmdjr"), - new ThreatIntelligenceInformationInner().withEtag("vxndz"))); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceInformationList.class); - Assertions.assertEquals("qunyowxwlmdjr", model.value().get(0).etag()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceKillChainPhaseTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceKillChainPhaseTests.java deleted file mode 100644 index 7ad3ab00507b..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceKillChainPhaseTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceKillChainPhase; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceKillChainPhaseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceKillChainPhase model - = BinaryData.fromString("{\"killChainName\":\"rfdwoyu\",\"phaseName\":\"ziuiefozbhdm\"}") - .toObject(ThreatIntelligenceKillChainPhase.class); - Assertions.assertEquals("rfdwoyu", model.killChainName()); - Assertions.assertEquals("ziuiefozbhdm", model.phaseName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceKillChainPhase model - = new ThreatIntelligenceKillChainPhase().withKillChainName("rfdwoyu").withPhaseName("ziuiefozbhdm"); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceKillChainPhase.class); - Assertions.assertEquals("rfdwoyu", model.killChainName()); - Assertions.assertEquals("ziuiefozbhdm", model.phaseName()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricEntityTests.java deleted file mode 100644 index 6b1a80e25cce..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricEntityTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetricEntity; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceMetricEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceMetricEntity model - = BinaryData.fromString("{\"metricName\":\"vyhgs\",\"metricValue\":2121939227}") - .toObject(ThreatIntelligenceMetricEntity.class); - Assertions.assertEquals("vyhgs", model.metricName()); - Assertions.assertEquals(2121939227, model.metricValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceMetricEntity model - = new ThreatIntelligenceMetricEntity().withMetricName("vyhgs").withMetricValue(2121939227); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceMetricEntity.class); - Assertions.assertEquals("vyhgs", model.metricName()); - Assertions.assertEquals(2121939227, model.metricValue()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricTests.java deleted file mode 100644 index 6101e329c21c..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetric; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetricEntity; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceMetricTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceMetric model = BinaryData.fromString( - "{\"lastUpdatedTimeUtc\":\"epbqpcrfkbw\",\"threatTypeMetrics\":[{\"metricName\":\"jvcdwxlpqekf\",\"metricValue\":839437170},{\"metricName\":\"tjsyin\",\"metricValue\":291919724},{\"metricName\":\"atmtdhtmdvy\",\"metricValue\":932898449},{\"metricName\":\"dgszywkbirryuzh\",\"metricValue\":524454595}],\"patternTypeMetrics\":[{\"metricName\":\"rvqqaatj\",\"metricValue\":379667314},{\"metricName\":\"goupmfiibfg\",\"metricValue\":2107533163},{\"metricName\":\"olvrw\",\"metricValue\":148831092}],\"sourceMetrics\":[{\"metricName\":\"gllqwjy\",\"metricValue\":104545862},{\"metricName\":\"yvblmhvkzu\",\"metricValue\":919724990}]}") - .toObject(ThreatIntelligenceMetric.class); - Assertions.assertEquals("epbqpcrfkbw", model.lastUpdatedTimeUtc()); - Assertions.assertEquals("jvcdwxlpqekf", model.threatTypeMetrics().get(0).metricName()); - Assertions.assertEquals(839437170, model.threatTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("rvqqaatj", model.patternTypeMetrics().get(0).metricName()); - Assertions.assertEquals(379667314, model.patternTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("gllqwjy", model.sourceMetrics().get(0).metricName()); - Assertions.assertEquals(104545862, model.sourceMetrics().get(0).metricValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceMetric model = new ThreatIntelligenceMetric().withLastUpdatedTimeUtc("epbqpcrfkbw") - .withThreatTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("jvcdwxlpqekf").withMetricValue(839437170), - new ThreatIntelligenceMetricEntity().withMetricName("tjsyin").withMetricValue(291919724), - new ThreatIntelligenceMetricEntity().withMetricName("atmtdhtmdvy").withMetricValue(932898449), - new ThreatIntelligenceMetricEntity().withMetricName("dgszywkbirryuzh").withMetricValue(524454595))) - .withPatternTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("rvqqaatj").withMetricValue(379667314), - new ThreatIntelligenceMetricEntity().withMetricName("goupmfiibfg").withMetricValue(2107533163), - new ThreatIntelligenceMetricEntity().withMetricName("olvrw").withMetricValue(148831092))) - .withSourceMetrics( - Arrays.asList(new ThreatIntelligenceMetricEntity().withMetricName("gllqwjy").withMetricValue(104545862), - new ThreatIntelligenceMetricEntity().withMetricName("yvblmhvkzu").withMetricValue(919724990))); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceMetric.class); - Assertions.assertEquals("epbqpcrfkbw", model.lastUpdatedTimeUtc()); - Assertions.assertEquals("jvcdwxlpqekf", model.threatTypeMetrics().get(0).metricName()); - Assertions.assertEquals(839437170, model.threatTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("rvqqaatj", model.patternTypeMetrics().get(0).metricName()); - Assertions.assertEquals(379667314, model.patternTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("gllqwjy", model.sourceMetrics().get(0).metricName()); - Assertions.assertEquals(104545862, model.sourceMetrics().get(0).metricValue()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricsListInnerTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricsListInnerTests.java deleted file mode 100644 index 757e097a6899..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricsListInnerTests.java +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceMetricsListInner; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetric; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetricEntity; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetrics; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceMetricsListInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceMetricsListInner model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"lastUpdatedTimeUtc\":\"mouwqlgzrfzeey\",\"threatTypeMetrics\":[{\"metricName\":\"ikayuhqlbjbsybb\",\"metricValue\":140703725},{\"metricName\":\"t\",\"metricValue\":1918019278},{\"metricName\":\"fp\",\"metricValue\":1408041355}],\"patternTypeMetrics\":[{\"metricName\":\"as\",\"metricValue\":753407395},{\"metricName\":\"qfxssmwutw\",\"metricValue\":1224801299},{\"metricName\":\"ezpdrhneu\",\"metricValue\":979577305},{\"metricName\":\"kdw\",\"metricValue\":227245186}],\"sourceMetrics\":[{\"metricName\":\"ircgpikpz\",\"metricValue\":2049479560}]}},{\"properties\":{\"lastUpdatedTimeUtc\":\"anlfzxiavrmbz\",\"threatTypeMetrics\":[{\"metricName\":\"i\",\"metricValue\":485732763},{\"metricName\":\"cirgzp\",\"metricValue\":1656770527},{\"metricName\":\"zszrnwoiindfpw\",\"metricValue\":2003190846}],\"patternTypeMetrics\":[{\"metricName\":\"tlhflsjcdhszf\",\"metricValue\":1868624750},{\"metricName\":\"gofel\",\"metricValue\":940217853},{\"metricName\":\"qmqhldvriii\",\"metricValue\":1756672367}],\"sourceMetrics\":[{\"metricName\":\"hfkvtvsexsowuel\",\"metricValue\":1968234640}]}},{\"properties\":{\"lastUpdatedTimeUtc\":\"hhxvrhmzkwpj\",\"threatTypeMetrics\":[{\"metricName\":\"pughftqsxh\",\"metricValue\":59449335},{\"metricName\":\"xukndxdigr\",\"metricValue\":1599924393},{\"metricName\":\"fzdm\",\"metricValue\":1621102365},{\"metricName\":\"fi\",\"metricValue\":1852140441}],\"patternTypeMetrics\":[{\"metricName\":\"z\",\"metricValue\":867678631}],\"sourceMetrics\":[{\"metricName\":\"pph\",\"metricValue\":1764475997}]}}]}") - .toObject(ThreatIntelligenceMetricsListInner.class); - Assertions.assertEquals("mouwqlgzrfzeey", model.value().get(0).properties().lastUpdatedTimeUtc()); - Assertions.assertEquals("ikayuhqlbjbsybb", - model.value().get(0).properties().threatTypeMetrics().get(0).metricName()); - Assertions.assertEquals(140703725, model.value().get(0).properties().threatTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("as", model.value().get(0).properties().patternTypeMetrics().get(0).metricName()); - Assertions.assertEquals(753407395, model.value().get(0).properties().patternTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("ircgpikpz", model.value().get(0).properties().sourceMetrics().get(0).metricName()); - Assertions.assertEquals(2049479560, model.value().get(0).properties().sourceMetrics().get(0).metricValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceMetricsListInner model - = new ThreatIntelligenceMetricsListInner().withValue(Arrays.asList( - new ThreatIntelligenceMetrics().withProperties(new ThreatIntelligenceMetric() - .withLastUpdatedTimeUtc("mouwqlgzrfzeey") - .withThreatTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("ikayuhqlbjbsybb") - .withMetricValue(140703725), - new ThreatIntelligenceMetricEntity().withMetricName("t").withMetricValue(1918019278), - new ThreatIntelligenceMetricEntity().withMetricName("fp").withMetricValue(1408041355))) - .withPatternTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("as").withMetricValue(753407395), - new ThreatIntelligenceMetricEntity().withMetricName("qfxssmwutw").withMetricValue(1224801299), - new ThreatIntelligenceMetricEntity().withMetricName("ezpdrhneu").withMetricValue(979577305), - new ThreatIntelligenceMetricEntity().withMetricName("kdw").withMetricValue(227245186))) - .withSourceMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("ircgpikpz").withMetricValue(2049479560)))), - new ThreatIntelligenceMetrics() - .withProperties(new ThreatIntelligenceMetric().withLastUpdatedTimeUtc("anlfzxiavrmbz") - .withThreatTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("i").withMetricValue(485732763), - new ThreatIntelligenceMetricEntity().withMetricName("cirgzp").withMetricValue(1656770527), - new ThreatIntelligenceMetricEntity().withMetricName("zszrnwoiindfpw") - .withMetricValue(2003190846))) - .withPatternTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("tlhflsjcdhszf") - .withMetricValue(1868624750), - new ThreatIntelligenceMetricEntity().withMetricName("gofel").withMetricValue(940217853), - new ThreatIntelligenceMetricEntity().withMetricName("qmqhldvriii") - .withMetricValue(1756672367))) - .withSourceMetrics( - Arrays.asList(new ThreatIntelligenceMetricEntity().withMetricName("hfkvtvsexsowuel") - .withMetricValue(1968234640)))), - new ThreatIntelligenceMetrics().withProperties(new ThreatIntelligenceMetric() - .withLastUpdatedTimeUtc("hhxvrhmzkwpj") - .withThreatTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("pughftqsxh").withMetricValue(59449335), - new ThreatIntelligenceMetricEntity().withMetricName("xukndxdigr").withMetricValue(1599924393), - new ThreatIntelligenceMetricEntity().withMetricName("fzdm").withMetricValue(1621102365), - new ThreatIntelligenceMetricEntity().withMetricName("fi").withMetricValue(1852140441))) - .withPatternTypeMetrics(Arrays - .asList(new ThreatIntelligenceMetricEntity().withMetricName("z").withMetricValue(867678631))) - .withSourceMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("pph").withMetricValue(1764475997)))))); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceMetricsListInner.class); - Assertions.assertEquals("mouwqlgzrfzeey", model.value().get(0).properties().lastUpdatedTimeUtc()); - Assertions.assertEquals("ikayuhqlbjbsybb", - model.value().get(0).properties().threatTypeMetrics().get(0).metricName()); - Assertions.assertEquals(140703725, model.value().get(0).properties().threatTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("as", model.value().get(0).properties().patternTypeMetrics().get(0).metricName()); - Assertions.assertEquals(753407395, model.value().get(0).properties().patternTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("ircgpikpz", model.value().get(0).properties().sourceMetrics().get(0).metricName()); - Assertions.assertEquals(2049479560, model.value().get(0).properties().sourceMetrics().get(0).metricValue()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricsTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricsTests.java deleted file mode 100644 index 6793e85e1776..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceMetricsTests.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetric; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetricEntity; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetrics; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceMetricsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceMetrics model = BinaryData.fromString( - "{\"properties\":{\"lastUpdatedTimeUtc\":\"udphqamvdkfwyn\",\"threatTypeMetrics\":[{\"metricName\":\"bvkayh\",\"metricValue\":1068554694},{\"metricName\":\"yqiatkzwp\",\"metricValue\":180338782}],\"patternTypeMetrics\":[{\"metricName\":\"jaesgvvsccya\",\"metricValue\":306781812},{\"metricName\":\"fhwygzlvdnkfxus\",\"metricValue\":1736640593},{\"metricName\":\"zrmuhapfcqdps\",\"metricValue\":399879139},{\"metricName\":\"psvuoymgc\",\"metricValue\":841424592}],\"sourceMetrics\":[{\"metricName\":\"rypqlmfeo\",\"metricValue\":1208971148},{\"metricName\":\"wkyhkobopgxe\",\"metricValue\":1041237961}]}}") - .toObject(ThreatIntelligenceMetrics.class); - Assertions.assertEquals("udphqamvdkfwyn", model.properties().lastUpdatedTimeUtc()); - Assertions.assertEquals("bvkayh", model.properties().threatTypeMetrics().get(0).metricName()); - Assertions.assertEquals(1068554694, model.properties().threatTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("jaesgvvsccya", model.properties().patternTypeMetrics().get(0).metricName()); - Assertions.assertEquals(306781812, model.properties().patternTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("rypqlmfeo", model.properties().sourceMetrics().get(0).metricName()); - Assertions.assertEquals(1208971148, model.properties().sourceMetrics().get(0).metricValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceMetrics model = new ThreatIntelligenceMetrics() - .withProperties(new ThreatIntelligenceMetric().withLastUpdatedTimeUtc("udphqamvdkfwyn") - .withThreatTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("bvkayh").withMetricValue(1068554694), - new ThreatIntelligenceMetricEntity().withMetricName("yqiatkzwp").withMetricValue(180338782))) - .withPatternTypeMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("jaesgvvsccya").withMetricValue(306781812), - new ThreatIntelligenceMetricEntity().withMetricName("fhwygzlvdnkfxus").withMetricValue(1736640593), - new ThreatIntelligenceMetricEntity().withMetricName("zrmuhapfcqdps").withMetricValue(399879139), - new ThreatIntelligenceMetricEntity().withMetricName("psvuoymgc").withMetricValue(841424592))) - .withSourceMetrics(Arrays.asList( - new ThreatIntelligenceMetricEntity().withMetricName("rypqlmfeo").withMetricValue(1208971148), - new ThreatIntelligenceMetricEntity().withMetricName("wkyhkobopgxe").withMetricValue(1041237961)))); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceMetrics.class); - Assertions.assertEquals("udphqamvdkfwyn", model.properties().lastUpdatedTimeUtc()); - Assertions.assertEquals("bvkayh", model.properties().threatTypeMetrics().get(0).metricName()); - Assertions.assertEquals(1068554694, model.properties().threatTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("jaesgvvsccya", model.properties().patternTypeMetrics().get(0).metricName()); - Assertions.assertEquals(306781812, model.properties().patternTypeMetrics().get(0).metricValue()); - Assertions.assertEquals("rypqlmfeo", model.properties().sourceMetrics().get(0).metricName()); - Assertions.assertEquals(1208971148, model.properties().sourceMetrics().get(0).metricValue()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceParsedPatternTypeValueTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceParsedPatternTypeValueTests.java deleted file mode 100644 index b5bee60c1ceb..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceParsedPatternTypeValueTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceParsedPatternTypeValue; -import org.junit.jupiter.api.Assertions; - -public final class ThreatIntelligenceParsedPatternTypeValueTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligenceParsedPatternTypeValue model - = BinaryData.fromString("{\"valueType\":\"qhoftrmaequiah\",\"value\":\"cslfaoqzpiyylha\"}") - .toObject(ThreatIntelligenceParsedPatternTypeValue.class); - Assertions.assertEquals("qhoftrmaequiah", model.valueType()); - Assertions.assertEquals("cslfaoqzpiyylha", model.value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligenceParsedPatternTypeValue model - = new ThreatIntelligenceParsedPatternTypeValue().withValueType("qhoftrmaequiah") - .withValue("cslfaoqzpiyylha"); - model = BinaryData.fromObject(model).toObject(ThreatIntelligenceParsedPatternTypeValue.class); - Assertions.assertEquals("qhoftrmaequiah", model.valueType()); - Assertions.assertEquals("cslfaoqzpiyylha", model.value()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceTests.java deleted file mode 100644 index 8193496a4734..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/ThreatIntelligenceTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.ThreatIntelligence; - -public final class ThreatIntelligenceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ThreatIntelligence model = BinaryData.fromString( - "{\"confidence\":55.75274065776033,\"providerName\":\"oyuelyetn\",\"reportLink\":\"bf\",\"threatDescription\":\"ggagfln\",\"threatName\":\"mtrwah\",\"threatType\":\"mu\"}") - .toObject(ThreatIntelligence.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ThreatIntelligence model = new ThreatIntelligence(); - model = BinaryData.fromObject(model).toObject(ThreatIntelligence.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UrlEntityPropertiesTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UrlEntityPropertiesTests.java deleted file mode 100644 index 7abe3e87f54d..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UrlEntityPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.fluent.models.UrlEntityProperties; - -public final class UrlEntityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UrlEntityProperties model = BinaryData.fromString( - "{\"url\":\"klinhmdptysprq\",\"additionalData\":{\"g\":\"datazxojpslsv\",\"apcohhouc\":\"dataliufiqwoyxq\",\"rzdcgdzbenribcaw\":\"datapqojxcx\",\"jwfljhznamtua\":\"datatzqdd\"},\"friendlyName\":\"zwcjjncqtj\"}") - .toObject(UrlEntityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UrlEntityProperties model = new UrlEntityProperties(); - model = BinaryData.fromObject(model).toObject(UrlEntityProperties.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UrlEntityTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UrlEntityTests.java deleted file mode 100644 index c4af0f3d414e..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UrlEntityTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.UrlEntity; - -public final class UrlEntityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UrlEntity model = BinaryData.fromString( - "{\"kind\":\"Url\",\"properties\":{\"url\":\"md\",\"additionalData\":{\"remj\":\"datacbq\",\"hdbvqvwzkjop\":\"datalaqacigele\",\"bxcea\":\"databeonrlkwzdq\"},\"friendlyName\":\"cptsoqfyiase\"},\"id\":\"hkrttzrazis\",\"name\":\"ykiue\",\"type\":\"vanbwzohmnrxxbs\"}") - .toObject(UrlEntity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UrlEntity model = new UrlEntity(); - model = BinaryData.fromObject(model).toObject(UrlEntity.class); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UserInfoTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UserInfoTests.java deleted file mode 100644 index c8c1172efb0a..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/UserInfoTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.securityinsights.models.UserInfo; -import java.util.UUID; -import org.junit.jupiter.api.Assertions; - -public final class UserInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserInfo model = BinaryData - .fromString( - "{\"email\":\"wgqyw\",\"name\":\"drvyn\",\"objectId\":\"ff6b336d-8339-4403-92f4-094015b0b9fa\"}") - .toObject(UserInfo.class); - Assertions.assertEquals(UUID.fromString("ff6b336d-8339-4403-92f4-094015b0b9fa"), model.objectId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserInfo model = new UserInfo().withObjectId(UUID.fromString("ff6b336d-8339-4403-92f4-094015b0b9fa")); - model = BinaryData.fromObject(model).toObject(UserInfo.class); - Assertions.assertEquals(UUID.fromString("ff6b336d-8339-4403-92f4-094015b0b9fa"), model.objectId()); - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsDeleteWithResponseMockTests.java deleted file mode 100644 index 52f092c0ed62..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/WatchlistItemsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class WatchlistItemsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.watchlistItems() - .deleteWithResponse("syril", "hxdqaol", "ylnkkbjpjvlywltm", "wob", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsDeleteWithResponseMockTests.java b/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsDeleteWithResponseMockTests.java deleted file mode 100644 index 98fa7318d7fd..000000000000 --- a/sdk/securityinsights/azure-resourcemanager-securityinsights/src/test/java/com/azure/resourcemanager/securityinsights/generated/WatchlistsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.securityinsights.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.securityinsights.SecurityInsightsManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class WatchlistsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - SecurityInsightsManager manager = SecurityInsightsManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.watchlists().deleteWithResponse("csklhsidsjt", "lpbnin", "gazlsvbz", com.azure.core.util.Context.NONE); - - } -}